[commit: ghc] master: Fix build for AArch64/Arm64 (e02a4c2)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 21:12:51 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/e02a4c2733df16bfb822a117af00598293cf886e/ghc

>---------------------------------------------------------------

commit e02a4c2733df16bfb822a117af00598293cf886e
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Fri Dec 18 22:07:43 2015 +1100

    Fix build for AArch64/Arm64
    
    Test Plan: Build an AArch64 cross compiler.
    
    Reviewers: hvr, bgamari, austin
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1654


>---------------------------------------------------------------

e02a4c2733df16bfb822a117af00598293cf886e
 libraries/ghci/GHCi/InfoTable.hsc | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/libraries/ghci/GHCi/InfoTable.hsc b/libraries/ghci/GHCi/InfoTable.hsc
index c32f3a4..c3e20f5 100644
--- a/libraries/ghci/GHCi/InfoTable.hsc
+++ b/libraries/ghci/GHCi/InfoTable.hsc
@@ -57,6 +57,7 @@ funPtrToInt :: FunPtr a -> Int
 funPtrToInt (FunPtr a) = I## (addr2Int## a)
 
 data Arch = ArchSPARC | ArchPPC | ArchX86 | ArchX86_64 | ArchAlpha | ArchARM
+          | ArchARM64
  deriving Show
 
 platform :: Arch
@@ -73,6 +74,10 @@ platform =
        ArchAlpha
 #elif defined(arm_HOST_ARCH)
        ArchARM
+#elif defined(aarch64_HOST_ARCH)
+       ArchARM64
+#else
+#error Unknown architecture
 #endif
 
 mkJumpToAddr :: EntryFunPtr -> ItblCodes
@@ -176,6 +181,22 @@ mkJumpToAddr a = case platform of
                 , 0x11, 0xff, 0x2f, 0xe1
                 , byte0 w32, byte1 w32, byte2 w32, byte3 w32]
 
+    ArchARM64 { } ->
+        -- Generates:
+        --
+        --      ldr     x1, label
+        --      br      x1
+        -- label:
+        --      .quad <addr>
+        --
+        -- which looks like:
+        --     0:       58000041        ldr     x1, <label>
+        --     4:       d61f0020        br      x1
+       let w64 = fromIntegral (funPtrToInt a) :: Word64
+       in Right [ 0x58000041
+                , 0xd61f0020
+                , fromIntegral w64
+                , fromIntegral (w64 `shiftR` 32) ]
 
 byte0 :: (Integral w) => w -> Word8
 byte0 w = fromIntegral w



More information about the ghc-commits mailing list