]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-x86-64/tlsbinpic.s
bfd/
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-x86-64 / tlsbinpic.s
CommitLineData
bffbf940
JJ
1 /* Force .data aligned to 4K, so that .got very likely gets at
2 0x5021a0 (0x60 bytes .tdata and 0x140 bytes .dynamic) */
3 .data
4 .balign 4096
5 .section ".tdata", "awT", @progbits
6 .globl sg1, sg2, sg3, sg4, sg5, sg6, sg7, sg8
7 .globl sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
8 .hidden sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
9sg1: .long 17
10sg2: .long 18
11sg3: .long 19
12sg4: .long 20
13sg5: .long 21
14sg6: .long 22
15sg7: .long 23
16sg8: .long 24
17sl1: .long 65
18sl2: .long 66
19sl3: .long 67
20sl4: .long 68
21sl5: .long 69
22sl6: .long 70
23sl7: .long 71
24sl8: .long 72
25sh1: .long 257
26sh2: .long 258
27sh3: .long 259
28sh4: .long 260
29sh5: .long 261
30sh6: .long 262
31sh7: .long 263
32sh8: .long 264
33 /* Force .text aligned to 4K, so it very likely gets at 0x401000. */
34 .text
35 .balign 4096
36 .globl fn2
37 .type fn2,@function
38fn2:
39 pushq %rbp
40 movq %rsp, %rbp
41
42 /* GD -> IE because variable is not defined in executable */
43 .long 0x66666666
44 leaq sG1@tlsgd(%rip), %rdi
45 call __tls_get_addr@plt
46 nop;nop;nop;nop
47
48 /* GD -> IE because variable is not defined in executable where
49 the variable is referenced through IE too */
50 .long 0x66666666
51 leaq sG2@tlsgd(%rip), %rdi
52 call __tls_get_addr@plt
53 nop;nop;nop;nop
54
55 /* GD -> LE with global variable defined in executable */
56 .long 0x66666666
57 leaq sg1@tlsgd(%rip), %rdi
58 call __tls_get_addr@plt
59 nop;nop;nop;nop
60
61 /* GD -> LE with local variable defined in executable */
62 .long 0x66666666
63 leaq sl1@tlsgd(%rip), %rdi
64 call __tls_get_addr@plt
65 nop;nop;nop;nop
66
67 /* GD -> LE with hidden variable defined in executable */
68 .long 0x66666666
69 leaq sh1@tlsgd(%rip), %rdi
70 call __tls_get_addr@plt
71 nop;nop;nop;nop
72
a45bb67d 73 /* LD -> LE */
bffbf940
JJ
74 leaq sl1@tlsld(%rip), %rdi
75 call __tls_get_addr@plt
76 nop;nop
77 leaq 1+sl1@dtpoff(%rax), %rdx
78 nop;nop
79 leaq sl2@dtpoff+2(%rax), %r9
80 nop;nop;nop;nop
81
a45bb67d 82 /* LD -> LE against hidden variables */
bffbf940
JJ
83 leaq sh1@tlsld(%rip), %rdi
84 call __tls_get_addr@plt
85 nop;nop
86 leaq sh1@dtpoff(%rax), %rdx
87 nop;nop
88 leaq 3+sh2@dtpoff(%rax), %rcx
89 nop;nop;nop;nop
90
91 /* IE against global var */
92 movq %fs:0, %r9
93 nop;nop
94 addq sG2@gottpoff(%rip), %r9
95 nop;nop;nop;nop
96
97 /* IE -> LE against global var defined in exec */
98 movq %fs:0, %r10
99 nop;nop
100 addq sg1@gottpoff(%rip), %r10
101 nop;nop;nop;nop
102
103 /* IE -> LE against local var */
104 movq %fs:0, %rax
105 nop;nop
106 addq sl1@gottpoff(%rip), %rax
107 nop;nop;nop;nop
108
109 /* IE -> LE against hidden var */
110 movq %fs:0, %rcx
111 nop;nop
112 addq sh1@gottpoff(%rip), %rcx
113 nop;nop;nop;nop
114
115 /* Direct access through %fs */
116
117 /* IE against global var */
118 movq sG5@gottpoff(%rip), %rcx
119 nop;nop
120 movq %fs:(%rcx), %rdx
121 nop;nop;nop;nop
122
123 /* IE->LE against local var */
124 movq sl5@gottpoff(%rip), %r11
125 nop;nop
126 movq %fs:(%r11), %r12
127 nop;nop;nop;nop
128
129 /* IE->LE against hidden var */
130 movq sh5@gottpoff(%rip), %rdx
131 nop;nop
132 movq %fs:(%rdx), %rdx
133 nop;nop;nop;nop
134
135 leave
136 ret