Peter Trommler pushed to branch wip/T26521 at Glasgow Haskell Compiler / GHC

Commits:

3 changed files:

Changes:

  • utils/ghc-toolchain/src/GHC/Toolchain/CheckArm.hs
    ... ... @@ -8,6 +8,7 @@ import System.Process
    8 8
     import GHC.Platform.ArchOS
    
    9 9
     
    
    10 10
     import GHC.Toolchain.Prelude
    
    11
    +import GHC.Toolchain.Utils (lastLine)
    
    11 12
     import GHC.Toolchain.Tools.Cc
    
    12 13
     
    
    13 14
     -- | Awkwardly, ARM triples sometimes contain insufficient information about
    
    ... ... @@ -75,10 +76,6 @@ findArmIsa cc = do
    75 76
               "False" -> return False
    
    76 77
               _ -> throwE $ "unexpected output from test program: " ++ out
    
    77 78
     
    
    78
    -lastLine :: String -> String
    
    79
    -lastLine "" = ""
    
    80
    -lastLine s  = last $ lines s
    
    81
    -
    
    82 79
     -- | Raspbian unfortunately makes some extremely questionable packaging
    
    83 80
     -- decisions, configuring gcc to compile for ARMv6 despite the fact that the
    
    84 81
     -- Raspberry Pi 4 is ARMv8. As ARMv8 doesn't support all instructions supported
    

  • utils/ghc-toolchain/src/GHC/Toolchain/CheckPower.hs
    ... ... @@ -3,6 +3,7 @@ module GHC.Toolchain.CheckPower ( checkPowerAbi ) where
    3 3
     import GHC.Platform.ArchOS
    
    4 4
     
    
    5 5
     import GHC.Toolchain.Prelude
    
    6
    +import GHC.Toolchain.Utils (lastLine)
    
    6 7
     import GHC.Toolchain.Tools.Cc
    
    7 8
     
    
    8 9
     checkPowerAbi :: Cc -> M Arch
    
    ... ... @@ -19,8 +20,3 @@ checkPowerAbi cc = do
    19 20
           "ELFv1" -> pure $ ArchPPC_64 ELF_V1
    
    20 21
           "ELFv2" -> pure $ ArchPPC_64 ELF_V2
    
    21 22
           _       -> throwE $ "unexpected output from test program: " ++ out
    22
    -
    
    23
    --- TODO: move lastLine to a common location
    
    24
    -lastLine :: String -> String
    
    25
    -lastLine "" = ""
    
    26
    -lastLine s  = last $ lines s

  • utils/ghc-toolchain/src/GHC/Toolchain/Utils.hs
    ... ... @@ -8,6 +8,7 @@ module GHC.Toolchain.Utils
    8 8
         , oneOf
    
    9 9
         , oneOf'
    
    10 10
         , isSuccess
    
    11
    +    , lastLine
    
    11 12
         ) where
    
    12 13
     
    
    13 14
     import Control.Exception
    
    ... ... @@ -65,3 +66,6 @@ isSuccess = \case
    65 66
       ExitSuccess -> True
    
    66 67
       ExitFailure _ -> False
    
    67 68
     
    
    69
    +lastLine :: String -> String
    
    70
    +lastLine "" = ""
    
    71
    +lastLine s  = last $ lines s