| 1 | .text |
| 2 | .p2align 4,,15 |
| 3 | .globl get_gd |
| 4 | .type get_gd, @function |
| 5 | get_gd: |
| 6 | subq $8, %rsp |
| 7 | #ifdef __LP64__ |
| 8 | .byte 0x66 |
| 9 | #endif |
| 10 | leaq gd@tlsgd(%rip), %rdi |
| 11 | .byte 0x66 |
| 12 | rex64 |
| 13 | call *__tls_get_addr@GOTPCREL(%rip) |
| 14 | addq $8, %rsp |
| 15 | ret |
| 16 | .size get_gd, .-get_gd |
| 17 | .text |
| 18 | .p2align 4,,15 |
| 19 | .globl set_gd |
| 20 | .type set_gd, @function |
| 21 | set_gd: |
| 22 | pushq %rbx |
| 23 | movl %edi, %ebx |
| 24 | #ifdef __LP64__ |
| 25 | .byte 0x66 |
| 26 | #endif |
| 27 | leaq gd@tlsgd(%rip), %rdi |
| 28 | .value 0x6666 |
| 29 | rex64 |
| 30 | call __tls_get_addr@PLT |
| 31 | movl %ebx, (%rax) |
| 32 | popq %rbx |
| 33 | ret |
| 34 | .size set_gd, .-set_gd |
| 35 | .text |
| 36 | .p2align 4,,15 |
| 37 | .globl test_gd |
| 38 | .type test_gd, @function |
| 39 | test_gd: |
| 40 | pushq %rbx |
| 41 | movl %edi, %ebx |
| 42 | #ifdef __LP64__ |
| 43 | .byte 0x66 |
| 44 | #endif |
| 45 | leaq gd@tlsgd(%rip), %rdi |
| 46 | .byte 0x66 |
| 47 | rex64 |
| 48 | call *__tls_get_addr@GOTPCREL(%rip) |
| 49 | cmpl %ebx, (%rax) |
| 50 | popq %rbx |
| 51 | sete %al |
| 52 | movzbl %al, %eax |
| 53 | ret |
| 54 | .size test_gd, .-test_gd |
| 55 | .section .note.GNU-stack,"",@progbits |