[lld] [ELF] Handle and optimize x86-64 PLTOFF64 TLS sequences (PR #216263)

Jessica Clarke via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 10:05:29 PDT 2026


================
@@ -0,0 +1,100 @@
+# REQUIRES: x86
+## Test dynamic TLS sequences that call __tls_get_addr indirectly through
+## R_X86_64_PLTOFF64 instead of a direct call.
+
+# RUN: rm -rf %t && split-file %s %t && cd %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o
+# RUN: ld.lld -shared b.o -soname=b.so -o b.so
+
+# RUN: ld.lld a.o b.so -o out
+# RUN: llvm-readelf -Sr out | FileCheck %s --check-prefix=SEC
+# RUN: llvm-objdump -d --no-show-raw-insn --no-print-imm-hex out | FileCheck %s --check-prefix=EXE
+
+# RUN: ld.lld -shared a.o b.so -o out.so
+# RUN: llvm-readelf -r out.so | FileCheck %s --check-prefix=SDYN
+# RUN: llvm-objdump -d --no-show-raw-insn --no-print-imm-hex out.so | FileCheck %s --check-prefix=SHARED
+
+# SEC:      .got PROGBITS 0000000000202418
+# SEC:      Relocation section '.rela.dyn' {{.*}} contains 1 entries:
+# SEC:      0000000000202418 {{.*}} R_X86_64_TPOFF64 {{.*}} y + 0
----------------
jrtc27 wrote:

Deindent if there aren't going to be any -NEXT/-LABEL lines?

https://github.com/llvm/llvm-project/pull/216263


More information about the llvm-commits mailing list