summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2015-12-18 22:07:43 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2015-12-19 08:13:36 +1100
commite02a4c2733df16bfb822a117af00598293cf886e (patch)
tree7ae35700070f41b5ac1ed8f787fd1ffd9b5c97d9 /libraries
parent0e9a331f25c89c6150a43d7d5d27ef5cb6e057ec (diff)
downloadhaskell-e02a4c2733df16bfb822a117af00598293cf886e.tar.gz
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
Diffstat (limited to 'libraries')
-rw-r--r--libraries/ghci/GHCi/InfoTable.hsc21
1 files changed, 21 insertions, 0 deletions
diff --git a/libraries/ghci/GHCi/InfoTable.hsc b/libraries/ghci/GHCi/InfoTable.hsc
index c32f3a44ab..c3e20f5014 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