[ELF] Don't error on R_PPC64_REL24/R_PPC64_REL24_NOTOC referencing __tls_get_addr...
authorFangrui Song <i@maskray.me>
Fri, 23 Oct 2020 17:37:24 +0000 (10:37 -0700)
committerFangrui Song <i@maskray.me>
Fri, 23 Oct 2020 17:38:07 +0000 (10:38 -0700)
commit9267caebfa9209e4ae69517043d008d1b83307aa
tree1698e28d23d23fcd78cf4633751c7202c9e69439
parent2b8fb5185e4a2087874924468086e3fb6a2ec495
[ELF] Don't error on R_PPC64_REL24/R_PPC64_REL24_NOTOC referencing __tls_get_addr for missing R_PPC64_TLSGD/R_PPC64_TLSLD

This partially reverts D85994.

In glibc, elf/dl-sym.c calls the raw `__tls_get_addr` by specifying the
tls_index parameter. Such a call does not have a pairing R_PPC64_TLSGD/R_PPC64_TLSLD.
This is legitimate. Since we cannot distinguish the benign case from cases due
to toolchain issues, we have to be permissive.

Acked by Stefan Pintilie
lld/ELF/Relocations.cpp
lld/test/ELF/ppc64-tls-missing-gdld.s