[lld] d3e683c - [ELF][SystemZ] Fix R_390_TLS_LDO32/64 in non-SHF_ALLOC sections
Jessica Clarke via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 17 09:03:26 PST 2026
Author: Jessica Clarke
Date: 2026-02-17T17:03:12Z
New Revision: d3e683cabf908d6594721d2dc4a799cafad825ab
URL: https://github.com/llvm/llvm-project/commit/d3e683cabf908d6594721d2dc4a799cafad825ab
DIFF: https://github.com/llvm/llvm-project/commit/d3e683cabf908d6594721d2dc4a799cafad825ab.diff
LOG: [ELF][SystemZ] Fix R_390_TLS_LDO32/64 in non-SHF_ALLOC sections
These can appear in .debug_info so, like other architectures (e.g.
X86_64), we still need to handle them in getRelExpr.
Fixes: aec1c984266c ("[ELF] Add target-specific relocation scanning for SystemZ (#181563)")
Added:
Modified:
lld/ELF/Arch/SystemZ.cpp
lld/test/ELF/systemz-tls-ld.s
Removed:
################################################################################
diff --git a/lld/ELF/Arch/SystemZ.cpp b/lld/ELF/Arch/SystemZ.cpp
index 43ce4d2f7d3e0..51d80eff33eb3 100644
--- a/lld/ELF/Arch/SystemZ.cpp
+++ b/lld/ELF/Arch/SystemZ.cpp
@@ -88,6 +88,9 @@ RelExpr SystemZ::getRelExpr(RelType type, const Symbol &s,
case R_390_32:
case R_390_64:
return R_ABS;
+ case R_390_TLS_LDO32:
+ case R_390_TLS_LDO64:
+ return R_DTPREL;
case R_390_PC32:
case R_390_PC64:
return R_PC;
diff --git a/lld/test/ELF/systemz-tls-ld.s b/lld/test/ELF/systemz-tls-ld.s
index ef104b82644ce..92c16c27e3e02 100644
--- a/lld/test/ELF/systemz-tls-ld.s
+++ b/lld/test/ELF/systemz-tls-ld.s
@@ -5,11 +5,13 @@
# RUN: llvm-readelf -r %t.so | FileCheck --check-prefix=LD-REL %s
# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=LD %s
# RUN: llvm-objdump --section .data.rel.ro --full-contents %t.so | FileCheck --check-prefix=LD-DATA %s
+# RUN: llvm-readobj -x.debug_info %t.so | FileCheck --check-prefix=DEBUG-INFO %s
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
# RUN: llvm-objdump --section .data.rel.ro --full-contents %t | FileCheck --check-prefix=LE-DATA %s
+# RUN: llvm-readobj -x.debug_info %t | FileCheck --check-prefix=DEBUG-INFO %s
# LD-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 1 entries:
# LD-REL: 00000000000024f8 0000000000000036 R_390_TLS_DTPMOD 0
@@ -72,6 +74,10 @@
# LE-DATA: 1002210 00000000 00000000 ffffffff fffffff8
# LE-DATA: 1002220 ffffffff fffffffc 00000000 00000000
+# DEBUG-INFO: Hex dump of section '.debug_info':
+# DEBUG-INFO-NEXT: 0x00000000 00000000 00000008 00000000 0000000c
+# DEBUG-INFO-NEXT: 0x00000010 00000000 00000010
+
ear %r7,%a0
sllg %r7,%r1,32
@@ -112,3 +118,8 @@ a:
b:
.zero 4
c:
+
+.section .debug_info,"", at progbits
+.quad a at DTPOFF
+.quad b at DTPOFF
+.quad c at DTPOFF
More information about the llvm-commits
mailing list