bfd/
[binutils.git] / ld / testsuite / ld-x86-64 / tlsbinpic.s
blobda6085f233d01c2b17e7aee5a2bfe71f5bd6d509
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
9 sg1: .long 17
10 sg2: .long 18
11 sg3: .long 19
12 sg4: .long 20
13 sg5: .long 21
14 sg6: .long 22
15 sg7: .long 23
16 sg8: .long 24
17 sl1: .long 65
18 sl2: .long 66
19 sl3: .long 67
20 sl4: .long 68
21 sl5: .long 69
22 sl6: .long 70
23 sl7: .long 71
24 sl8: .long 72
25 sh1: .long 257
26 sh2: .long 258
27 sh3: .long 259
28 sh4: .long 260
29 sh5: .long 261
30 sh6: .long 262
31 sh7: .long 263
32 sh8: .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
38 fn2:
39 pushq %rbp
40 movq %rsp, %rbp
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
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
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
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
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
73 /* LD */
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
82 /* LD against hidden variables */
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
91 /* IE against global var */
92 movq %fs:0, %r9
93 nop;nop
94 addq sG2@gottpoff(%rip), %r9
95 nop;nop;nop;nop
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
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
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
115 /* Direct access through %fs */
117 /* IE against global var */
118 movq sG5@gottpoff(%rip), %rcx
119 nop;nop
120 movq %fs:(%rcx), %rdx
121 nop;nop;nop;nop
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
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
135 leave