[ELF] Fix a null pointer dereference when relocating a Local-Exec TLS relocation...
authorFangrui Song <maskray@google.com>
Tue, 21 Apr 2020 21:44:03 +0000 (14:44 -0700)
committerFangrui Song <maskray@google.com>
Tue, 21 Apr 2020 22:39:31 +0000 (15:39 -0700)
commit01d2a01e79d3d83f18cf3e54c2bf55bba523b77a
treebc91a6c7b6430885b1fe289f2a61e69c3d9d95fb
parentc860262bd20d37c23053f14a82e8e4aa8827cc10
[ELF] Fix a null pointer dereference when relocating a Local-Exec TLS relocation for a lazy symbol

If there is no SHF_TLS section, there will be no PT_TLS and Out::tlsPhdr may be a nullptr.
If the symbol referenced by an R_TLS is lazy, we should treat the symbol as undefined.

Also reorganize tls-in-archive.s and tls-weak-undef.s . They do not test what they intended to test.
lld/ELF/InputSection.cpp
lld/test/ELF/Inputs/tls-in-archive.s [deleted file]
lld/test/ELF/tls-in-archive.s [deleted file]
lld/test/ELF/tls-le-weak-undef.s [new file with mode: 0644]
lld/test/ELF/tls-weak-undef.s [deleted file]
lld/test/ELF/x86-64-tls-le-undef.s