[PATCH] D56089: [ELF] A shared object is needed if any of its occurrences is needed
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 26 15:08:51 PST 2018
MaskRay added a comment.
In D56089#1341040 <https://reviews.llvm.org/D56089#1341040>, @ruiu wrote:
> Although I understand how your change works, I don't understand why you need this in the first place. What is the use case in which you want to specify the same DSO more than once in the same command line, with and without --as-needed?
The AsNeeded status of `a.so` can also come from the linker script command `AS_NEEDED`. If an executable links in the script `b.so` (`AS_NEEDED(a.so)`), but really wants `a.so` to be loaded, it may link in `a.so` explicitly. Without the patch (making it consistent with ld.bfd/gold), the `DT_NEEDED` entry of `a.so` will be dropped.
Now the question is why we want to ensure some DSOs in `DT_NEEDED` entries. It can be related to static constructors and DSO loading order problems (honestly I think many of them are just user error...).
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56089/new/
https://reviews.llvm.org/D56089
More information about the llvm-commits
mailing list