public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld: Add --remap-inputs-file= to remap input files
@ 2023-04-21  0:11 Fangrui Song
  0 siblings, 0 replies; only message in thread
From: Fangrui Song @ 2023-04-21  0:11 UTC (permalink / raw)
  To: binutils

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-21  0:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21  0:11 ld: Add --remap-inputs-file= to remap input files Fangrui Song

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).