RESOLVED FIXED 175512
[ARM64] Use x29 and x30 instead of fp and lr to make GCC happy
https://bugs.webkit.org/show_bug.cgi?id=175512
Summary [ARM64] Use x29 and x30 instead of fp and lr to make GCC happy
Mark Lam
Reported 2017-08-12 08:19:15 PDT
This is needed because Linux toolchains are not smart enough to resolve constexpr numeric expressions. See https://bugs.webkit.org/show_bug.cgi?id=175446#c21.
Attachments
proposed patch. (13.55 KB, patch)
2017-08-12 09:38 PDT, Mark Lam
no flags
Patch (9.98 KB, patch)
2017-08-12 15:32 PDT, Csaba Osztrogonác
no flags
Patch for landing (10.44 KB, patch)
2017-08-12 23:04 PDT, Csaba Osztrogonác
no flags
Radar WebKit Bug Importer
Comment 1 2017-08-12 08:19:47 PDT
Mark Lam
Comment 2 2017-08-12 08:23:49 PDT
Also need to add MacroAssemblerARM64.cpp to the JSC CMakeList.txt.
Mark Lam
Comment 3 2017-08-12 09:38:45 PDT
Created attachment 317997 [details] proposed patch.
Mark Lam
Comment 4 2017-08-12 10:59:07 PDT
@Ossy, this patch works for OS(DARWIN) with Clang. Can you please verify that this resolves the issue you reported in https://bugs.webkit.org/show_bug.cgi?id=175446#c21 ?
Csaba Osztrogonác
Comment 5 2017-08-12 13:26:35 PDT
(In reply to Mark Lam from comment #4) > @Ossy, this patch works for OS(DARWIN) with Clang. Can you please verify > that this resolves the issue you reported in > https://bugs.webkit.org/show_bug.cgi?id=175446#c21 ? Thanks for the quick fix, I'll run a build and test soon.
Csaba Osztrogonác
Comment 6 2017-08-12 13:28:50 PDT
Now I got these errors: {standard input}: Assembler messages: {standard input}:34: Error: operand 2 should be an integer register -- `stp x28,fp,[sp,#240]' {standard input}:37: Error: operand 1 should be an integer register -- `str lr,[sp,#552]' {standard input}:38: Error: operand 1 should be an integer or stack pointer register -- `add lr,lr,#2*8' {standard input}:39: Error: operand 1 should be an integer register -- `str lr,[sp,#272]' {standard input}:94: Error: operand 1 should be an integer register -- `mov lr,#0' {standard input}:104: Error: operand 1 should be an integer register -- `mov lr,#1' {standard input}:106: Error: operand 1 should be an integer register -- `ldr fp,[sp,#552]' {standard input}:114: Error: operand 1 should be an integer register -- `str lr,[sp,#16]' {standard input}:115: Error: operand 2 should be an integer register -- `ldp x28,lr,[x27,#232]' {standard input}:116: Error: operand 2 should be an integer register -- `stp x28,lr,[sp,#232]' {standard input}:117: Error: operand 2 should be an integer register -- `ldp x28,lr,[x27,#248]' {standard input}:118: Error: operand 2 should be an integer register -- `stp x28,lr,[sp,#248]' {standard input}:119: Error: operand 2 should be an integer register -- `ldp x28,lr,[x27,#264]' {standard input}:120: Error: operand 2 should be an integer register -- `stp x28,lr,[sp,#264]' {standard input}:121: Error: operand 2 should be an integer register -- `ldp x28,lr,[x27,#280]' {standard input}:122: Error: operand 2 should be an integer register -- `stp x28,lr,[sp,#280]' {standard input}:123: Error: operand 1 should be an integer register -- `ldr lr,[sp,#16]' {standard input}:125: Error: operand 1 should be an integer register -- `cbnz lr,.LctiMasmProbeTrampolineEnd' {standard input}:126: Error: operand 1 should be an integer register -- `ldr lr,[sp,#264]' {standard input}:127: Error: operand 1 should be an integer or stack pointer register -- `sub lr,lr,#(6*8)' {standard input}:129: Error: integer 64-bit register expected at operand 2 -- `str x27,[lr,#(5*8)]' {standard input}:130: Error: operand 1 should be an integer register -- `str lr,[sp,#264]' {standard input}:131: Error: operand 1 should be an integer register -- `str fp,[sp,#272]' {standard input}:133: Error: operand 1 should be an integer register -- `ldr lr,[sp,#264]' {standard input}:134: Error: operand 1 should be an integer or stack pointer register -- `sub lr,lr,#(6*8)' {standard input}:136: Error: integer 64-bit register expected at operand 3 -- `stp x27,x28,[lr,#(0*8)]' {standard input}:138: Error: integer 64-bit register expected at operand 3 -- `stp x27,x28,[lr,#(2*8)]' {standard input}:141: Error: integer 64-bit register expected at operand 3 -- `stp x27,x28,[lr,#(4*8)]' {standard input}:147: Error: operand 1 should be a floating-point register -- `ldp fp,lr,[sp],#2*8'
Csaba Osztrogonác
Comment 7 2017-08-12 14:16:00 PDT
I checked it in details, it seems not the constexprs were the problem, but fp and lr names. Replacing them with x29 and x30 made GCC happy. I'll run tests and will upload a fix if everything is OK.
Csaba Osztrogonác
Comment 8 2017-08-12 15:32:32 PDT
Mark Lam
Comment 9 2017-08-12 17:06:59 PDT
Comment on attachment 318001 [details] Patch r=me. Please put a comment in ctiMasmProbeTrampoline to explain that why we're using x29 and x30, something like: "We use x29 and x30 instead of fp and lr because gcc's inline assembler does not recognize fp and lr." This will minimize the chance that someone will change them back to sp and lr at a later date unknowingly.
Csaba Osztrogonác
Comment 10 2017-08-12 23:04:26 PDT
Created attachment 318005 [details] Patch for landing
WebKit Commit Bot
Comment 11 2017-08-12 23:47:52 PDT
Comment on attachment 318005 [details] Patch for landing Clearing flags on attachment: 318005 Committed r220630: <http://trac.webkit.org/changeset/220630>
WebKit Commit Bot
Comment 12 2017-08-12 23:47:54 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.