Commit | Line | Data |
---|---|---|
13ae64f3 JJ |
1 | .section ".tdata", "awT", @progbits |
2 | .globl foo | |
3 | foo: .long 25 | |
4 | .text | |
5 | .globl fn | |
6 | .type fn,@function | |
7 | fn: | |
8 | pushl %ebp | |
9 | movl %esp, %ebp | |
10 | pushl %ebx | |
11 | pushl %eax | |
12 | call 1f | |
13 | 1: popl %ebx | |
14 | addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx | |
15 | ||
16 | /* foo can be anywhere in the startup TLS */ | |
17 | movl %gs:0, %eax | |
18 | ||
37e55690 | 19 | /* Arbitrary instructions in between. */ |
34d9ee9e | 20 | addl $0, %esi |
13ae64f3 JJ |
21 | |
22 | subl foo@GOTTPOFF(%ebx), %eax | |
23 | /* %eax now contains &foo */ | |
24 | ||
37e55690 JJ |
25 | /* Now the GNU sequence. */ |
26 | movl foo@GOTNTPOFF(%ebx), %eax | |
27 | ||
28 | /* Arbitrary instructions in between. */ | |
34d9ee9e | 29 | addl $0, %esi |
37e55690 JJ |
30 | |
31 | movl %gs:(%eax), %eax | |
32 | /* %eax now contains foo */ | |
33 | ||
34 | movl %gs:0, %ecx | |
35 | addl foo@GOTNTPOFF(%ebx), %ecx | |
36 | ||
13ae64f3 JJ |
37 | movl -4(%ebp), %ebx |
38 | leave | |
39 | ret |