tlsie.s 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. .section ".tbss","awT",@nobits
  2. .p2align 3
  3. pad: .space 8
  4. .global a
  5. a: .space 8
  6. .global b
  7. b: .space 8
  8. .global c
  9. c: .space 8
  10. .global d
  11. d: .space 8
  12. .text
  13. .globl _start
  14. _start:
  15. #Small model OpenPower
  16. ld 9,.La@toc(2)
  17. add 10,9,.La@tls
  18. .section .toc,"aw",@progbits
  19. .La:
  20. .quad a@tprel
  21. .text
  22. #Medium model ELF
  23. addis 9,2,b@got@tprel@ha
  24. ld 10,b@got@tprel@l(9)
  25. add 3,10,b@tls
  26. #PCrel
  27. pld 4,c@got@tprel@pcrel
  28. add 4,4,c@tls@pcrel
  29. #All of the above using the same symbol
  30. addis 9,2,.Ld@toc@ha
  31. ld 9,.Ld@toc@l(9)
  32. add 10,9,.Ld@tls
  33. .section .toc,"aw",@progbits
  34. .Ld:
  35. .quad d@tprel
  36. .text
  37. addis 9,2,d@got@tprel@ha
  38. ld 31,d@got@tprel@l(9)
  39. add 3,31,d@tls
  40. pld 30,d@got@tprel@pcrel
  41. add 3,30,d@tls@pcrel
  42. #Note that after optimisation r31 and r30 above have a different value to
  43. #what they would have without optimisation. r31 may not even be written.
  44. #Here are all the other insns that gas/ld accept as the final insn of an
  45. #IE sequence. The r30 value below will be different after optimisation
  46. #for the non-update forms.
  47. lwzx 4,30,d@tls@pcrel
  48. lwzux 4,30,d@tls@pcrel
  49. lbzx 5,30,d@tls@pcrel
  50. lbzux 5,30,d@tls@pcrel
  51. stwx 6,30,d@tls@pcrel
  52. stwux 6,30,d@tls@pcrel
  53. stbx 7,30,d@tls@pcrel
  54. stbux 7,30,d@tls@pcrel
  55. lhzx 8,30,d@tls@pcrel
  56. lhzux 8,30,d@tls@pcrel
  57. lhax 9,30,d@tls@pcrel
  58. lhaux 9,30,d@tls@pcrel
  59. sthx 10,30,d@tls@pcrel
  60. sthux 10,30,d@tls@pcrel
  61. lfsx 11,30,d@tls@pcrel
  62. lfsux 11,30,d@tls@pcrel
  63. lfdx 12,30,d@tls@pcrel
  64. lfdux 12,30,d@tls@pcrel
  65. stfsx 13,30,d@tls@pcrel
  66. stfsux 13,30,d@tls@pcrel
  67. stfdx 14,30,d@tls@pcrel
  68. stfdux 14,30,d@tls@pcrel
  69. ldx 15,30,d@tls@pcrel
  70. ldux 15,30,d@tls@pcrel
  71. stdx 16,30,d@tls@pcrel
  72. stdux 16,30,d@tls@pcrel
  73. lwax 17,30,d@tls@pcrel