bfd/
[binutils.git] / ld / testsuite / ld-x86-64 / tlsbindesc.s
blobcbebf02171d7dec1e0ad61df90e21971727184df
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 leaq sG1@tlsdesc(%rip), %rax
44 call *sG1@tlscall(%rax)
45 nop;nop;nop;nop
47 /* GD -> IE because variable is not defined in executable where
48 the variable is referenced through IE too */
49 leaq sG2@tlsdesc(%rip), %rax
50 call *sG2@tlscall(%rax)
51 nop;nop;nop;nop
53 /* GD -> LE with global variable defined in executable */
54 leaq sg1@tlsdesc(%rip), %rax
55 call *sg1@tlscall(%rax)
56 nop;nop;nop;nop
58 /* GD -> LE with local variable defined in executable */
59 leaq sl1@tlsdesc(%rip), %rax
60 call *sl1@tlscall(%rax)
61 nop;nop;nop;nop
63 /* GD -> LE with hidden variable defined in executable */
64 leaq sh1@tlsdesc(%rip), %rax
65 call *sh1@tlscall(%rax)
66 nop;nop;nop;nop
68 /* LD -> LE */
69 leaq _TLS_MODULE_BASE_@tlsdesc(%rip), %rax
70 call *_TLS_MODULE_BASE_@tlscall(%rax)
71 nop;nop
72 leaq 1+sl1@dtpoff(%rax), %rdx
73 nop;nop
74 leaq sl2@dtpoff+2(%rax), %r9
75 nop;nop;nop;nop
77 /* LD -> LE against hidden variables */
78 leaq sh1@dtpoff(%rax), %rdx
79 nop;nop
80 leaq 3+sh2@dtpoff(%rax), %rcx
81 nop;nop;nop;nop
83 /* IE against global var */
84 movq %fs:0, %r9
85 nop;nop
86 addq sG2@gottpoff(%rip), %r9
87 nop;nop;nop;nop
89 /* IE -> LE against global var defined in exec */
90 movq %fs:0, %r10
91 nop;nop
92 addq sg1@gottpoff(%rip), %r10
93 nop;nop;nop;nop
95 /* IE -> LE against local var */
96 movq %fs:0, %rax
97 nop;nop
98 addq sl1@gottpoff(%rip), %rax
99 nop;nop;nop;nop
101 /* IE -> LE against hidden var */
102 movq %fs:0, %rcx
103 nop;nop
104 addq sh1@gottpoff(%rip), %rcx
105 nop;nop;nop;nop
107 /* Direct access through %fs */
109 /* IE against global var */
110 movq sG5@gottpoff(%rip), %rcx
111 nop;nop
112 movq %fs:(%rcx), %rdx
113 nop;nop;nop;nop
115 /* IE->LE against local var */
116 movq sl5@gottpoff(%rip), %r11
117 nop;nop
118 movq %fs:(%r11), %r12
119 nop;nop;nop;nop
121 /* IE->LE against hidden var */
122 movq sh5@gottpoff(%rip), %rdx
123 nop;nop
124 movq %fs:(%rdx), %rdx
125 nop;nop;nop;nop
127 leave