2 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/tls-opt-gdie.s -o %tso.o
4 // RUN: ld.lld -shared %tso.o -o %t.so
5 // RUN: ld.lld --hash-style=sysv %t.o %t.so -o %t1
6 // RUN: llvm-readobj -s -r %t1 | FileCheck --check-prefix=RELOC %s
7 // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s
12 //RELOC-NEXT: Type: SHT_PROGBITS
14 //RELOC-NEXT: SHF_ALLOC
15 //RELOC-NEXT: SHF_WRITE
17 //RELOC-NEXT: Address: 0x2020B0
18 //RELOC-NEXT: Offset: 0x20B0
19 //RELOC-NEXT: Size: 16
22 //RELOC-NEXT: AddressAlignment: 8
23 //RELOC-NEXT: EntrySize: 0
25 //RELOC: Relocations [
26 //RELOC-NEXT: Section (4) .rela.dyn {
27 //RELOC-NEXT: 0x2020B0 R_X86_64_TPOFF64 tlsshared0 0x0
28 //RELOC-NEXT: 0x2020B8 R_X86_64_TPOFF64 tlsshared1 0x0
32 //0x201009 + (4256 + 7) = 0x2020B0
33 //0x201019 + (4248 + 7) = 0x2020B8
34 // DISASM: Disassembly of section .text:
35 // DISASM-NEXT: _start:
36 // DISASM-NEXT: 201000: {{.*}} movq %fs:0, %rax
37 // DISASM-NEXT: 201009: {{.*}} addq 4256(%rip), %rax
38 // DISASM-NEXT: 201010: {{.*}} movq %fs:0, %rax
39 // DISASM-NEXT: 201019: {{.*}} addq 4248(%rip), %rax
45 leaq tlsshared0@tlsgd(%rip),%rdi
48 call __tls_get_addr@plt
50 leaq tlsshared1@tlsgd(%rip),%rdi
53 call __tls_get_addr@plt