Commit | Line | Data |
---|---|---|
13ae64f3 JJ |
1 | .section ".tdata", "awT", @progbits |
2 | .globl baz | |
3 | .hidden baz | |
4 | .globl var | |
5 | .hidden var2 | |
6 | bar: .long 27 | |
7 | baz: .long 29 | |
8 | var: .long 31 | |
9 | var2: .long 33 | |
10 | .text | |
11 | .globl fn | |
12 | .type fn,@function | |
13 | fn: | |
37e55690 | 14 | /* Main binary, no PIC. */ |
13ae64f3 JJ |
15 | 1: movl 1b, %edx |
16 | addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx | |
17 | ||
37e55690 | 18 | /* foo can be anywhere in startup TLS. */ |
13ae64f3 JJ |
19 | movl %gs:0, %eax |
20 | subl foo@GOTTPOFF(%edx), %eax | |
37e55690 | 21 | /* %eax now contains &foo. */ |
13ae64f3 | 22 | |
37e55690 | 23 | /* bar only in the main program. */ |
13ae64f3 JJ |
24 | movl %gs:0, %eax |
25 | subl $bar@TPOFF, %eax | |
37e55690 | 26 | /* %eax now contains &bar. */ |
13ae64f3 | 27 | |
37e55690 | 28 | /* baz only in the main program. */ |
13ae64f3 | 29 | movl %gs:0, %ecx |
37e55690 | 30 | /* Arbitrary instructions in between. */ |
13ae64f3 JJ |
31 | nop |
32 | subl $baz@TPOFF, %ecx | |
37e55690 | 33 | /* %ecx now contains &baz. */ |
13ae64f3 | 34 | |
37e55690 | 35 | /* var and var2 only in the main program. */ |
13ae64f3 | 36 | movl %gs:0, %ecx |
37e55690 | 37 | /* Arbitrary instructions in between. */ |
13ae64f3 JJ |
38 | nop |
39 | nop | |
40 | leal var@NTPOFF(%ecx), %eax | |
37e55690 | 41 | /* Arbitrary instructions in between. */ |
13ae64f3 JJ |
42 | nop |
43 | leal var2@NTPOFF(%ecx), %edx | |
44 | ||
37e55690 JJ |
45 | /* foo can be anywhere in startup TLS. */ |
46 | movl foo@INDNTPOFF, %eax | |
47 | movl %gs:(%eax), %eax | |
48 | /* %eax now contains foo. */ | |
49 | ||
50 | movl %gs:0, %eax | |
51 | addl foo@INDNTPOFF, %eax | |
52 | /* %eax now contains &foo. */ | |
53 | ||
13ae64f3 | 54 | ret |