[PATCH] D65584: [ELF] resolveUndefined: make STB_WEAK logic consistent for Undefined and SharedSymbol
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 19:05:42 PDT 2019
MaskRay updated this revision to Diff 212951.
MaskRay edited the summary of this revision.
MaskRay added a comment.
> I agree that ELF is underspecified here and I agree that the shared library shouldn't change the binding to non-weak in the executable (in the case where we allow undefined symbols in shared libraries). Personally I think ld.bfd's behaviour is preferable given the intention behind giving error messages from undefined symbols; i.e. catching likely errors at the earliest possible stage. If we permit it then the unfortunate user will get an undefined symbol error at run time from the dynamic loader instead of the static linker.
I agree erroring would be preferable. However, ld.bfd recursively loads DT_NEEDED entries to resolve undefined referenced. This behavior is not implemented in gold and lld. We may have to be permissive, as what we did in the implementation of --no-allow-shlib-undefined.
Added an example to the description:
> If one of the DSO defines foo and it is in the link-time search path (e.g. DT_NEEDED entry is an absolute path, via -rpath=, via -rpath-link=, etc), ld.bfd %t1.o %t2.so and ld.bfd %t1.o %t2.so will not error.
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65584/new/
https://reviews.llvm.org/D65584
Files:
ELF/InputFiles.cpp
ELF/Symbols.cpp
ELF/Symbols.h
test/ELF/weak-undef-shared.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65584.212951.patch
Type: text/x-patch
Size: 4058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190802/c1995553/attachment.bin>
More information about the llvm-commits
mailing list