[PATCH] D95985: [ELF] Resolve defined symbols before undefined symbols
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 4 12:13:18 PST 2021
MaskRay added a comment.
In D95985#2543028 <https://reviews.llvm.org/D95985#2543028>, @peter.smith wrote:
> OK. Had a chance to go through this in more detail. To make sure I understand; if the undefined symbols are in object files/libraries yet to be processed then there is no difference, but if there is a lazy symbol for an undefined then the object will be fetched immediately on seeing
>
> // Handle global undefined symbols.
> if (eSym.st_shndx == SHN_UNDEF) {
>
> Resulting in globals being loaded from a recursive chain of lazy loads before the globals from this object file have been loaded.
>
> If I've got that right then I agree that this is a worthwhile change to make, if only because it makes library selection a bit more predictable/less-surprising.
Yes. The idea is to postpone Undefined resolution (which may fetch lazy symbols) to the end. Previously, if we swap the order of a defined and an undefined in an object file, it can potentially change the symbol resolution result.
The new behavior is immune to defined/undefined shuffles.
Undefined shuffles (due to lazy symbols) can still result to different symbol resolution results.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95985/new/
https://reviews.llvm.org/D95985
More information about the llvm-commits
mailing list