[ELF] Refine isExported/isPreemptible condition
[llvm-project.git] / lld / test / ELF / tls-opt.s
blob466dda0ef2e7b802000ce2616f21893812aafa2c
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 // RUN: ld.lld %t.o -o %t1
4 // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s
5 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefix=DISASM %s
7 // NORELOC: Relocations [
8 // NORELOC-NEXT: ]
10 // DISASM: <_start>:
11 // DISASM-NEXT: movq $-8, %rax
12 // DISASM-NEXT: movq $-8, %r15
13 // DISASM-NEXT: leaq -8(%rax), %rax
14 // DISASM-NEXT: leaq -8(%r15), %r15
15 // DISASM-NEXT: addq $-8, %rsp
16 // DISASM-NEXT: addq $-8, %r12
17 // DISASM-NEXT: movq $-4, %rax
18 // DISASM-NEXT: movq $-4, %r15
19 // DISASM-NEXT: leaq -4(%rax), %rax
20 // DISASM-NEXT: leaq -4(%r15), %r15
21 // DISASM-NEXT: addq $-4, %rsp
22 // DISASM-NEXT: addq $-4, %r12
23 # EGPR
24 // DISASM-NEXT: movq $-8, %r16
25 // DISASM-NEXT: movq $-8, %r20
26 // DISASM-NEXT: movq $-4, %r16
27 // DISASM-NEXT: addq $-8, %r16
28 // DISASM-NEXT: addq $-8, %r28
29 // DISASM-NEXT: addq $-4, %r16
30 # NDD
31 // DISASM-NEXT: addq $-8, %r16, %r16
32 // DISASM-NEXT: addq $-8, %r16, %r20
33 // DISASM-NEXT: addq $-8, %r16, %rax
34 // DISASM-NEXT: addq $-8, %rax, %r16
35 // DISASM-NEXT: addq $-8, %r8, %r16
36 // DISASM-NEXT: addq $-8, %rax, %r12
37 # NDD + NF
38 // DISASM-NEXT: {nf} addq $-8, %r8, %r16
39 // DISASM-NEXT: {nf} addq $-8, %rax, %r12
40 # NF
41 // DISASM-NEXT: {nf} addq $-8, %r12
43 // LD to LE:
44 // DISASM-NEXT: movq %fs:0, %rax
45 // DISASM-NEXT: leaq -8(%rax), %rcx
46 // DISASM-NEXT: movq %fs:0, %rax
47 // DISASM-NEXT: leaq -4(%rax), %rcx
49 // GD to LE:
50 // DISASM-NEXT: movq %fs:0, %rax
51 // DISASM-NEXT: leaq -8(%rax), %rax
52 // DISASM-NEXT: movq %fs:0, %rax
53 // DISASM-NEXT: leaq -4(%rax), %rax
55 // LD to LE:
56 // DISASM: <_DTPOFF64_1>:
57 // DISASM-NEXT: clc
58 // DISASM: <_DTPOFF64_2>:
59 // DISASM-NEXT: cld
61 .type tls0,@object
62 .section .tbss,"awT",@nobits
63 .globl tls0
64 .align 4
65 tls0:
66 .long 0
67 .size tls0, 4
69 .type tls1,@object
70 .globl tls1
71 .align 4
72 tls1:
73 .long 0
74 .size tls1, 4
76 .section .text
77 .globl _start
78 _start:
79 movq tls0@GOTTPOFF(%rip), %rax
80 movq tls0@GOTTPOFF(%rip), %r15
81 addq tls0@GOTTPOFF(%rip), %rax
82 addq tls0@GOTTPOFF(%rip), %r15
83 addq tls0@GOTTPOFF(%rip), %rsp
84 addq tls0@GOTTPOFF(%rip), %r12
85 movq tls1@GOTTPOFF(%rip), %rax
86 movq tls1@GOTTPOFF(%rip), %r15
87 addq tls1@GOTTPOFF(%rip), %rax
88 addq tls1@GOTTPOFF(%rip), %r15
89 addq tls1@GOTTPOFF(%rip), %rsp
90 addq tls1@GOTTPOFF(%rip), %r12
91 # EGPR
92 movq tls0@GOTTPOFF(%rip), %r16
93 movq tls0@GOTTPOFF(%rip), %r20
94 movq tls1@GOTTPOFF(%rip), %r16
95 addq tls0@GOTTPOFF(%rip), %r16
96 addq tls0@GOTTPOFF(%rip), %r28
97 addq tls1@GOTTPOFF(%rip), %r16
98 # NDD
99 addq tls0@GOTTPOFF(%rip), %r16, %r16
100 addq tls0@GOTTPOFF(%rip), %r16, %r20
101 addq tls0@GOTTPOFF(%rip), %r16, %rax
102 addq tls0@GOTTPOFF(%rip), %rax, %r16
103 addq %r8, tls0@GOTTPOFF(%rip), %r16
104 addq tls0@GOTTPOFF(%rip), %rax, %r12
105 # NDD + NF
106 {nf} addq %r8, tls0@GOTTPOFF(%rip), %r16
107 {nf} addq tls0@GOTTPOFF(%rip), %rax, %r12
108 # NF
109 {nf} addq tls0@GOTTPOFF(%rip), %r12
111 // LD to LE
112 leaq tls0@tlsld(%rip), %rdi
113 callq __tls_get_addr@PLT
114 leaq tls0@dtpoff(%rax),%rcx
115 leaq tls1@tlsld(%rip), %rdi
116 callq __tls_get_addr@PLT
117 leaq tls1@dtpoff(%rax),%rcx
119 // GD to LE
120 .byte 0x66
121 leaq tls0@tlsgd(%rip),%rdi
122 .word 0x6666
123 rex64
124 call __tls_get_addr@plt
125 .byte 0x66
126 leaq tls1@tlsgd(%rip),%rdi
127 .word 0x6666
128 rex64
129 call __tls_get_addr@plt
131 // LD to LE
132 _DTPOFF64_1:
133 .quad tls0@DTPOFF
136 _DTPOFF64_2:
137 .quad tls1@DTPOFF