[ELF] Support TLS GD/LD relaxations for x86-32 -fno-plt
authorFangrui Song <i@maskray.me>
Sun, 1 Jan 2023 04:50:54 +0000 (20:50 -0800)
committerFangrui Song <i@maskray.me>
Sun, 1 Jan 2023 04:50:54 +0000 (20:50 -0800)
commit8dc73662ab5f7c992f9d7778de7c3611c1d5367e
treec2cfa17e85590448c2bc4580902536a68092ace3
parent1e48ed3932496b16f27e9aff866a90e6d99ead34
[ELF] Support TLS GD/LD relaxations for x86-32 -fno-plt

For x86-32, {clang,gcc} -fno-plt uses `call *___tls_get_addr@GOT(%reg)` instead
of `call ___tls_get_addr@PLT`. GD to IE/LE relaxations need to shift the offset
by one while LD to LE relaxation needs to use a different code sequence.

While here, fix some comments.

Fix https://github.com/llvm/llvm-project/issues/59769

Differential Revision: https://reviews.llvm.org/D140813
lld/ELF/Arch/X86.cpp
lld/test/ELF/i386-tls-gdiele.s
lld/test/ELF/i386-tls-opt.s