[ELF] Fix includeInDynsym() when an undefined weak is merged with a lazy definition
authorFangrui Song <maskray@google.com>
Thu, 9 Jan 2020 23:53:52 +0000 (15:53 -0800)
committerFangrui Song <maskray@google.com>
Fri, 10 Jan 2020 00:24:02 +0000 (16:24 -0800)
commit375371cc8bff7ba02d0a2203f80de5e640fcadf1
tree815fabfb0868197ed1544750a583f14c8eb74288
parent02113918ed6b5e514afd7d1e007131d36ac13f1d
[ELF] Fix includeInDynsym() when an undefined weak is merged with a lazy definition

An undefined weak does not fetch the lazy definition. A lazy weak symbol
should be considered undefined, and thus preemptible if .dynsym exists.

D71795 is not quite an NFC. It errors on an R_X86_64_PLT32 referencing
an undefined weak symbol. isPreemptible is false (incorrect) => R_PLT_PC
is optimized to R_PC => in isStaticLinkTimeConstant, an error is emitted
when an R_PC is applied on an undefined weak (considered absolute).
lld/ELF/Symbols.cpp
lld/test/ELF/weak-undef-lib.s