]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/tls-opt-gdie.s
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / ELF / tls-opt-gdie.s
1 // REQUIRES: x86
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
8
9 //RELOC:      Section {
10 //RELOC:      Index:
11 //RELOC:      Name: .got
12 //RELOC-NEXT: Type: SHT_PROGBITS
13 //RELOC-NEXT: Flags [
14 //RELOC-NEXT:   SHF_ALLOC
15 //RELOC-NEXT:   SHF_WRITE
16 //RELOC-NEXT: ]
17 //RELOC-NEXT: Address: 0x2020B0
18 //RELOC-NEXT: Offset: 0x20B0
19 //RELOC-NEXT: Size: 16
20 //RELOC-NEXT: Link: 0
21 //RELOC-NEXT: Info: 0
22 //RELOC-NEXT: AddressAlignment: 8
23 //RELOC-NEXT: EntrySize: 0
24 //RELOC-NEXT: }
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
29 //RELOC-NEXT:   }
30 //RELOC-NEXT: ]
31
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
40
41 .section .text
42 .globl _start
43 _start:
44  .byte 0x66
45  leaq tlsshared0@tlsgd(%rip),%rdi
46  .word 0x6666
47  rex64
48  call __tls_get_addr@plt
49  .byte 0x66
50  leaq tlsshared1@tlsgd(%rip),%rdi
51  .word 0x6666
52  rex64
53  call __tls_get_addr@plt