[PATCH] D148859: [ELF] Add --remap-inputs-file=

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 16:56:16 PDT 2023


MaskRay created this revision.
MaskRay added reviewers: andrewng, melver, peter.smith, smeenai.
Herald added subscribers: arichardson, emaste.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

--remap-inputs-file= can be specified multiple times, each naming a
remap file that contains `from-glob<tab>to-file` lines or `#`-led comments.
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 an 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 an convenient way to test the result 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')`

Exact patterns are tested before wildcard patterns. In case of a tie, the first
patterns wins. This is an implementation detail that users should not rely on.

Co-authored-by: Marco Elver <elver at google.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148859

Files:
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/DriverUtils.cpp
  lld/ELF/InputFiles.cpp
  lld/ELF/Options.td
  lld/docs/ld.lld.1
  lld/test/ELF/remap-inputs-file.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148859.515533.patch
Type: text/x-patch
Size: 7390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230420/dc6fd0d4/attachment.bin>


More information about the llvm-commits mailing list