Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL at Glasgow Haskell Compiler / GHC

Commits:

22 changed files:

Changes:

  • .gitlab/generate-ci/gen_ci.hs
    ... ... @@ -20,6 +20,7 @@ import qualified Data.ByteString.Lazy.Char8 as B
    20 20
     import qualified Data.Set as S
    
    21 21
     import System.Environment
    
    22 22
     import Data.List
    
    23
    +import Data.Char (isSpace)
    
    23 24
     
    
    24 25
     {-
    
    25 26
     Note [Generating the CI pipeline]
    
    ... ... @@ -138,9 +139,11 @@ bignumString :: BignumBackend -> String
    138 139
     bignumString Gmp = "gmp"
    
    139 140
     bignumString Native = "native"
    
    140 141
     
    
    142
    +data TimeoutIncrease = TimeoutIncrease | NoTimeoutIncrease
    
    143
    +
    
    141 144
     data CrossEmulator
    
    142 145
       = NoEmulator
    
    143
    -  | NoEmulatorNeeded
    
    146
    +  | NoEmulatorNeeded TimeoutIncrease
    
    144 147
       | Emulator String
    
    145 148
     
    
    146 149
     -- | A BuildConfig records all the options which can be modified to affect the
    
    ... ... @@ -888,19 +891,33 @@ job arch opsys buildConfig = NamedJob { name = jobName, jobInfo = Job {..} }
    888 891
               NoEmulator
    
    889 892
                 -- we need an emulator but it isn't set. Won't run the testsuite
    
    890 893
                 | Just _ <- crossTarget buildConfig
    
    891
    -                           -> "CROSS_EMULATOR" =: "NOT_SET"
    
    892
    -            | otherwise    -> mempty
    
    893
    -          Emulator s       -> "CROSS_EMULATOR" =: s
    
    894
    -          NoEmulatorNeeded -> mempty
    
    894
    +                             -> "CROSS_EMULATOR" =: "NOT_SET"
    
    895
    +            | otherwise      -> mempty
    
    896
    +          Emulator s         -> "CROSS_EMULATOR" =: s
    
    897
    +          NoEmulatorNeeded _ -> mempty
    
    895 898
           , if withNuma buildConfig then "ENABLE_NUMA" =: "1" else mempty
    
    896
    -      , let runtestArgs =
    
    899
    +      , let
    
    900
    +            -- Emulators are naturally slower than native machines.
    
    901
    +            -- Triple the default of 300.
    
    902
    +            timeoutConf = "-e config.timeout=900"
    
    903
    +            testTimeoutArg =
    
    904
    +                case crossEmulator buildConfig of
    
    905
    +                  Emulator _ -> timeoutConf
    
    906
    +                  -- NodeJS (Javascript) is slower than native code
    
    907
    +                  NoEmulatorNeeded TimeoutIncrease -> timeoutConf
    
    908
    +                  _ -> mempty
    
    909
    +            runtestArgs =
    
    910
    +                testTimeoutArg :
    
    897 911
                     [ "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity"
    
    898 912
                     | validateNonmovingGc buildConfig
    
    899 913
                     ]
    
    900
    -        in "RUNTEST_ARGS" =: unwords runtestArgs
    
    914
    +        in "RUNTEST_ARGS" =: (trim . unwords) runtestArgs
    
    901 915
           , if testsuiteUsePerf buildConfig then "RUNTEST_ARGS" =: "--config perf_path=perf" else mempty
    
    902 916
           ]
    
    903 917
     
    
    918
    +    trim :: String -> String
    
    919
    +    trim = dropWhileEnd isSpace . dropWhile isSpace
    
    920
    +
    
    904 921
         -- Keep in sync with the exclude list in `function clean()` in
    
    905 922
         -- `.gitlab/ci.sh`!
    
    906 923
         jobArtifacts = Artifacts
    
    ... ... @@ -1298,7 +1315,7 @@ cross_jobs = [
    1298 1315
             (validateBuilds AArch64 (Linux Debian12Wine) (winAarch64Config {llvmBootstrap = True}))
    
    1299 1316
       ]
    
    1300 1317
       where
    
    1301
    -    javascriptConfig = (crossConfig "javascript-unknown-ghcjs" (Emulator "js-emulator") (Just "emconfigure"))
    
    1318
    +    javascriptConfig = (crossConfig "javascript-unknown-ghcjs" (NoEmulatorNeeded TimeoutIncrease) (Just "emconfigure"))
    
    1302 1319
                              { bignumBackend = Native }
    
    1303 1320
     
    
    1304 1321
         makeWinArmJobs = modifyJobs
    
    ... ... @@ -1343,7 +1360,7 @@ cross_jobs = [
    1343 1360
             $ addValidateRule WasmBackend $ validateBuilds Amd64 (Linux AlpineWasm) cfg
    
    1344 1361
     
    
    1345 1362
         wasm_build_config =
    
    1346
    -      (crossConfig "wasm32-wasi" NoEmulatorNeeded Nothing)
    
    1363
    +      (crossConfig "wasm32-wasi" (NoEmulatorNeeded NoTimeoutIncrease) Nothing)
    
    1347 1364
             { hostFullyStatic = True
    
    1348 1365
             , buildFlavour    = Release -- TODO: This needs to be validate but wasm backend doesn't pass yet
    
    1349 1366
             , textWithSIMDUTF = True
    

  • .gitlab/jobs.yaml
    ... ... @@ -389,7 +389,7 @@
    389 389
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    390 390
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    391 391
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    392
    -      "RUNTEST_ARGS": "",
    
    392
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    393 393
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    394 394
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    395 395
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -471,7 +471,7 @@
    471 471
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    472 472
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    473 473
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    474
    -      "RUNTEST_ARGS": "",
    
    474
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    475 475
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    476 476
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    477 477
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -1060,7 +1060,7 @@
    1060 1060
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    1061 1061
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    1062 1062
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    1063
    -      "RUNTEST_ARGS": "",
    
    1063
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    1064 1064
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    1065 1065
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    1066 1066
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -1143,7 +1143,7 @@
    1143 1143
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    1144 1144
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    1145 1145
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    1146
    -      "RUNTEST_ARGS": "",
    
    1146
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    1147 1147
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    1148 1148
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    1149 1149
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -2055,7 +2055,7 @@
    2055 2055
           "CROSS_STAGE": "2",
    
    2056 2056
           "CROSS_TARGET": "aarch64-linux-gnu",
    
    2057 2057
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2058
    -      "RUNTEST_ARGS": "",
    
    2058
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    2059 2059
           "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate",
    
    2060 2060
           "XZ_OPT": "-9"
    
    2061 2061
         }
    
    ... ... @@ -2118,10 +2118,10 @@
    2118 2118
           "BUILD_FLAVOUR": "validate",
    
    2119 2119
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    2120 2120
           "CONFIGURE_WRAPPER": "emconfigure",
    
    2121
    -      "CROSS_EMULATOR": "js-emulator",
    
    2121
    +      "CROSS_STAGE": "2",
    
    2122 2122
           "CROSS_TARGET": "javascript-unknown-ghcjs",
    
    2123 2123
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2124
    -      "RUNTEST_ARGS": "",
    
    2124
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    2125 2125
           "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate",
    
    2126 2126
           "XZ_OPT": "-9"
    
    2127 2127
         }
    
    ... ... @@ -2503,7 +2503,7 @@
    2503 2503
           "CROSS_STAGE": "2",
    
    2504 2504
           "CROSS_TARGET": "riscv64-linux-gnu",
    
    2505 2505
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2506
    -      "RUNTEST_ARGS": "",
    
    2506
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    2507 2507
           "TEST_ENV": "x86_64-linux-deb12-riscv-cross_riscv64-linux-gnu-validate",
    
    2508 2508
           "XZ_OPT": "-9"
    
    2509 2509
         }
    
    ... ... @@ -3582,7 +3582,7 @@
    3582 3582
           "CROSS_STAGE": "2",
    
    3583 3583
           "CROSS_TARGET": "loongarch64-linux-gnu",
    
    3584 3584
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3585
    -      "RUNTEST_ARGS": "",
    
    3585
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    3586 3586
           "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate",
    
    3587 3587
           "XZ_OPT": "-9"
    
    3588 3588
         }
    
    ... ... @@ -6229,7 +6229,7 @@
    6229 6229
           "CROSS_STAGE": "2",
    
    6230 6230
           "CROSS_TARGET": "aarch64-linux-gnu",
    
    6231 6231
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    6232
    -      "RUNTEST_ARGS": "",
    
    6232
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    6233 6233
           "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate"
    
    6234 6234
         }
    
    6235 6235
       },
    
    ... ... @@ -6291,10 +6291,10 @@
    6291 6291
           "BUILD_FLAVOUR": "validate",
    
    6292 6292
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    6293 6293
           "CONFIGURE_WRAPPER": "emconfigure",
    
    6294
    -      "CROSS_EMULATOR": "js-emulator",
    
    6294
    +      "CROSS_STAGE": "2",
    
    6295 6295
           "CROSS_TARGET": "javascript-unknown-ghcjs",
    
    6296 6296
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    6297
    -      "RUNTEST_ARGS": "",
    
    6297
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    6298 6298
           "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate"
    
    6299 6299
         }
    
    6300 6300
       },
    
    ... ... @@ -6671,7 +6671,7 @@
    6671 6671
           "CROSS_STAGE": "2",
    
    6672 6672
           "CROSS_TARGET": "riscv64-linux-gnu",
    
    6673 6673
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    6674
    -      "RUNTEST_ARGS": "",
    
    6674
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    6675 6675
           "TEST_ENV": "x86_64-linux-deb12-riscv-cross_riscv64-linux-gnu-validate"
    
    6676 6676
         }
    
    6677 6677
       },
    
    ... ... @@ -7734,7 +7734,7 @@
    7734 7734
           "CROSS_STAGE": "2",
    
    7735 7735
           "CROSS_TARGET": "loongarch64-linux-gnu",
    
    7736 7736
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7737
    -      "RUNTEST_ARGS": "",
    
    7737
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    7738 7738
           "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate"
    
    7739 7739
         }
    
    7740 7740
       },
    

  • ghc/GHC/Driver/Session/Mode.hs
    ... ... @@ -132,7 +132,7 @@ isDoEvalMode :: Mode -> Bool
    132 132
     isDoEvalMode (Right (Right (DoEval _))) = True
    
    133 133
     isDoEvalMode _ = False
    
    134 134
     
    
    135
    -#if defined(HAVE_INTERNAL_INTERPRETER)
    
    135
    +#if defined(HAVE_INTERPRETER)
    
    136 136
     isInteractiveMode :: PostLoadMode -> Bool
    
    137 137
     isInteractiveMode DoInteractive = True
    
    138 138
     isInteractiveMode _             = False
    

  • ghc/GHCi/UI.hs
    ... ... @@ -1900,7 +1900,9 @@ changeDirectory dir = do
    1900 1900
           fhv <- compileGHCiExpr $
    
    1901 1901
             "System.Directory.setCurrentDirectory " ++ show dir'
    
    1902 1902
           liftIO $ evalIO interp fhv
    
    1903
    +#if defined(HAVE_INTERNAL_INTERPRETER)
    
    1903 1904
         _ -> pure ()
    
    1905
    +#endif
    
    1904 1906
     
    
    1905 1907
     trySuccess :: GhciMonad m => m SuccessFlag -> m SuccessFlag
    
    1906 1908
     trySuccess act =
    

  • ghc/Main.hs
    ... ... @@ -35,7 +35,7 @@ import GHC.Driver.Config.Diagnostic
    35 35
     import GHC.Platform
    
    36 36
     import GHC.Platform.Host
    
    37 37
     
    
    38
    -#if defined(HAVE_INTERNAL_INTERPRETER)
    
    38
    +#if defined(HAVE_INTERPRETER)
    
    39 39
     import GHCi.UI              ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings )
    
    40 40
     #endif
    
    41 41
     
    
    ... ... @@ -287,7 +287,7 @@ doRun units srcs args = do
    287 287
         args' = drop 1 $ dropWhile (/= "--") $ map unLoc args
    
    288 288
     
    
    289 289
     ghciUI :: [String] -> [(FilePath, Maybe Phase)] -> Maybe [String] -> Ghc ()
    
    290
    -#if !defined(HAVE_INTERNAL_INTERPRETER)
    
    290
    +#if !defined(HAVE_INTERPRETER)
    
    291 291
     ghciUI _ _ _ =
    
    292 292
       throwGhcException (CmdLineError "not built for interactive use")
    
    293 293
     #else
    
    ... ... @@ -331,7 +331,7 @@ showBanner :: PostLoadMode -> DynFlags -> IO ()
    331 331
     showBanner _postLoadMode dflags = do
    
    332 332
        let verb = verbosity dflags
    
    333 333
     
    
    334
    -#if defined(HAVE_INTERNAL_INTERPRETER)
    
    334
    +#if defined(HAVE_INTERPRETER)
    
    335 335
        -- Show the GHCi banner
    
    336 336
        when (isInteractiveMode _postLoadMode && verb >= 1) $ putStrLn ghciWelcomeMsg
    
    337 337
     #endif
    

  • ghc/ghc-bin.cabal.in
    ... ... @@ -22,6 +22,11 @@ Flag internal-interpreter
    22 22
         Default: False
    
    23 23
         Manual: True
    
    24 24
     
    
    25
    +Flag interpreter
    
    26
    +    Description: Build with interpreter support, both internal and external.
    
    27
    +    Default: False
    
    28
    +    Manual: True
    
    29
    +
    
    25 30
     Flag threaded
    
    26 31
         Description: Link the ghc executable against the threaded RTS
    
    27 32
         Default: True
    
    ... ... @@ -56,7 +61,7 @@ Executable ghc
    56 61
                      -rtsopts=all
    
    57 62
                      "-with-rtsopts=-K512M -H -I5 -T"
    
    58 63
     
    
    59
    -    if flag(internal-interpreter)
    
    64
    +    if flag(interpreter)
    
    60 65
             -- NB: this is never built by the bootstrapping GHC+libraries
    
    61 66
             Build-depends:
    
    62 67
                 deepseq        >= 1.4 && < 1.6,
    
    ... ... @@ -65,7 +70,7 @@ Executable ghc
    65 70
                 haskeline      == 0.8.*,
    
    66 71
                 exceptions     == 0.10.*,
    
    67 72
                 time           >= 1.8 && < 1.16
    
    68
    -        CPP-Options: -DHAVE_INTERNAL_INTERPRETER
    
    73
    +        CPP-Options: -DHAVE_INTERPRETER
    
    69 74
             Other-Modules:
    
    70 75
                 GHCi.Leak
    
    71 76
                 GHCi.UI
    
    ... ... @@ -82,6 +87,9 @@ Executable ghc
    82 87
                 UnboxedTuples
    
    83 88
                 ViewPatterns
    
    84 89
     
    
    90
    +    if flag(internal-interpreter)
    
    91
    +       CPP-Options: -DHAVE_INTERNAL_INTERPRETER
    
    92
    +
    
    85 93
         if flag(threaded)
    
    86 94
           ghc-options: -threaded
    
    87 95
     
    

  • hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
    ... ... @@ -81,10 +81,11 @@ parsePackageData pkg = do
    81 81
             sorted  = sort [ C.unPackageName p | C.Dependency p _ _ <- allDeps ]
    
    82 82
             deps    = nubOrd sorted \\ [name]
    
    83 83
             depPkgs = mapMaybe findPackageByName deps
    
    84
    +        cxxStdLib = elem "system-cxx-std-lib" deps
    
    84 85
         return $ PackageData name version
    
    85 86
                              (C.fromShortText (C.synopsis pd))
    
    86 87
                              (C.fromShortText (C.description pd))
    
    87
    -                         depPkgs gpd
    
    88
    +                         depPkgs cxxStdLib gpd
    
    88 89
       where
    
    89 90
         -- Collect an overapproximation of dependencies by ignoring conditionals
    
    90 91
         collectDeps :: Maybe (C.CondTree v [C.Dependency] a) -> [C.Dependency]
    
    ... ... @@ -138,7 +139,9 @@ configurePackage :: Context -> Action ()
    138 139
     configurePackage context@Context {..} = do
    
    139 140
         putProgressInfo $ "| Configure package " ++ quote (pkgName package)
    
    140 141
         gpd     <- pkgGenericDescription package
    
    141
    -    depPkgs <- packageDependencies <$> readPackageData package
    
    142
    +    pd <- readPackageData package
    
    143
    +    let depPkgs = packageDependencies pd
    
    144
    +        needSystemCxxStdLib = dependsOnSystemCxxStdLib pd
    
    142 145
     
    
    143 146
         -- Stage packages are those we have in this stage.
    
    144 147
         stagePkgs <- stagePackages stage
    
    ... ... @@ -157,7 +160,12 @@ configurePackage context@Context {..} = do
    157 160
         -- We'll need those packages in our package database.
    
    158 161
         deps <- sequence [ pkgConfFile (context { package = pkg, iplace = forceBaseAfterGhcInternal pkg })
    
    159 162
                          | pkg <- depPkgs, pkg `elem` stagePkgs ]
    
    160
    -    need $ extraPreConfigureDeps ++ deps
    
    163
    +    -- system-cxx-std-lib is magic.. it doesn't have a cabal file or source code, so we have
    
    164
    +    -- to treat it specially as `pkgConfFile` uses `readPackageData` to compute the version.
    
    165
    +    systemCxxStdLib <- sequence [ systemCxxStdLibConfPath (PackageDbLoc stage iplace) | needSystemCxxStdLib ]
    
    166
    +    need $ extraPreConfigureDeps
    
    167
    +            ++ deps
    
    168
    +            ++ systemCxxStdLib
    
    161 169
     
    
    162 170
         -- Figure out what hooks we need.
    
    163 171
         let configureFile = replaceFileName (pkgCabalFile package) "configure"
    

  • hadrian/src/Hadrian/Haskell/Cabal/Type.hs
    ... ... @@ -30,6 +30,7 @@ data PackageData = PackageData
    30 30
         , synopsis                  :: String
    
    31 31
         , description               :: String
    
    32 32
         , packageDependencies       :: [Package]
    
    33
    +    , dependsOnSystemCxxStdLib  :: Bool
    
    33 34
         , genericPackageDescription :: GenericPackageDescription
    
    34 35
         } deriving (Eq, Generic, Show)
    
    35 36
     
    

  • hadrian/src/Hadrian/Oracles/TextFile.hs
    ... ... @@ -124,8 +124,8 @@ getBuildTarget :: Action Toolchain.Target
    124 124
     getBuildTarget = getTargetConfig buildTargetFile
    
    125 125
     
    
    126 126
     -- | Get the host target configuration through 'getTargetConfig'
    
    127
    -getHostTarget :: Action Toolchain.Target
    
    128
    -getHostTarget = do
    
    127
    +getHostTarget :: Stage -> Action Toolchain.Target
    
    128
    +getHostTarget stage | stage >= Stage1 = do
    
    129 129
       -- MP: If we are not cross compiling then we should use the target file in order to
    
    130 130
       -- build things for the host, in particular we want to use the configured values for the
    
    131 131
       -- target for building the RTS (ie are we using Libffi for adjustors, and the wordsize)
    
    ... ... @@ -135,8 +135,7 @@ getHostTarget = do
    135 135
       if (Toolchain.targetPlatformTriple ht) == (Toolchain.targetPlatformTriple tt)
    
    136 136
         then return tt
    
    137 137
         else return ht
    
    138
    -  -- where
    
    139
    -  --   msg = "The host's target configuration file " ++ quote hostTargetFile ++ " does not exist! ghc-toolchain might have failed to generate it."
    
    138
    +getHostTarget _stage {- stage0 -} = getTargetConfig hostTargetFile
    
    140 139
     
    
    141 140
     -- | Get the target target configuration through 'getTargetConfig'
    
    142 141
     getTargetTarget :: Action Toolchain.Target
    
    ... ... @@ -145,9 +144,8 @@ getTargetTarget = getTargetConfig targetTargetFile
    145 144
     queryBuildTarget :: (Toolchain.Target -> a) -> Action a
    
    146 145
     queryBuildTarget f = f <$> getBuildTarget
    
    147 146
     
    
    148
    -queryHostTarget :: (Toolchain.Target -> a) -> Action a
    
    149
    -queryHostTarget f = f <$> getHostTarget
    
    150
    -
    
    147
    +queryHostTarget :: Stage -> (Toolchain.Target -> a) -> Action a
    
    148
    +queryHostTarget stage f = f <$> getHostTarget stage
    
    151 149
     
    
    152 150
     newtype KeyValue = KeyValue (FilePath, String)
    
    153 151
         deriving (Binary, Eq, Hashable, NFData, Show)
    

  • hadrian/src/Oracles/Setting.hs
    ... ... @@ -137,7 +137,7 @@ getSetting = expr . setting
    137 137
     bashPath :: Action FilePath
    
    138 138
     bashPath = setting BourneShell
    
    139 139
     
    
    140
    -isWinHost :: Action Bool
    
    140
    +isWinHost :: Stage -> Action Bool
    
    141 141
     isWinHost = anyHostOs [OSMinGW32]
    
    142 142
     
    
    143 143
     isWinTarget :: Stage -> Action Bool
    
    ... ... @@ -153,8 +153,8 @@ isArmTarget :: Stage -> Action Bool
    153 153
     isArmTarget stage = queryTargetTarget stage (isARM . archOS_arch . tgtArchOs)
    
    154 154
     
    
    155 155
     -- | Check whether the host OS setting matches one of the given strings.
    
    156
    -anyHostOs :: [OS] -> Action Bool
    
    157
    -anyHostOs oss = (`elem` oss) <$> queryHostTarget (archOS_OS . tgtArchOs)
    
    156
    +anyHostOs :: [OS] -> Stage ->  Action Bool
    
    157
    +anyHostOs oss  stage = (`elem` oss) <$> queryHostTarget stage (archOS_OS . tgtArchOs)
    
    158 158
     
    
    159 159
     -- | Check whether the target architecture setting matches one of the given
    
    160 160
     -- strings.
    
    ... ... @@ -233,7 +233,7 @@ libsuf st way
    233 233
     -- For example, we want to build RTS with stage1 for the host target as we
    
    234 234
     -- produce a host executable with stage1 (which cross-compiles to stage2).
    
    235 235
     targetStage :: Stage -> Action Target
    
    236
    -targetStage stage | isHostStage stage = getHostTarget
    
    236
    +targetStage stage | isHostStage stage = getHostTarget stage
    
    237 237
     targetStage _ = getTargetTarget
    
    238 238
     
    
    239 239
     isHostStage :: Stage -> Bool
    

  • hadrian/src/Rules/BinaryDist.hs
    ... ... @@ -326,7 +326,7 @@ bindistRules = do
    326 326
         -- phony "binary-dist-dir-stage3" $ buildBinDistDir root targetBindist
    
    327 327
     
    
    328 328
         let buildBinDist compressor = do
    
    329
    -          win_host <- isWinHost
    
    329
    +          win_host <- isWinHost Stage1
    
    330 330
               win_target <- isWinTarget Stage2
    
    331 331
               when (win_target && win_host) (error "normal binary-dist does not work for windows targets, use `reloc-binary-dist-*` target instead.")
    
    332 332
               buildBinDistX "binary-dist-dir" "bindist" compressor
    

  • hadrian/src/Rules/Generate.hs
    ... ... @@ -246,9 +246,6 @@ copyRules = do
    246 246
             prefix -/- "html/**"           <~ return "utils/haddock/haddock-api/resources"
    
    247 247
             prefix -/- "latex/**"          <~ return "utils/haddock/haddock-api/resources"
    
    248 248
     
    
    249
    -        forM_ [Inplace, Final] $ \iplace ->
    
    250
    -          root -/- relativePackageDbPath (PackageDbLoc stage iplace) -/- systemCxxStdLibConf %> \file -> do
    
    251
    -            copyFile ("mk" -/- "system-cxx-std-lib-1.0.conf") file
    
    252 249
     
    
    253 250
     generateRules :: Rules ()
    
    254 251
     generateRules = do
    
    ... ... @@ -412,7 +409,7 @@ bindistRules = do
    412 409
         , interpolateSetting "ProjectPatchLevel2" ProjectPatchLevel2
    
    413 410
         , interpolateSetting "ProjectGitCommitId" ProjectGitCommitId
    
    414 411
     
    
    415
    -    , interpolateVar "HostOS_CPP" $ fmap cppify $ interp $ queryHost queryOS
    
    412
    +    , interpolateVar "HostOS_CPP" $ fmap cppify $ interp $ queryHost queryOS Stage1
    
    416 413
     
    
    417 414
         , interpolateVar "TargetPlatform" $ getTarget targetPlatformTriple
    
    418 415
         , interpolateVar "TargetPlatform_CPP" $ cppify <$> getTarget targetPlatformTriple
    
    ... ... @@ -436,7 +433,7 @@ bindistRules = do
    436 433
         , interpolateVar "TargetHasLibm" $ yesNo <$> interp (staged (buildFlag TargetHasLibm))
    
    437 434
         , interpolateVar "TargetPlatform" $ getTarget targetPlatformTriple
    
    438 435
         , interpolateVar "BuildPlatform"  $ interp $ queryBuild targetPlatformTriple
    
    439
    -    , interpolateVar "HostPlatform"   $ interp $ queryHost targetPlatformTriple
    
    436
    +    , interpolateVar "HostPlatform"   $ interp $ queryHost  targetPlatformTriple Stage1
    
    440 437
         , interpolateVar "TargetWordBigEndian" $ getTarget isBigEndian
    
    441 438
         , interpolateVar "TargetWordSize" $ getTarget wordSize
    
    442 439
         , interpolateVar "Unregisterised" $ yesNo <$> getTarget tgtUnregisterised
    
    ... ... @@ -526,7 +523,7 @@ generateConfigHs = do
    526 523
         let chooseSetting x y = case stage of { Stage0 {} -> x; _ -> y }
    
    527 524
         let queryTarget f = f <$> expr (targetStage stage)
    
    528 525
         -- Not right for stage3
    
    529
    -    buildPlatform <- chooseSetting (queryBuild targetPlatformTriple) (queryHost targetPlatformTriple)
    
    526
    +    buildPlatform <- chooseSetting (queryBuild targetPlatformTriple) (queryHost targetPlatformTriple stage)
    
    530 527
         hostPlatform <- queryTarget targetPlatformTriple
    
    531 528
         trackGenerateHs
    
    532 529
         cProjectName        <- getSetting ProjectName
    
    ... ... @@ -629,9 +626,9 @@ generatePlatformHostHs = do
    629 626
         stage <- getStage
    
    630 627
         let chooseHostQuery = case stage of
    
    631 628
                 Stage0 {} -> queryHost
    
    632
    -            _         -> queryTarget stage
    
    633
    -    cHostPlatformArch <- chooseHostQuery (archOS_arch . tgtArchOs)
    
    634
    -    cHostPlatformOS   <- chooseHostQuery (archOS_OS . tgtArchOs)
    
    629
    +            _         -> flip queryTarget
    
    630
    +    cHostPlatformArch <- chooseHostQuery (archOS_arch . tgtArchOs) stage
    
    631
    +    cHostPlatformOS   <- chooseHostQuery (archOS_OS . tgtArchOs) stage
    
    635 632
         return $ unlines
    
    636 633
             [ "module GHC.Platform.Host where"
    
    637 634
             , ""
    

  • hadrian/src/Rules/Lint.hs
    ... ... @@ -42,7 +42,7 @@ runHLint :: [FilePath] -- ^ include directories
    42 42
              -> Action ()
    
    43 43
     runHLint includeDirs defines dir = do
    
    44 44
       threads <- shakeThreads <$> getShakeOptions
    
    45
    -  hostArch <- (<> "_HOST_ARCH") <$> queryHostTarget queryArch
    
    45
    +  hostArch <- (<> "_HOST_ARCH") <$> queryHostTarget Stage1 queryArch
    
    46 46
       let hlintYaml = dir </> ".hlint.yaml"
    
    47 47
           defines' = hostArch : defines
    
    48 48
           cmdLine = unwords $
    

  • hadrian/src/Rules/Register.hs
    ... ... @@ -111,6 +111,12 @@ registerPackageRules rs stage iplace = do
    111 111
                 target (Context stage compiler vanilla iplace) (GhcPkg Recache stage) [] []
    
    112 112
             writeFileLines stamp []
    
    113 113
     
    
    114
    +    -- Special rule for registering system-cxx-std-lib
    
    115
    +    root -/- relativePackageDbPath (PackageDbLoc stage iplace) -/- systemCxxStdLibConf %> \file -> do
    
    116
    +        copyFile ("mk" -/- "system-cxx-std-lib-1.0.conf") file
    
    117
    +        buildWithResources rs $
    
    118
    +            target (Context stage compiler vanilla iplace) (GhcPkg Recache stage) [] []
    
    119
    +
    
    114 120
         -- Register a package.
    
    115 121
         root -/- relativePackageDbPath (PackageDbLoc stage iplace) -/- "*.conf" %> \conf -> do
    
    116 122
             historyDisable
    

  • hadrian/src/Settings.hs
    ... ... @@ -119,9 +119,11 @@ unsafeFindPackageByPath path = err $ find (\pkg -> pkgPath pkg == path) knownPac
    119 119
     -- Be careful querying values from the HOST and BUILD targets until the targets
    
    120 120
     -- are only generated by ghc-toolchain:
    
    121 121
     -- See Note [The dummy values in the HOST target description]
    
    122
    -queryBuild, queryHost :: (Target -> a) -> Expr a
    
    122
    +queryBuild :: (Target -> a) -> Expr a
    
    123 123
     queryBuild f = expr $ queryBuildTarget f
    
    124
    -queryHost  f = expr $ queryHostTarget f
    
    124
    +
    
    125
    +queryHost :: (Target -> a) -> Stage -> Expr a
    
    126
    +queryHost f stage = expr $ queryHostTarget stage f
    
    125 127
     
    
    126 128
     queryArch, queryOS, queryVendor :: Target -> String
    
    127 129
     queryArch = stringEncodeArch . archOS_arch . tgtArchOs
    

  • hadrian/src/Settings/Builders/Hsc2Hs.hs
    ... ... @@ -13,8 +13,8 @@ hsc2hsBuilderArgs = builder Hsc2Hs ? do
    13 13
         ccPath  <- getBuilderPath $ Cc CompileC stage
    
    14 14
         gmpDir  <- staged (buildSetting GmpIncludeDir)
    
    15 15
         top     <- expr topDirectory
    
    16
    -    hArch   <- queryHost queryArch
    
    17
    -    hOs     <- queryHost queryOS
    
    16
    +    hArch   <- queryHost queryArch stage
    
    17
    +    hOs     <- queryHost queryOS stage
    
    18 18
         tArch   <- queryTarget stage queryArch
    
    19 19
         tOs     <- queryTarget stage queryOS
    
    20 20
         version <- case stage of
    

  • hadrian/src/Settings/Builders/RunTest.hs
    ... ... @@ -124,7 +124,7 @@ inTreeCompilerArgs stg = do
    124 124
         debugged            <- ghcDebugged        <$> flavour <*> pure ghcStage
    
    125 125
         profiled            <- ghcProfiled        <$> flavour <*> pure ghcStage
    
    126 126
     
    
    127
    -    os          <- queryHostTarget queryOS
    
    127
    +    os          <- queryHostTarget ghcStage queryOS
    
    128 128
         arch        <- queryTargetTarget ghcStage queryArch
    
    129 129
         let codegen_arches = ["x86_64", "i386", "powerpc", "powerpc64", "powerpc64le", "aarch64", "wasm32", "riscv64", "loongarch64"]
    
    130 130
         let withNativeCodeGen
    

  • hadrian/src/Settings/Packages.hs
    ... ... @@ -89,11 +89,10 @@ packageArgs = do
    89 89
                 -- 1. ghcWithInterpreter must be True ("Use interpreter" =
    
    90 90
                 --    "YES")
    
    91 91
                 -- 2. For non-cross case it can be enabled
    
    92
    -            -- 3. For cross case, disable for stage0 since that runs
    
    93
    -            --    on the host and must rely on external interpreter to
    
    94
    -            --    load target code, otherwise enable for stage1 since
    
    95
    -            --    that runs on the target and can use target's own
    
    96
    -            --    ghci object linker
    
    92
    +            -- 3. For cross case, disable for stage0 and stage1 since these run
    
    93
    +            --    on the host and must rely on external interpreter to load
    
    94
    +            --    target code, otherwise enable for stage2 since that runs on
    
    95
    +            --    the target and can use target's own ghci object linker
    
    97 96
                 [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage2]] `cabalFlag` "internal-interpreter"
    
    98 97
                 , orM [ notM cross, haveCurses ]  `cabalFlag` "terminfo"
    
    99 98
                 , arg "-build-tool-depends"
    

  • libraries/base/tests/IO/all.T
    ... ... @@ -182,7 +182,7 @@ test('T17414',
    182 182
          compile_and_run, [''])
    
    183 183
     test('T17510', expect_broken(17510), compile_and_run, [''])
    
    184 184
     test('bytestringread001', extra_run_opts('test.data'), compile_and_run, [''])
    
    185
    -test('T17912', [only_ways(['threaded1']), when(opsys('mingw32'),expect_broken(1))], compile_and_run, [''])
    
    185
    +test('T17912', [only_ways(['threaded1']), when(opsys('mingw32'),fragile(1))], compile_and_run, [''])
    
    186 186
     test('T18832', only_ways(['threaded1']), compile_and_run, [''])
    
    187 187
     
    
    188 188
     test('mkdirExists', [exit_code(1), when(opsys('mingw32'), ignore_stderr)], compile_and_run, [''])

  • libraries/base/tests/all.T
    ... ... @@ -318,6 +318,7 @@ test('T23687', normal, compile_and_run, [''])
    318 318
     test('T23697',
    
    319 319
       [ when(opsys('mingw32'), skip) # header not found
    
    320 320
       , when(opsys('darwin'), skip)  # permission denied
    
    321
    +  , js_broken(22355)
    
    321 322
       ], makefile_test, ['T23697'])
    
    322 323
     test('stimesEndo', normal, compile_and_run, [''])
    
    323 324
     test('T24807', exit_code(1), compile_and_run, [''])
    

  • m4/fp_find_nm.m4
    ... ... @@ -12,6 +12,7 @@ AC_DEFUN([FP_FIND_NM],
    12 12
         if test "$HostOS" = "mingw32"
    
    13 13
         then
    
    14 14
           NmCmd=$(cygpath -m "$NM")
    
    15
    +      NM_STAGE0=$NmCmd
    
    15 16
         else
    
    16 17
           NmCmd="$NM"
    
    17 18
         fi
    

  • testsuite/tests/javascript/closure/all.T
    1 1
     # These are JavaScript-specific tests based on Google Closure Compiler
    
    2 2
     setTestOpts(when(not(js_arch()),skip))
    
    3 3
     
    
    4
    -test('T24602', normal, makefile_test, ['T24602'])
    4
    +# Runs fine locally. Fails on CI with:
    
    5
    +#
    
    6
    +# Wrong exit code for T24602()(expected 0 , actual 2 )
    
    7
    +# Stderr  run  ( T24602 ):
    
    8
    +# gmake: node: Permission denied
    
    9
    +# gmake: *** [Makefile:11: T24602] Error 127
    
    10
    +# *** unexpected failure for T24602(normal)
    
    11
    +test('T24602', fragile(26712), makefile_test, ['T24602'])