| 1 | .section ".tdata", "awT", @progbits |
| 2 | .globl foo, baz |
| 3 | .hidden baz |
| 4 | foo: .long 25 |
| 5 | bar: .long 27 |
| 6 | baz: .long 29 |
| 7 | .text |
| 8 | .globl fn |
| 9 | .type fn,@function |
| 10 | fn: |
| 11 | pushl %ebp |
| 12 | movl %esp, %ebp |
| 13 | pushl %ebx |
| 14 | pushl %eax |
| 15 | call 1f |
| 16 | 1: popl %ebx |
| 17 | addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx |
| 18 | |
| 19 | /* Dynamic TLS model, foo not known to be in the current object */ |
| 20 | leal foo@TLSGD(,%ebx,1), %eax |
| 21 | call ___tls_get_addr@PLT |
| 22 | /* %eax now contains &foo */ |
| 23 | |
| 24 | /* Dynamic TLS model, bar and baz known to be in the current object */ |
| 25 | leal bar@TLSLDM(%ebx), %eax |
| 26 | call ___tls_get_addr@PLT |
| 27 | |
| 28 | /* Just show that there can be arbitrary instructions here */ |
| 29 | addl $0, %edi |
| 30 | |
| 31 | leal bar@DTPOFF(%eax), %edx |
| 32 | /* %edx now contains &bar */ |
| 33 | |
| 34 | /* Again, arbitrary instructions */ |
| 35 | addl $0, %esi |
| 36 | |
| 37 | leal baz@DTPOFF(%eax), %ecx |
| 38 | /* %ecx now contains &baz */ |
| 39 | |
| 40 | movl -4(%ebp), %ebx |
| 41 | leave |
| 42 | ret |