]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-i386/tlsbinpic.s
bfd/
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-i386 / tlsbinpic.s
CommitLineData
37e55690
JJ
1 /* Force .got aligned to 4K, so it very likely gets at 0x804a100
2 (0x60 bytes .tdata and 0xa0 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 0x8049000. */
34 .text
35 .balign 4096
36 .globl fn2
37 .type fn2,@function
38fn2:
39 pushl %ebp
40 movl %esp, %ebp
41 pushl %ebx
42 pushl %eax
43 call 1f
441: popl %ebx
45 addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
46 nop;nop;nop;nop
47
48 /* GD -> IE because variable is not defined in executable */
49 leal sG1@tlsgd(,%ebx,1), %eax
50 call ___tls_get_addr@plt
51 nop;nop;nop;nop
52
53 /* GD -> IE because variable is not defined in executable where
54 the variable is referenced through @gottpoff too */
55 leal sG2@tlsgd(,%ebx,1), %eax
56 call ___tls_get_addr@plt
57 nop;nop;nop;nop
58
59 /* GD -> IE because variable is not defined in executable where
60 the variable is referenced through @gotntpoff too */
61 leal sG3@tlsgd(,%ebx,1), %eax
62 call ___tls_get_addr@plt
63 nop;nop;nop;nop
64
65 /* GD -> IE because variable is not defined in executable where
66 the variable is referenced through @gottpoff and @gotntpoff too */
67 leal sG4@tlsgd(,%ebx,1), %eax
68 call ___tls_get_addr@plt
69 nop;nop;nop;nop
70
71 /* GD -> LE with global variable defined in executable */
72 leal sg1@tlsgd(,%ebx,1), %eax
73 call ___tls_get_addr@plt
74 nop;nop;nop;nop
75
76 /* GD -> LE with local variable defined in executable */
77 leal sl1@tlsgd(,%ebx,1), %eax
78 call ___tls_get_addr@plt
79 nop;nop;nop;nop
80
81 /* GD -> LE with hidden variable defined in executable */
82 leal sh1@tlsgd(,%ebx,1), %eax
83 call ___tls_get_addr@plt
84 nop;nop;nop;nop
85
a45bb67d 86 /* LD -> LE */
37e55690
JJ
87 leal sl1@tlsldm(%ebx), %eax
88 call ___tls_get_addr@PLT
89 nop;nop
90 leal sl1@dtpoff(%eax), %edx
91 nop;nop
92 leal sl2@dtpoff(%eax), %ecx
93 nop;nop;nop;nop
94
a45bb67d 95 /* LD -> LE against hidden variables */
37e55690
JJ
96 leal sh1@tlsldm(%ebx), %eax
97 call ___tls_get_addr@PLT
98 nop;nop
99 leal sh1@dtpoff(%eax), %edx
100 nop;nop
101 leal sh2@dtpoff(%eax), %ecx
102 nop;nop;nop;nop
103
104 /* @gottpoff IE against global var */
105 movl %gs:0, %ecx
106 nop;nop
107 subl sG2@gottpoff(%ebx), %ecx
108 nop;nop;nop;nop
109
110 /* @gottpoff IE against global var */
111 movl %gs:0, %eax
112 nop;nop
113 subl sG4@gottpoff(%ebx), %eax
114 nop;nop;nop;nop
115
116 /* @gotntpoff IE against global var */
117 movl %gs:0, %ecx
118 nop;nop
119 addl sG3@gotntpoff(%ebx), %ecx
120 nop;nop;nop;nop
121
122 /* @gotntpoff IE against global var */
123 movl %gs:0, %eax
124 nop;nop
125 addl sG4@gotntpoff(%ebx), %eax
126 nop;nop;nop;nop
127
128 /* @gottpoff IE -> LE against global var defined in exec */
129 movl %gs:0, %ecx
130 nop;nop
131 subl sg1@gottpoff(%ebx), %ecx
132 nop;nop;nop;nop
133
134 /* @gotntpoff IE -> LE against local var */
135 movl %gs:0, %ecx
136 nop;nop
137 addl sl1@gotntpoff(%ebx), %eax
138 nop;nop;nop;nop
139
140 /* @gottpoff IE -> LE against hidden var */
141 movl %gs:0, %ecx
142 nop;nop
143 subl sh1@gottpoff(%ebx), %ecx
144 nop;nop;nop;nop
145
146 /* Direct access through %gs */
147
148 /* @gotntpoff IE against global var */
149 movl sG5@gotntpoff(%ebx), %ecx
150 nop;nop
151 movl %gs:(%ecx), %edx
152 nop;nop;nop;nop
153
154 /* @gotntpoff IE->LE against local var */
155 movl sl5@gotntpoff(%ebx), %eax
156 nop;nop
157 movl %gs:(%eax), %edx
158 nop;nop;nop;nop
159
160 /* @gotntpoff IE->LE against hidden var */
161 movl sh5@gotntpoff(%ebx), %edx
162 nop;nop
163 movl %gs:(%edx), %edx
164 nop;nop;nop;nop
165
166 movl -4(%ebp), %ebx
167 leave
168 ret