pr20308_ld.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. .text
  2. .p2align 4,,15
  3. .globl get_ld
  4. .type get_ld, @function
  5. get_ld:
  6. pushl %ebx
  7. call __x86.get_pc_thunk.bx
  8. addl $_GLOBAL_OFFSET_TABLE_, %ebx
  9. subl $8, %esp
  10. leal ld@tlsldm(%ebx), %eax
  11. call ___tls_get_addr@PLT
  12. leal ld@dtpoff(%eax), %eax
  13. addl $8, %esp
  14. popl %ebx
  15. ret
  16. .size get_ld, .-get_ld
  17. .p2align 4,,15
  18. .globl set_ld
  19. .type set_ld, @function
  20. set_ld:
  21. pushl %ebx
  22. call __x86.get_pc_thunk.bx
  23. addl $_GLOBAL_OFFSET_TABLE_, %ebx
  24. subl $8, %esp
  25. leal ld@tlsldm(%ebx), %eax
  26. call ___tls_get_addr@PLT
  27. movl 16(%esp), %edx
  28. leal ld@dtpoff(%eax), %eax
  29. movl %edx, (%eax)
  30. addl $8, %esp
  31. popl %ebx
  32. ret
  33. .size set_ld, .-set_ld
  34. .p2align 4,,15
  35. .globl test_ld
  36. .type test_ld, @function
  37. test_ld:
  38. call __x86.get_pc_thunk.cx
  39. addl $_GLOBAL_OFFSET_TABLE_, %ecx
  40. subl $12, %esp
  41. leal ld@tlsldm(%ecx), %eax
  42. call *___tls_get_addr@GOT(%ecx)
  43. movl 16(%esp), %ecx
  44. leal ld@dtpoff(%eax), %eax
  45. cmpl %ecx, (%eax)
  46. sete %al
  47. addl $12, %esp
  48. movzbl %al, %eax
  49. ret
  50. .size test_ld, .-test_ld
  51. .section .tbss,"awT",@nobits
  52. .align 4
  53. .type ld, @object
  54. .size ld, 4
  55. ld:
  56. .zero 4
  57. .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
  58. .globl __x86.get_pc_thunk.bx
  59. .hidden __x86.get_pc_thunk.bx
  60. .type __x86.get_pc_thunk.bx, @function
  61. __x86.get_pc_thunk.bx:
  62. movl (%esp), %ebx
  63. ret
  64. .section .text.__x86.get_pc_thunk.cx,"axG",@progbits,__x86.get_pc_thunk.cx,comdat
  65. .globl __x86.get_pc_thunk.cx
  66. .hidden __x86.get_pc_thunk.cx
  67. .type __x86.get_pc_thunk.cx, @function
  68. __x86.get_pc_thunk.cx:
  69. movl (%esp), %ecx
  70. ret
  71. .section .note.GNU-stack,"",@progbits