1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3# RUN: ld.lld -shared %t.o -o %t.so
4# RUN: llvm-readelf -S %t.so | FileCheck --check-prefix=SEC %s
5# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=REL %s
6# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s
7
8# SEC: .got PROGBITS 0000000000002338 000338 000010 00 WA 0 0 8
9
10## Dynamic relocations for non-preemptable symbols in a shared object have section index 0.
11# REL:      .rela.dyn {
12# REL-NEXT:   0x2338 R_X86_64_TPOFF64 - 0x0
13# REL-NEXT:   0x2340 R_X86_64_TPOFF64 - 0x4
14# REL-NEXT: }
15
16## &.got[0] - 0x127f = 0x2338 - 0x127f = 4281
17## &.got[1] - 0x1286 = 0x2340 - 0x1286 = 4282
18# CHECK:      1278:       addq 4281(%rip), %rax
19# CHECK-NEXT: 127f:       addq 4282(%rip), %rax
20
21addq foo@GOTTPOFF(%rip), %rax
22addq bar@GOTTPOFF(%rip), %rax
23
24.section .tbss,"awT",@nobits
25foo:
26  .long 0
27bar:
28  .long 0
29