clang-ias.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. commit 972b828530565302ac62a8a8eddde4cf1d13b101
  2. Author: Daniel Kolesa <daniel@octaforge.org>
  3. Date: Tue Aug 23 14:10:54 2022 +0200
  4. fix xptcall assembly stuff to work with clang ias
  5. diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S
  6. index d2cab6c..aa2fd2c 100644
  7. --- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S
  8. +++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S
  9. @@ -2,21 +2,6 @@
  10. # License, v. 2.0. If a copy of the MPL was not distributed with this
  11. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  12. -.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4
  13. -.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
  14. -.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
  15. -.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
  16. -.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
  17. -.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
  18. -.set r30,30; .set r31,31
  19. -.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4
  20. -.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9
  21. -.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14
  22. -.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19
  23. -.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24
  24. -.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
  25. -.set f30,30; .set f31,31
  26. -
  27. # The ABI defines a fixed stack frame area of 4 doublewords (ELFv2)
  28. # or 6 doublewords (ELFv1); the last of these doublewords is used
  29. # as TOC pointer save area. The fixed area is followed by a parameter
  30. @@ -62,15 +47,15 @@ NS_InvokeByIndex:
  31. .NS_InvokeByIndex:
  32. #endif
  33. mflr 0
  34. - std 0,16(r1)
  35. + std 0,16(%r1)
  36. - std r29,-24(r1)
  37. - std r30,-16(r1)
  38. - std r31,-8(r1)
  39. + std %r29,-24(%r1)
  40. + std %r30,-16(%r1)
  41. + std %r31,-8(%r1)
  42. - mr r29,r3 # Save 'that' in r29
  43. - mr r30,r4 # Save 'methodIndex' in r30
  44. - mr r31,r1 # Save old frame
  45. + mr %r29,%r3 # Save 'that' in r29
  46. + mr %r30,%r4 # Save 'methodIndex' in r30
  47. + mr %r31,%r1 # Save old frame
  48. # Allocate stack frame with space for params. Since at least the
  49. # first 7 parameters (not including 'that') will be in registers,
  50. @@ -79,13 +64,13 @@ NS_InvokeByIndex:
  51. #
  52. # | (fixed area + | | 7 GP | 13 FP | 3 NV |
  53. # | param. save) |(params)........| regs | regs | regs |
  54. - # (r1)......(+STACK_PARAMS)... (-23*8).(-16*8).(-3*8)..(r31)
  55. + # (r1)......(+STACK_PARAMS)... (-23*8).(-16*8).(-3*8)..(%r31)
  56. # +stack frame, -unused stack params, +regs storage, +1 for alignment
  57. - addi r7,r5,((STACK_PARAMS/8)-7+7+13+3+1)
  58. - rldicr r7,r7,3,59 # multiply by 8 and mask with ~15
  59. - neg r7,r7
  60. - stdux r1,r1,r7
  61. + addi %r7,%r5,((STACK_PARAMS/8)-7+7+13+3+1)
  62. + rldicr %r7,%r7,3,59 # multiply by 8 and mask with ~15
  63. + neg %r7,%r7
  64. + stdux %r1,%r1,%r7
  65. # Call invoke_copy_to_stack(uint64_t* gpregs, double* fpregs,
  66. @@ -95,66 +80,66 @@ NS_InvokeByIndex:
  67. # r5, r6 are passed through intact (paramCount, params)
  68. # r7 (d) has to be r1+STACK_PARAMS
  69. # -- where parameters are passed on the stack.
  70. - # r3, r4 are above that, easier to address from r31 than from r1
  71. + # r3, r4 are above that, easier to address from %r31 than from r1
  72. - subi r3,r31,(23*8) # r3 --> GPRS
  73. - subi r4,r31,(16*8) # r4 --> FPRS
  74. - addi r7,r1,STACK_PARAMS # r7 --> params
  75. + subi %r3,%r31,(23*8) # r3 --> GPRS
  76. + subi %r4,%r31,(16*8) # r4 --> FPRS
  77. + addi %r7,%r1,STACK_PARAMS # r7 --> params
  78. bl invoke_copy_to_stack
  79. nop
  80. # Set up to invoke function
  81. - ld r9,0(r29) # vtable (r29 is 'that')
  82. - mr r3,r29 # self is first arg, obviously
  83. + ld %r9,0(%r29) # vtable (r29 is 'that')
  84. + mr %r3,%r29 # self is first arg, obviously
  85. - sldi r30,r30,3 # Find function descriptor
  86. - add r9,r9,r30
  87. - ld r12,0(r9)
  88. + sldi %r30,%r30,3 # Find function descriptor
  89. + add %r9,%r9,%r30
  90. + ld %r12,0(%r9)
  91. - std r2,STACK_TOC(r1) # Save r2 (TOC pointer)
  92. + std %r2,STACK_TOC(%r1) # Save r2 (TOC pointer)
  93. #if _CALL_ELF == 2
  94. - mtctr r12
  95. + mtctr %r12
  96. #else
  97. - ld r0,0(r12) # Actual address from fd.
  98. + ld %r0,0(%r12) # Actual address from fd.
  99. mtctr 0
  100. - ld r11,16(r12) # Environment pointer from fd.
  101. - ld r2,8(r12) # TOC pointer from fd.
  102. + ld %r11,16(%r12) # Environment pointer from fd.
  103. + ld %r2,8(%r12) # TOC pointer from fd.
  104. #endif
  105. # Load FP and GP registers as required
  106. - ld r4, -(23*8)(r31)
  107. - ld r5, -(22*8)(r31)
  108. - ld r6, -(21*8)(r31)
  109. - ld r7, -(20*8)(r31)
  110. - ld r8, -(19*8)(r31)
  111. - ld r9, -(18*8)(r31)
  112. - ld r10, -(17*8)(r31)
  113. -
  114. - lfd f1, -(16*8)(r31)
  115. - lfd f2, -(15*8)(r31)
  116. - lfd f3, -(14*8)(r31)
  117. - lfd f4, -(13*8)(r31)
  118. - lfd f5, -(12*8)(r31)
  119. - lfd f6, -(11*8)(r31)
  120. - lfd f7, -(10*8)(r31)
  121. - lfd f8, -(9*8)(r31)
  122. - lfd f9, -(8*8)(r31)
  123. - lfd f10, -(7*8)(r31)
  124. - lfd f11, -(6*8)(r31)
  125. - lfd f12, -(5*8)(r31)
  126. - lfd f13, -(4*8)(r31)
  127. + ld %r4, -(23*8)(%r31)
  128. + ld %r5, -(22*8)(%r31)
  129. + ld %r6, -(21*8)(%r31)
  130. + ld %r7, -(20*8)(%r31)
  131. + ld %r8, -(19*8)(%r31)
  132. + ld %r9, -(18*8)(%r31)
  133. + ld %r10, -(17*8)(%r31)
  134. +
  135. + lfd %f1, -(16*8)(%r31)
  136. + lfd %f2, -(15*8)(%r31)
  137. + lfd %f3, -(14*8)(%r31)
  138. + lfd %f4, -(13*8)(%r31)
  139. + lfd %f5, -(12*8)(%r31)
  140. + lfd %f6, -(11*8)(%r31)
  141. + lfd %f7, -(10*8)(%r31)
  142. + lfd %f8, -(9*8)(%r31)
  143. + lfd %f9, -(8*8)(%r31)
  144. + lfd %f10, -(7*8)(%r31)
  145. + lfd %f11, -(6*8)(%r31)
  146. + lfd %f12, -(5*8)(%r31)
  147. + lfd %f13, -(4*8)(%r31)
  148. bctrl # Do it
  149. - ld r2,STACK_TOC(r1) # Load our own TOC pointer
  150. - ld r1,0(r1) # Revert stack frame
  151. - ld 0,16(r1) # Reload lr
  152. + ld %r2,STACK_TOC(%r1) # Load our own TOC pointer
  153. + ld %r1,0(%r1) # Revert stack frame
  154. + ld 0,16(%r1) # Reload lr
  155. mtlr 0
  156. - ld 29,-24(r1) # Restore NVGPRS
  157. - ld 30,-16(r1)
  158. - ld 31,-8(r1)
  159. + ld 29,-24(%r1) # Restore NVGPRS
  160. + ld 30,-16(%r1)
  161. + ld 31,-8(%r1)
  162. blr
  163. #if _CALL_ELF == 2
  164. diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S b/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S
  165. index 0b884e1..4dddee1 100644
  166. --- a/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S
  167. +++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S
  168. @@ -2,21 +2,6 @@
  169. # License, v. 2.0. If a copy of the MPL was not distributed with this
  170. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  171. -.set r0,0; .set r1,1; .set RTOC,2; .set r3,3; .set r4,4
  172. -.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
  173. -.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
  174. -.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
  175. -.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
  176. -.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
  177. -.set r30,30; .set r31,31
  178. -.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4
  179. -.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9
  180. -.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14
  181. -.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19
  182. -.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24
  183. -.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
  184. -.set f30,30; .set f31,31
  185. -
  186. #if _CALL_ELF == 2
  187. #define STACK_PARAMS 96
  188. #else
  189. @@ -56,50 +41,50 @@ SharedStub:
  190. .SharedStub:
  191. #endif
  192. - mflr r0
  193. + mflr %r0
  194. - std r4, -56(r1) # Save all GPRS
  195. - std r5, -48(r1)
  196. - std r6, -40(r1)
  197. - std r7, -32(r1)
  198. - std r8, -24(r1)
  199. - std r9, -16(r1)
  200. - std r10, -8(r1)
  201. + std %r4, -56(%r1) # Save all GPRS
  202. + std %r5, -48(%r1)
  203. + std %r6, -40(%r1)
  204. + std %r7, -32(%r1)
  205. + std %r8, -24(%r1)
  206. + std %r9, -16(%r1)
  207. + std %r10, -8(%r1)
  208. - stfd f13, -64(r1) # ... and FPRS
  209. - stfd f12, -72(r1)
  210. - stfd f11, -80(r1)
  211. - stfd f10, -88(r1)
  212. - stfd f9, -96(r1)
  213. - stfd f8, -104(r1)
  214. - stfd f7, -112(r1)
  215. - stfd f6, -120(r1)
  216. - stfd f5, -128(r1)
  217. - stfd f4, -136(r1)
  218. - stfd f3, -144(r1)
  219. - stfd f2, -152(r1)
  220. - stfd f1, -160(r1)
  221. + stfd %f13, -64(%r1) # ... and FPRS
  222. + stfd %f12, -72(%r1)
  223. + stfd %f11, -80(%r1)
  224. + stfd %f10, -88(%r1)
  225. + stfd %f9, -96(%r1)
  226. + stfd %f8, -104(%r1)
  227. + stfd %f7, -112(%r1)
  228. + stfd %f6, -120(%r1)
  229. + stfd %f5, -128(%r1)
  230. + stfd %f4, -136(%r1)
  231. + stfd %f3, -144(%r1)
  232. + stfd %f2, -152(%r1)
  233. + stfd %f1, -160(%r1)
  234. - subi r6,r1,56 # r6 --> gprData
  235. - subi r7,r1,160 # r7 --> fprData
  236. - addi r5,r1,STACK_PARAMS # r5 --> extra stack args
  237. + subi %r6,%r1,56 # r6 --> gprData
  238. + subi %r7,%r1,160 # r7 --> fprData
  239. + addi %r5,%r1,STACK_PARAMS # r5 --> extra stack args
  240. - std r0, 16(r1)
  241. + std %r0, 16(%r1)
  242. - stdu r1,-288(r1)
  243. + stdu %r1,-288(%r1)
  244. # r3 has the 'self' pointer
  245. # already
  246. - mr r4,r11 # r4 is methodIndex selector,
  247. + mr %r4,%r11 # r4 is methodIndex selector,
  248. # passed via r11 in the
  249. # nsNSStubBase::StubXX() call
  250. bl PrepareAndDispatch
  251. nop
  252. - ld 1,0(r1) # restore stack
  253. - ld r0,16(r1) # restore LR
  254. - mtlr r0
  255. + ld 1,0(%r1) # restore stack
  256. + ld %r0,16(%r1) # restore LR
  257. + mtlr %r0
  258. blr
  259. #if _CALL_ELF == 2