public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <i@maskray.me>
To: binutils@sourceware.org
Subject: ld: Add --remap-inputs-file= to remap input files
Date: Thu, 20 Apr 2023 17:11:25 -0700	[thread overview]
Message-ID: <DS7PR12MB5765CBC2B4D6D9C4C785379ACB609@DS7PR12MB5765.namprd12.prod.outlook.com> (raw)

Hello! I'm considering an option in ld.lld to replace or remove input
files with glob patterns.
I just filed a feature request
https://sourceware.org/bugzilla/show_bug.cgi?id=30374 , but thought
that I should send the message here to possibly get more attention.
(I originally named the option --remapping-file=, but Marco Elver's
--remap-inputs-file= suggestion looks better.)

--remap-inputs-file= can be specified multiple times, each naming a
remap file that contains from-glob<tab>to-file lines or #-led comments, e.g.

aa.o a.o
b?.[b]c b.o
cc.a c.a
d*.so d.so
## Use /dev/null to indicate an input file which should be ignored.
/dev/null is treated as an empty linker script.
empty /dev/null


This option can be used to:

* replace an input file. E.g. "*/libz.so\texp/libz.so" can replace a
resolved -lz without updating the input file list or (if used) a
response file. When debugging an application where a bug is isolated
to one single input file, this option gives a convenient way to test
fixes.

* remove an input file with /dev/null (changed to NUL on Windows),
e.g. "a.o\t/dev/null". A build system may add unneeded dependencies.
This option gives a convenient way to test the result by removing some
inputs.

bash/zsh process substitution is handy for specifying a pattern
without using a remap file, e.g. --remap-inputs-file=<(printf
'a.o\taa.o').
Therefore, I think an option providing an inline pattern
(--remap-inputs=a.o=aa.o) may not be too useful.

                 reply	other threads:[~2023-04-21  0:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DS7PR12MB5765CBC2B4D6D9C4C785379ACB609@DS7PR12MB5765.namprd12.prod.outlook.com \
    --to=i@maskray.me \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).