[lld] [X86][LLD] Handle R_X86_64_CODE_4_GOTTPOFF relocation type (PR #116634)

Feng Zou via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 22 00:10:48 PST 2024


================
@@ -5,24 +5,38 @@
 # RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=REL %s
 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.so | FileCheck %s
 
-# SEC: .got PROGBITS 0000000000002338 000338 000010 00 WA 0 0 8
+# SEC: .got PROGBITS 0000000000002378 000378 000020 00 WA 0 0 8
 
 ## Dynamic relocations for non-preemptable symbols in a shared object have section index 0.
 # REL:      .rela.dyn {
-# REL-NEXT:   0x2338 R_X86_64_TPOFF64 - 0x0
-# REL-NEXT:   0x2340 R_X86_64_TPOFF64 - 0x4
+# REL-NEXT:   0x2378 R_X86_64_TPOFF64 - 0x0
+# REL-NEXT:   0x2380 R_X86_64_TPOFF64 - 0x8
+# REL-NEXT:   0x2388 R_X86_64_TPOFF64 - 0x4
+# REL-NEXT:   0x2390 R_X86_64_TPOFF64 - 0xC
 # REL-NEXT: }
 
-## &.got[0] - 0x127f = 0x2338 - 0x127f = 4281
-## &.got[1] - 0x1286 = 0x2340 - 0x1286 = 4282
-# CHECK:      1278:       addq 4281(%rip), %rax
-# CHECK-NEXT: 127f:       addq 4282(%rip), %rax
+## &.got[0] - 0x12af = 0x2378 - 0x12af = 4297
+## &.got[1] - 0x12b6 = 0x2380 - 0x12b6 = 4298
+## &.got[2] - 0x12be = 0x2388 - 0x12be = 4298
+## &.got[3] - 0x12c6 = 0x2390 - 0x12c6 = 4298
+
+# CHECK:      12a8:       addq 4297(%rip), %rax
+# CHECK-NEXT: 12af:       addq 4298(%rip), %rax
+# CHECK-NEXT: 12b6:       addq 4298(%rip), %r16
+# CHECK-NEXT: 12be:       addq 4298(%rip), %r16
 
 addq foo at GOTTPOFF(%rip), %rax
 addq bar at GOTTPOFF(%rip), %rax
+addq foo2 at GOTTPOFF(%rip), %r16
+addq bar2 at GOTTPOFF(%rip), %r16
+
 
 .section .tbss,"awT", at nobits
 foo:
   .long 0
+foo2:
----------------
fzou1 wrote:

Updated.

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


More information about the llvm-commits mailing list