[all-commits] [llvm/llvm-project] 39c20a: [ELF] Add --remap-inputs= and --remap-inputs-file=

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Apr 26 13:19:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 39c20a63b150053fcee5928be7ea1b3b0a51c9d4
      https://github.com/llvm/llvm-project/commit/39c20a63b150053fcee5928be7ea1b3b0a51c9d4
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-04-26 (Wed, 26 Apr 2023)

  Changed paths:
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/DriverUtils.cpp
    M lld/ELF/InputFiles.cpp
    M lld/ELF/Options.td
    M lld/docs/ReleaseNotes.rst
    M lld/docs/ld.lld.1
    A lld/test/ELF/remap-inputs.test

  Log Message:
  -----------
  [ELF] Add --remap-inputs= and --remap-inputs-file=

--remap-inputs-file= can be specified multiple times, each naming a
remap file that contains `from-glob=to-file` lines or `#`-led comments.
('=' is used a separator a la -fdebug-prefix-map=)
--remap-inputs-file= can be used to:

* replace an input file. E.g. `"*/libz.so=exp/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=/dev/null"`. A build system may add unneeded dependencies.
  This option gives a convenient way to test the result removing some inputs.

`--remap-inputs=a.o=aa.o` can be specified to provide one pattern without using
an extra file.
(bash/zsh process substitution is handy for specifying a pattern without using
a remap file, e.g. `--remap-inputs-file=<(printf 'a.o=aa.o')`, but it may be
unavailable in some systems. An extra file can be inconvenient for a build
system.)

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>
Link: https://discourse.llvm.org/t/rfc-support-exclude-inputs/70070

Reviewed By: melver, peter.smith

Differential Revision: https://reviews.llvm.org/D148859




More information about the All-commits mailing list