[Git][ghc/ghc][wip/toolchain-selection] FixeWs
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Wed Jul 5 09:30:25 UTC 2023
Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC
Commits:
f8462308 by Rodrigo Mesquita at 2023-07-05T10:30:19+01:00
FixeWs
- - - - -
3 changed files:
- hadrian/src/Oracles/Setting.hs
- utils/ghc-toolchain/Main.hs
- utils/ghc-toolchain/src/GHC/Toolchain/Monad.hs
Changes:
=====================================
hadrian/src/Oracles/Setting.hs
=====================================
@@ -259,10 +259,11 @@ libsuf st way
return (suffix ++ "-ghc" ++ version ++ extension)
targetStage :: Stage -> Action Target
--- ROMES:TODO: First iteration, only make it work for BUILD=HOST=TARGET
--- What are the correct targets here?
+-- TODO: We currently only support cross-compiling a stage1 compiler,
+-- but the cross compiler should really be stage2 (#19174)
+-- When we get there, we'll need to change the definition here.
targetStage (Stage0 {}) = getBuildTarget
targetStage (Stage1 {}) = getHostTarget
-targetStage (Stage2 {}) = getHostTarget
+targetStage (Stage2 {}) = getTargetTarget
targetStage (Stage3 {}) = getTargetTarget
=====================================
utils/ghc-toolchain/Main.hs
=====================================
@@ -251,16 +251,18 @@ registerisedSupported archOs =
ArchARM _ _ _ -> True
ArchAArch64 -> True
ArchRISCV64 -> True
+ ArchWasm32 -> True
+ ArchJavaScript -> True
_ -> False
determineUnregisterised :: ArchOS -> Maybe Bool -> M Bool
determineUnregisterised archOs userReq =
case userReq of
- Just False
+ Just False -- user requested registerised build
| not regSupported -> throwE "GHC doesn't support registerised compilation on this architecture"
| otherwise -> return False
Just True -> return True
- Nothing
+ Nothing -- user wasn't explicit, do registerised if we support it
| regSupported -> return False
| otherwise -> return True
where
=====================================
utils/ghc-toolchain/src/GHC/Toolchain/Monad.hs
=====================================
@@ -53,7 +53,7 @@ getEnv :: M Env
getEnv = M $ lift Reader.ask
makeM :: IO (Either [Error] a) -> M a
-makeM io = M (Except.ExceptT (Reader.ReaderT (\env -> io)))
+makeM io = M (Except.ExceptT (Reader.ReaderT (\_env -> io)))
data Error = Error { errorMessage :: String
, errorLogContexts :: [String]
@@ -116,6 +116,8 @@ appendFile path s = liftIO $ Prelude.appendFile path s
createFile :: FilePath -> M ()
createFile path = writeFile path ""
+-- | Branch on whether we're cross-compiling, that is, if the Target we're
+-- producing differs from the platform we're producing it on.
ifCrossCompiling
:: M a -- ^ what to do when cross-compiling
-> M a -- ^ what to do otherwise
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f8462308790dad5e763172c7a5cf9857606bf2af
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f8462308790dad5e763172c7a5cf9857606bf2af
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230705/1360850f/attachment-0001.html>
More information about the ghc-commits
mailing list