Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL at Glasgow Haskell Compiler / GHC Commits: aadf21d5 by Sven Tennie at 2026-02-16T19:42:57+01:00 No more cross stage special cases - - - - - fb1b050a by Sven Tennie at 2026-02-17T17:16:21+01:00 Try another variant of interpreter configuration - - - - - 2 changed files: - hadrian/src/Settings/Packages.hs - hadrian/src/Settings/Program.hs Changes: ===================================== hadrian/src/Settings/Packages.hs ===================================== @@ -25,14 +25,11 @@ packageArgs = do -- immediately and may lead to cyclic dependencies. -- See: https://gitlab.haskell.org/ghc/ghc/issues/16809. cross = flag CrossCompiling - haveCurses = any (/= "") <$> traverse (flip buildSetting stage) [ CursesIncludeDir, CursesLibDir ] - - -- Check if the bootstrap compiler has the same version as the one we - -- are building. This is used to build cross-compilers - bootCross = (==) <$> ghcVersionStage (stage0InTree) <*> ghcVersionStage Stage1 + haveCurses = any (/= "") <$> traverse (`buildSetting` stage) [ CursesIncludeDir, CursesLibDir ] compilerStageOption f = buildingCompilerStage' . f =<< expr flavour + isCrossStage <- staged crossStage cursesIncludeDir <- staged (buildSetting CursesIncludeDir) cursesLibraryDir <- staged (buildSetting CursesLibDir) ffiIncludeDir <- staged (buildSetting FfiIncludeDir) @@ -53,7 +50,7 @@ packageArgs = do -- for Stage0 only so we can link ghc-pkg against it, so there is little -- reason to spend the effort to optimise it. , package cabal ? - andM [stage0, expr(notM cross)] ? builder Ghc ? arg "-O0" + stage0 ? builder Ghc ? arg "-O0" ------------------------------- compiler ------------------------------- , package compiler ? mconcat @@ -71,7 +68,7 @@ packageArgs = do -- These files take a very long time to compile with -O1, -- so we use -O0 for them just in Stage0 to speed up the -- build but not affect Stage1+ executables - , inputs ["**/GHC/Hs/Instances.hs", "**/GHC/Driver/Session.hs"] ? andM [stage0, expr(notM cross)] ? + , inputs ["**/GHC/Hs/Instances.hs", "**/GHC/Driver/Session.hs"] ? stage0 ? pure ["-O0"] ] , builder (Cabal Setup) ? mconcat @@ -91,7 +88,7 @@ packageArgs = do -- on the host and must rely on external interpreter to load -- target code, otherwise enable for stage2 since that runs on -- the target and can use target's own ghci object linker - [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage2]] `cabalFlag` "internal-interpreter" + [ expr (ghcWithInterpreter stage) `cabalFlag` "internal-interpreter" , orM [ notM cross, haveCurses ] `cabalFlag` "terminfo" , arg "-build-tool-depends" , staged (buildFlag UseLibzstd) `cabalFlag` "with-libzstd" @@ -113,8 +110,8 @@ packageArgs = do , compilerStageOption ghcDebugAssertions ? arg "-DDEBUG" ] , builder (Cabal Flags) ? mconcat - [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage1]] `cabalFlag` "interpreter" - , andM [expr (ghcWithInterpreter stage), notM (expr cross)] `cabalFlag` "internal-interpreter" + [ expr (ghcWithInterpreter stage) `cabalFlag` "interpreter" + , andM [expr (ghcWithInterpreter stage), notM (pure isCrossStage)] `cabalFlag` "internal-interpreter" , ifM stage0 -- We build a threaded stage 1 if the bootstrapping compiler -- supports it. @@ -165,10 +162,8 @@ packageArgs = do -- builder (Cabal Setup) ? cabalExtraDirs ffiIncludeDir ffiLibraryDir , builder (Cabal Flags) ? mconcat - [ ifM stage0 - (andM [cross, bootCross] `cabalFlag` "internal-interpreter") - (arg "internal-interpreter") - , stage0 `cabalFlag` "bootstrap" + [ stage0 `cabalFlag` "bootstrap", + andM [expr (ghcWithInterpreter stage), notM (pure isCrossStage)] `cabalFlag` "internal-interpreter" ] ] ===================================== hadrian/src/Settings/Program.hs ===================================== @@ -6,7 +6,6 @@ module Settings.Program import Base import Context import Oracles.Flavour -import Oracles.Flag import Packages import GHC.Platform.ArchOS @@ -40,7 +39,6 @@ programContext stage pkg = do -- Also checks whether the target supports GHCi. ghcWithInterpreter :: Stage -> Action Bool ghcWithInterpreter stage = do - is_cross <- flag CrossCompiling goodOs <- anyTargetOs stage [ OSMinGW32, OSLinux, OSSolaris2 , OSFreeBSD, OSDragonFly, OSNetBSD, OSOpenBSD , OSDarwin, OSKFreeBSD @@ -58,6 +56,4 @@ ghcWithInterpreter stage = do -- fall back on dynamic linking: dynamicGhcProgs <- askDynGhcPrograms stage - -- Maybe this should just be false for cross compilers. But for now - -- I've kept the old behaviour where it will say yes. (See #25939) - return $ ((goodOs && goodArch) || dynamicGhcProgs) && (stage >= Stage1 || is_cross) + return $ ((goodOs && goodArch) || dynamicGhcProgs) && (stage >= Stage2) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/20a054035434d8e2b881abfb02860a3... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/20a054035434d8e2b881abfb02860a3... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Sven Tennie (@supersven)