[lld] [lld] Add target support for SystemZ (s390x) (PR #75643)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 14:53:49 PST 2024
================
@@ -1374,8 +1379,8 @@ static unsigned handleTlsRelocation(RelType type, Symbol &sym,
R_LOONGARCH_GOT_PAGE_PC, R_GOT_OFF, R_TLSIE_HINT>(expr)) {
ctx.hasTlsIe.store(true, std::memory_order_relaxed);
// Initial-Exec relocs can be optimized to Local-Exec if the symbol is
- // locally defined.
- if (execOptimize && isLocalInExecutable) {
+ // locally defined. This is not supported on SystemZ.
+ if (execOptimize && isLocalInExecutable && config->emachine != EM_S390) {
----------------
uweigand wrote:
Yes, exactly. Both Initial-Exec and Local-Exec sequences end up being LGRL+LGF, so any rewrite wouldn't actually be an optimization here. Also, to rewrite into local-exec we'd have to allocate a constant pool entry slot somewhere, which is difficult for the linker. Easier to just keep using the (already allocated) GOT slot.
Now, if we could use a more efficient Local-Exec sequence, this might be a different story. Back when the ABI was defined, the architecture didn't yet have LGFI, so there wasn't really a way to load even a 32-bit constant without constant pool. (B.t.w. are we certain that TLS offsets on a 64-bit platform can be restricted to 32 bits?)
https://github.com/llvm/llvm-project/pull/75643
More information about the llvm-commits
mailing list