tls-ld1.S 826 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. .text
  2. .p2align 4,,15
  3. .globl get_ld
  4. .type get_ld, @function
  5. get_ld:
  6. subq $8, %rsp
  7. leaq ld@tlsld(%rip), %rdi
  8. call __tls_get_addr@PLT
  9. addq $8, %rsp
  10. addq $ld@dtpoff, %rax
  11. ret
  12. .size get_ld, .-get_ld
  13. .text
  14. .p2align 4,,15
  15. .globl set_ld
  16. .type set_ld, @function
  17. set_ld:
  18. pushq %rbx
  19. movl %edi, %ebx
  20. leaq ld@tlsld(%rip), %rdi
  21. call *__tls_get_addr@GOTPCREL(%rip)
  22. movl %ebx, ld@dtpoff(%rax)
  23. popq %rbx
  24. ret
  25. .size set_ld, .-set_ld
  26. .text
  27. .p2align 4,,15
  28. .globl test_ld
  29. .type test_ld, @function
  30. test_ld:
  31. pushq %rbx
  32. movl %edi, %ebx
  33. leaq ld@tlsld(%rip), %rdi
  34. call *__tls_get_addr@GOTPCREL(%rip)
  35. cmpl %ebx, ld@dtpoff(%rax)
  36. popq %rbx
  37. sete %al
  38. movzbl %al, %eax
  39. ret
  40. .size test_ld, .-test_ld
  41. .section .tbss,"awT",@nobits
  42. .align 4
  43. .type ld, @object
  44. .size ld, 4
  45. ld:
  46. .zero 4
  47. .section .note.GNU-stack,"",@progbits