[PATCH] D148795: [ELF] Support --remap-inputs

Marco Elver via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 05:33:27 PDT 2023


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

Linking of binaries in large projects often results in processing of
thousands of linker inputs. In such projects, controlling all transitive
dependencies' inputs and libraries to be added to the final linker
command is (unfortunately) often too complex.

In theory the build system should provide a convenient way to simply
exclude (or replace) a given library, but the reality is that few build
systems do.

The simplest possible design, that will work across all build systems,
is therefore to pass an option to the linker to exclude or replace
inputs matching a given pattern. The possible use cases are:

1. Removing inputs added by dependencies (e.g. via pkg-config) where modification of the build scripts (or build systems such as Bazel) is infeasible.
2. Replacing inputs added by dependencies where modification of the build scripts is infeasible.
3. Replacing default inputs with custom implementations.

Introduce --remap-inputs, which accomplishes just that. See added
man page documentation for more details.

This version is the unified feature first proposed in
https://reviews.llvm.org/D130229 and https://reviews.llvm.org/D148726.

Link: https://discourse.llvm.org/t/rfc-support-exclude-inputs
Co-developed-by: Fangrui Song <i at maskray.me>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148795

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148795.515291.patch
Type: text/x-patch
Size: 7185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230420/7cb58e58/attachment.bin>


More information about the llvm-commits mailing list