[ARM64][Linux] Re-enable Gigacage
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Oct 2017 08:16:44 +0000 (08:16 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Oct 2017 08:16:44 +0000 (08:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178130

Reviewed by Michael Catanzaro.

Source/bmalloc:

* bmalloc/Gigacage.h: Re-enable Gigacage on ARM64 Linux.

Source/JavaScriptCore:

Guard the current globaladdr opcode implementation for ARM64 with
OS(DARWIN) as it's only usable for Mach-O.

For OS(LINUX), ELF-supported :got: and :got_lo12: relocation specifiers
have to be used. The .loh directive can't be used as it's not supported
in GCC or the ld linker.

On every other OS target, a compilation error is thrown.

* offlineasm/arm64.rb:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224171 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/offlineasm/arm64.rb
Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc/Gigacage.h

index 700d125..119a73b 100644 (file)
@@ -1,3 +1,21 @@
+2017-10-30  Zan Dobersek  <zdobersek@igalia.com>
+
+        [ARM64][Linux] Re-enable Gigacage
+        https://bugs.webkit.org/show_bug.cgi?id=178130
+
+        Reviewed by Michael Catanzaro.
+
+        Guard the current globaladdr opcode implementation for ARM64 with
+        OS(DARWIN) as it's only usable for Mach-O.
+
+        For OS(LINUX), ELF-supported :got: and :got_lo12: relocation specifiers
+        have to be used. The .loh directive can't be used as it's not supported
+        in GCC or the ld linker.
+
+        On every other OS target, a compilation error is thrown.
+
+        * offlineasm/arm64.rb:
+
 2017-10-27  Devin Rousso  <webkit@devinrousso.com>
 
         Web Inspector: Canvas Tab: no way to see backtrace of where a canvas context was created
index e806f99..706a452 100644 (file)
@@ -932,12 +932,30 @@ class Instruction
             $asm.putStr("#endif")
         when "globaladdr"
             uid = $asm.newUID
+
+            # On Darwin, use Macho-O GOT relocation specifiers, along with
+            # the labels required for the .loh directive.
+            $asm.putStr("#if OS(DARWIN)")
             $asm.puts "L_offlineasm_loh_adrp_#{uid}:"
             $asm.puts "adrp #{operands[1].arm64Operand(:ptr)}, #{operands[0].asmLabel}@GOTPAGE"
             $asm.puts "L_offlineasm_loh_ldr_#{uid}:"
             $asm.puts "ldr #{operands[1].arm64Operand(:ptr)}, [#{operands[1].arm64Operand(:ptr)}, #{operands[0].asmLabel}@GOTPAGEOFF]"
+
+            # On Linux, use ELF GOT relocation specifiers.
+            $asm.putStr("#elif OS(LINUX)")
+            $asm.puts "adrp #{operands[1].arm64Operand(:ptr)}, :got:#{operands[0].asmLabel}"
+            $asm.puts "ldr #{operands[1].arm64Operand(:ptr)}, [#{operands[1].arm64Operand(:ptr)}, :got_lo12:#{operands[0].asmLabel}]"
+
+            # Throw a compiler error everywhere else.
+            $asm.putStr("#else")
+            $asm.putStr("#error Missing globaladdr implementation")
+            $asm.putStr("#endif")
+
             $asm.deferAction {
+                # On Darwin, also include the .loh directive using the generated labels.
+                $asm.putStr("#if OS(DARWIN)")
                 $asm.puts ".loh AdrpLdrGot L_offlineasm_loh_adrp_#{uid}, L_offlineasm_loh_ldr_#{uid}"
+                $asm.putStr("#endif")
             }
         else
             lowerDefault
index 0ddf629..7a8cb65 100644 (file)
@@ -1,3 +1,12 @@
+2017-10-30  Zan Dobersek  <zdobersek@igalia.com>
+
+        [ARM64][Linux] Re-enable Gigacage
+        https://bugs.webkit.org/show_bug.cgi?id=178130
+
+        Reviewed by Michael Catanzaro.
+
+        * bmalloc/Gigacage.h: Re-enable Gigacage on ARM64 Linux.
+
 2017-10-25  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r222945.
index 181a7e6..b643d4f 100644 (file)
@@ -52,7 +52,7 @@
 #define JSVALUE_GIGACAGE_MASK GIGACAGE_SIZE_TO_MASK(JSVALUE_GIGACAGE_SIZE)
 #define STRING_GIGACAGE_MASK GIGACAGE_SIZE_TO_MASK(STRING_GIGACAGE_SIZE)
 
-#if (BOS(DARWIN) && (BCPU(ARM64) || BCPU(X86_64))) || (BOS(LINUX) && BCPU(X86_64))
+#if (BOS(DARWIN) || BOS(LINUX)) && (BCPU(ARM64) || BCPU(X86_64))
 #define GIGACAGE_ENABLED 1
 #else
 #define GIGACAGE_ENABLED 0