3 // Checks whether the TLS optimizations match the cases in Chapter
11 of
4 // https
://raw.githubusercontent.com
/wiki
/hjl-tools
/x86-psABI
/x86-
64-psABI-
1.0.pdf
6 // RUN
: llvm-mc
-filetype
=obj
-triple
=x86_64-unknown-linux
%s
-o
%t.o
7 // RUN
: llvm-mc
-filetype
=obj
-triple
=x86_64-unknown-linux
%p
/Inputs
/tls-opt-gdie.s
-o
%tso.o
8 // RUN
: ld.lld
-shared
%tso.o
-soname
=t.so
-o
%t.so
9 // RUN
: ld.lld
%t.o
%t.so
-o
%t1
10 // RUN
: llvm-readobj
-r
%t1 | FileCheck
--check-prefix
=RELOC
%s
11 // RUN
: llvm-objdump
--no-print-imm-hex
-d
--no-show-raw-insn
%t1 | FileCheck
--check-prefix
=DISASM
%s
13 // RELOC
: Relocations
[
14 // RELOC-NEXT
: Section
{{.*}} .rela.dyn {
15 // RELOC-NEXT
: 0x202420 R_X86_64_TPOFF64 tlsshared0
0x0
16 // RELOC-NEXT
: 0x202428 R_X86_64_TPOFF64 tlsshared1
0x0
22 // Table
11.5: GD
-> IE Code Transition
(LP64
)
23 // DISASM-NEXT
: movq
%fs:0, %rax
24 // DISASM-NEXT
: 201309: addq
4368(%rip
), %rax
25 // DISASM-NEXT
: movq
%fs:0, %rax
26 // DISASM-NEXT
: 201319: addq
4360(%rip
), %rax
28 // Table
11.7: GD
-> LE Code Transition
(LP64
)
29 // DISASM-NEXT
: movq
%fs:0, %rax
30 // DISASM-NEXT
: leaq
-8(%rax
), %rax
31 // DISASM-NEXT
: movq
%fs:0, %rax
32 // DISASM-NEXT
: leaq
-4(%rax
), %rax
35 // Table
11.9: LD -> LE Code Transition
(LP64
)
36 // DISASM-NEXT
: movq
%fs:0, %rax
37 // DISASM-NEXT
: movq
%fs:0, %rax
40 .section .tbss,"awT",@nobits
57 // Table
11.5: GD
-> IE Code Transition
(LP64
)
59 leaq tlsshared0@tlsgd
(%rip
),%rdi
62 call
*__tls_get_addr@GOTPCREL
(%rip
)
65 leaq tlsshared1@tlsgd
(%rip
),%rdi
68 call
*__tls_get_addr@GOTPCREL
(%rip
)
70 // Table
11.7: GD
-> LE Code Transition
(LP64
)
72 leaq tls0@tlsgd
(%rip
),%rdi
75 call
*__tls_get_addr@GOTPCREL
(%rip
)
78 leaq tls1@tlsgd
(%rip
),%rdi
81 call
*__tls_get_addr@GOTPCREL
(%rip
)
83 // Table
11.9: LD -> LE Code Transition
(LP64
)
84 leaq tls0@tlsld
(%rip
),%rdi
85 call
*__tls_get_addr@GOTPCREL
(%rip
)
87 leaq tls1@tlsld
(%rip
),%rdi
88 call
*__tls_get_addr@GOTPCREL
(%rip
)