pr20308_gd.S 1.4 KB

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