[PATCH] D103303: [ELF] Add --overwrite-section-script

Roland McGrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 3 17:39:38 PDT 2021


mcgrathr added a comment.

In D103303#2797099 <https://reviews.llvm.org/D103303#2797099>, @MaskRay wrote:

> This would add some complexity to `readLinkerScript` as we will need to check the first token. Do we really need it?
> This is just a matter between `$file` and `-Wl,--overwrite-script=$file` in the build system.

That is no small matter in many build systems.  Switches that name input files are especially difficult in general.

Even if you have no sympathy for build systems you don't know about, requiring a switch precludes using this functionality as a "transparent" part of a library implementation.  Supporting "just add `-lfoo` to your compile" as the end-user API for using a library is highly desireable, and often a non-negotiable requirement.  Having a `libfoo.a` input linker script that wraps an `INPUT ( libfoo-impl.a )` along with other magic is a well-worn and very successful technique.  The use cases you cite as motivations for adding this feature in the first place are exactly the kinds of things one would like to encapsulate as "hidden magic" in a library that's "just linked".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103303/new/

https://reviews.llvm.org/D103303



More information about the llvm-commits mailing list