[commit: ghc] ghc-8.0: fix ghci build on ArchUnknown targets (8775e4c)

git at git.haskell.org git at git.haskell.org
Fri Jan 1 18:33:10 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/8775e4caebb5d181ce00189aa3b84bde6c64dfcd/ghc

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

commit 8775e4caebb5d181ce00189aa3b84bde6c64dfcd
Author: Sergei Trofimovich <siarheit at google.com>
Date:   Thu Dec 31 10:32:40 2015 +0000

    fix ghci build on ArchUnknown targets
    
    Observed failure on ia64 as:
    
        "inplace/bin/hsc2hs" \
             ... \
             --cflag=-Dia64_HOST_ARCH=1 --cflag=-Dlinux_HOST_OS=1 \
             ... \
             libraries/ghci/./GHCi/InfoTable.hsc \
             -o libraries/ghci/dist-install/build/GHCi/InfoTable.hs
    
        InfoTable.hsc:84:2: error: #error Unknown architecture
    
    Signed-off-by: Sergei Trofimovich <siarheit at google.com>
    (cherry picked from commit 75851bf930067ae7c57bee3c6feea456534eafed)


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

8775e4caebb5d181ce00189aa3b84bde6c64dfcd
 libraries/ghci/GHCi/InfoTable.hsc | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/libraries/ghci/GHCi/InfoTable.hsc b/libraries/ghci/GHCi/InfoTable.hsc
index 14e1698..0244990 100644
--- a/libraries/ghci/GHCi/InfoTable.hsc
+++ b/libraries/ghci/GHCi/InfoTable.hsc
@@ -56,8 +56,16 @@ type ItblCodes = Either [Word8] [Word32]
 funPtrToInt :: FunPtr a -> Int
 funPtrToInt (FunPtr a) = I## (addr2Int## a)
 
-data Arch = ArchSPARC | ArchPPC | ArchX86 | ArchX86_64 | ArchAlpha | ArchARM
-          | ArchARM64 | ArchPPC64 | ArchPPC64LE
+data Arch = ArchSPARC
+          | ArchPPC
+          | ArchX86
+          | ArchX86_64
+          | ArchAlpha
+          | ArchARM
+          | ArchARM64
+          | ArchPPC64
+          | ArchPPC64LE
+          | ArchUnknown
  deriving Show
 
 platform :: Arch
@@ -81,7 +89,11 @@ platform =
 #elif defined(powerpc64le_HOST_ARCH)
        ArchPPC64LE
 #else
-#error Unknown architecture
+#    if defined(TABLES_NEXT_TO_CODE)
+#        error Unimplemented architecture
+#    else
+       ArchUnknown
+#    endif
 #endif
 
 mkJumpToAddr :: EntryFunPtr -> ItblCodes
@@ -245,6 +257,11 @@ mkJumpToAddr a = case platform of
                    0x618C0000 .|. lo16 w32,
                    0x7D8903A6, 0x4E800420 ]
 
+    -- This code must not be called. You either need to
+    -- add your architecture as a distinct case or
+    -- use non-TABLES_NEXT_TO_CODE mode
+    ArchUnknown -> error "mkJumpToAddr: ArchUnknown is unsupported"
+
 byte0 :: (Integral w) => w -> Word8
 byte0 w = fromIntegral w
 



More information about the ghc-commits mailing list