[lld] [lld/ELF] Fix GD TLS DTPMOD64/DTPOFF64 mismatch (PR #207872)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 19:50:48 PDT 2026


================
@@ -0,0 +1,39 @@
+// REQUIRES: x86
+// RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+// RUN: ld.lld -shared -Bsymbolic %t.o -o %t.so
+// RUN: llvm-readobj -r %t.so | FileCheck %s
+
+        .byte   0x66
+        leaq    foo at tlsgd(%rip), %rdi
+        .value  0x6666
+        rex64
+        call    __tls_get_addr at PLT
+
+        .byte   0x66
+        leaq    bar at tlsgd(%rip), %rdi
+        .value  0x6666
+        rex64
+        call    __tls_get_addr at PLT
+
+        .section        .tbss,"awT", at nobits
+        .weak   foo
+foo:
+        .zero   4
+
+        .hidden bar
+        .weak   bar
+bar:
+        .zero   4
+
+// CHECK:      Relocations [
+// CHECK-NEXT:   Section ({{.*}}) .rela.dyn {
+//
+// Hidden weak TLS variables are non-preemptible. Only emit DTPMOD
----------------
MaskRay wrote:

utterly wrong. -Bsymbolic makes it non-preemptible.

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


More information about the llvm-commits mailing list