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

Commits:

12 changed files:

Changes:

  • .gitlab/ci.sh
    ... ... @@ -63,6 +63,9 @@ Hadrian build system
    63 63
     Environment variables affecting both build systems:
    
    64 64
     
    
    65 65
       CROSS_TARGET      Triple of cross-compilation target.
    
    66
    +  CROSS_STAGE       The stage of the cross-compiler to build either
    
    67
    +                      * 2: Build a normal cross-compiler bindist
    
    68
    +                      * 3: Build a target executable bindist (with the stage2 cross-compiler)
    
    66 69
       VERBOSE           Set to non-empty for verbose build output
    
    67 70
       RUNTEST_ARGS      Arguments passed to runtest.py
    
    68 71
       MSYSTEM           (Windows-only) Which platform to build from (CLANG64).
    
    ... ... @@ -548,6 +551,12 @@ function build_hadrian() {
    548 551
         export XZ_OPT="${XZ_OPT:-} -T$cores"
    
    549 552
       fi
    
    550 553
     
    
    554
    +  case "${CROSS_STAGE:-2}" in
    
    555
    +    2) BINDIST_TARGET="binary-dist";;
    
    556
    +    3) BINDIST_TARGET="binary-dist-stage3";;
    
    557
    +    *) fail "Unknown CROSS_STAGE, must be 2 or 3";;
    
    558
    +  esac
    
    559
    +
    
    551 560
       if [[ -n "${REINSTALL_GHC:-}" ]]; then
    
    552 561
         run_hadrian build-cabal -V
    
    553 562
       else
    
    ... ... @@ -557,7 +566,7 @@ function build_hadrian() {
    557 566
               mv _build/reloc-bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz"
    
    558 567
               ;;
    
    559 568
             *)
    
    560
    -          run_hadrian test:all_deps binary-dist -V
    
    569
    +          run_hadrian test:all_deps $BINDIST_TARGET
    
    561 570
               mv _build/bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz"
    
    562 571
               ;;
    
    563 572
         esac
    

  • .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]
    
    ... ... @@ -155,6 +156,7 @@ data BuildConfig
    155 156
                     , withNuma       :: Bool
    
    156 157
                     , withZstd       :: Bool
    
    157 158
                     , crossTarget    :: Maybe String
    
    159
    +                , crossStage     :: Maybe Int
    
    158 160
                     , crossEmulator  :: CrossEmulator
    
    159 161
                     , configureWrapper :: Maybe String
    
    160 162
                     , fullyStatic    :: Bool
    
    ... ... @@ -223,6 +225,7 @@ vanilla = BuildConfig
    223 225
       , withNuma = False
    
    224 226
       , withZstd = False
    
    225 227
       , crossTarget = Nothing
    
    228
    +  , crossStage  = Nothing
    
    226 229
       , crossEmulator = NoEmulator
    
    227 230
       , configureWrapper = Nothing
    
    228 231
       , fullyStatic = False
    
    ... ... @@ -273,6 +276,7 @@ crossConfig :: String -- ^ target triple
    273 276
                 -> BuildConfig
    
    274 277
     crossConfig triple emulator configure_wrapper =
    
    275 278
         vanilla { crossTarget = Just triple
    
    279
    +            , crossStage  = Just 2
    
    276 280
                 , crossEmulator = emulator
    
    277 281
                 , configureWrapper = configure_wrapper
    
    278 282
                 }
    
    ... ... @@ -880,6 +884,7 @@ job arch opsys buildConfig = NamedJob { name = jobName, jobInfo = Job {..} }
    880 884
           , "INSTALL_CONFIGURE_ARGS" =: "--enable-strict-ghc-toolchain-check"
    
    881 885
           , maybe mempty ("CONFIGURE_WRAPPER" =:) (configureWrapper buildConfig)
    
    882 886
           , maybe mempty ("CROSS_TARGET" =:) (crossTarget buildConfig)
    
    887
    +      , maybe mempty (("CROSS_STAGE" =:) . show) (crossStage buildConfig)
    
    883 888
           , case crossEmulator buildConfig of
    
    884 889
               NoEmulator
    
    885 890
                 -- we need an emulator but it isn't set. Won't run the testsuite
    
    ... ... @@ -889,14 +894,24 @@ job arch opsys buildConfig = NamedJob { name = jobName, jobInfo = Job {..} }
    889 894
               Emulator s       -> "CROSS_EMULATOR" =: s
    
    890 895
               NoEmulatorNeeded -> mempty
    
    891 896
           , if withNuma buildConfig then "ENABLE_NUMA" =: "1" else mempty
    
    892
    -      , let runtestArgs =
    
    897
    +      , let testTimeoutArg =
    
    898
    +                case crossEmulator buildConfig of
    
    899
    +                  -- Emulators are naturally slower than native machines.
    
    900
    +                  -- Triple the default of 300.
    
    901
    +                  Emulator _ -> "-e config.timeout=900" :: String
    
    902
    +                  _ -> mempty
    
    903
    +            runtestArgs =
    
    904
    +                testTimeoutArg :
    
    893 905
                     [ "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity"
    
    894 906
                     | validateNonmovingGc buildConfig
    
    895 907
                     ]
    
    896
    -        in "RUNTEST_ARGS" =: unwords runtestArgs
    
    908
    +        in "RUNTEST_ARGS" =: (trim . unwords) runtestArgs
    
    897 909
           , if testsuiteUsePerf buildConfig then "RUNTEST_ARGS" =: "--config perf_path=perf" else mempty
    
    898 910
           ]
    
    899 911
     
    
    912
    +    trim :: String -> String
    
    913
    +    trim = dropWhileEnd isSpace . dropWhile isSpace
    
    914
    +
    
    900 915
         -- Keep in sync with the exclude list in `function clean()` in
    
    901 916
         -- `.gitlab/ci.sh`!
    
    902 917
         jobArtifacts = Artifacts
    

  • .gitlab/jobs.yaml
    ... ... @@ -377,6 +377,7 @@
    377 377
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    378 378
           "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    379 379
           "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    380
    +      "CROSS_STAGE": "2",
    
    380 381
           "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    381 382
           "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    382 383
           "HADRIAN_ARGS": "--docs=none",
    
    ... ... @@ -388,7 +389,7 @@
    388 389
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    389 390
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    390 391
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    391
    -      "RUNTEST_ARGS": "",
    
    392
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    392 393
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    393 394
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    394 395
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -458,6 +459,7 @@
    458 459
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    459 460
           "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    460 461
           "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    462
    +      "CROSS_STAGE": "2",
    
    461 463
           "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    462 464
           "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    463 465
           "HADRIAN_ARGS": "--docs=none",
    
    ... ... @@ -469,7 +471,7 @@
    469 471
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    470 472
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    471 473
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    472
    -      "RUNTEST_ARGS": "",
    
    474
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    473 475
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    474 476
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    475 477
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -1046,6 +1048,7 @@
    1046 1048
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    1047 1049
           "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    1048 1050
           "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    1051
    +      "CROSS_STAGE": "2",
    
    1049 1052
           "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    1050 1053
           "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    1051 1054
           "HADRIAN_ARGS": "--docs=none",
    
    ... ... @@ -1057,7 +1060,7 @@
    1057 1060
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    1058 1061
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    1059 1062
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    1060
    -      "RUNTEST_ARGS": "",
    
    1063
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    1061 1064
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    1062 1065
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    1063 1066
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -1128,6 +1131,7 @@
    1128 1131
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    1129 1132
           "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    1130 1133
           "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    1134
    +      "CROSS_STAGE": "2",
    
    1131 1135
           "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    1132 1136
           "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    1133 1137
           "HADRIAN_ARGS": "--docs=none",
    
    ... ... @@ -1139,7 +1143,7 @@
    1139 1143
           "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    1140 1144
           "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    1141 1145
           "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    1142
    -      "RUNTEST_ARGS": "",
    
    1146
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    1143 1147
           "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    1144 1148
           "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    1145 1149
           "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    ... ... @@ -1723,6 +1727,7 @@
    1723 1727
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    1724 1728
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    1725 1729
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    1730
    +      "CROSS_STAGE": "2",
    
    1726 1731
           "CROSS_TARGET": "wasm32-wasi",
    
    1727 1732
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    1728 1733
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    ... ... @@ -1788,6 +1793,7 @@
    1788 1793
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    1789 1794
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    1790 1795
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    1796
    +      "CROSS_STAGE": "2",
    
    1791 1797
           "CROSS_TARGET": "wasm32-wasi",
    
    1792 1798
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    1793 1799
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    ... ... @@ -1853,6 +1859,7 @@
    1853 1859
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    1854 1860
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    1855 1861
           "CONFIGURE_ARGS": "--enable-unregisterised --with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    1862
    +      "CROSS_STAGE": "2",
    
    1856 1863
           "CROSS_TARGET": "wasm32-wasi",
    
    1857 1864
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    1858 1865
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    ... ... @@ -2045,9 +2052,10 @@
    2045 2052
           "BUILD_FLAVOUR": "validate",
    
    2046 2053
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    2047 2054
           "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu",
    
    2055
    +      "CROSS_STAGE": "2",
    
    2048 2056
           "CROSS_TARGET": "aarch64-linux-gnu",
    
    2049 2057
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2050
    -      "RUNTEST_ARGS": "",
    
    2058
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    2051 2059
           "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate",
    
    2052 2060
           "XZ_OPT": "-9"
    
    2053 2061
         }
    
    ... ... @@ -2111,6 +2119,7 @@
    2111 2119
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    2112 2120
           "CONFIGURE_WRAPPER": "emconfigure",
    
    2113 2121
           "CROSS_EMULATOR": "js-emulator",
    
    2122
    +      "CROSS_STAGE": "2",
    
    2114 2123
           "CROSS_TARGET": "javascript-unknown-ghcjs",
    
    2115 2124
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2116 2125
           "RUNTEST_ARGS": "",
    
    ... ... @@ -2492,9 +2501,10 @@
    2492 2501
           "BUILD_FLAVOUR": "validate",
    
    2493 2502
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    2494 2503
           "CROSS_EMULATOR": "qemu-riscv64 -L /usr/riscv64-linux-gnu",
    
    2504
    +      "CROSS_STAGE": "2",
    
    2495 2505
           "CROSS_TARGET": "riscv64-linux-gnu",
    
    2496 2506
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2497
    -      "RUNTEST_ARGS": "",
    
    2507
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    2498 2508
           "TEST_ENV": "x86_64-linux-deb12-riscv-cross_riscv64-linux-gnu-validate",
    
    2499 2509
           "XZ_OPT": "-9"
    
    2500 2510
         }
    
    ... ... @@ -3570,9 +3580,10 @@
    3570 3580
           "BUILD_FLAVOUR": "validate",
    
    3571 3581
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    3572 3582
           "CROSS_EMULATOR": "qemu-loongarch64 -L /usr/loongarch64-linux-gnu",
    
    3583
    +      "CROSS_STAGE": "2",
    
    3573 3584
           "CROSS_TARGET": "loongarch64-linux-gnu",
    
    3574 3585
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    3575
    -      "RUNTEST_ARGS": "",
    
    3586
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    3576 3587
           "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate",
    
    3577 3588
           "XZ_OPT": "-9"
    
    3578 3589
         }
    
    ... ... @@ -5894,6 +5905,7 @@
    5894 5905
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    5895 5906
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    5896 5907
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    5908
    +      "CROSS_STAGE": "2",
    
    5897 5909
           "CROSS_TARGET": "wasm32-wasi",
    
    5898 5910
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    5899 5911
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    ... ... @@ -5959,6 +5971,7 @@
    5959 5971
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    5960 5972
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    5961 5973
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    5974
    +      "CROSS_STAGE": "2",
    
    5962 5975
           "CROSS_TARGET": "wasm32-wasi",
    
    5963 5976
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    5964 5977
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    ... ... @@ -6024,6 +6037,7 @@
    6024 6037
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    6025 6038
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    6026 6039
           "CONFIGURE_ARGS": "--enable-unregisterised --with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    6040
    +      "CROSS_STAGE": "2",
    
    6027 6041
           "CROSS_TARGET": "wasm32-wasi",
    
    6028 6042
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    6029 6043
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    ... ... @@ -6213,9 +6227,10 @@
    6213 6227
           "BUILD_FLAVOUR": "validate",
    
    6214 6228
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    6215 6229
           "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu",
    
    6230
    +      "CROSS_STAGE": "2",
    
    6216 6231
           "CROSS_TARGET": "aarch64-linux-gnu",
    
    6217 6232
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    6218
    -      "RUNTEST_ARGS": "",
    
    6233
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    6219 6234
           "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate"
    
    6220 6235
         }
    
    6221 6236
       },
    
    ... ... @@ -6278,6 +6293,7 @@
    6278 6293
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    6279 6294
           "CONFIGURE_WRAPPER": "emconfigure",
    
    6280 6295
           "CROSS_EMULATOR": "js-emulator",
    
    6296
    +      "CROSS_STAGE": "2",
    
    6281 6297
           "CROSS_TARGET": "javascript-unknown-ghcjs",
    
    6282 6298
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    6283 6299
           "RUNTEST_ARGS": "",
    
    ... ... @@ -6654,9 +6670,10 @@
    6654 6670
           "BUILD_FLAVOUR": "validate",
    
    6655 6671
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    6656 6672
           "CROSS_EMULATOR": "qemu-riscv64 -L /usr/riscv64-linux-gnu",
    
    6673
    +      "CROSS_STAGE": "2",
    
    6657 6674
           "CROSS_TARGET": "riscv64-linux-gnu",
    
    6658 6675
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    6659
    -      "RUNTEST_ARGS": "",
    
    6676
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    6660 6677
           "TEST_ENV": "x86_64-linux-deb12-riscv-cross_riscv64-linux-gnu-validate"
    
    6661 6678
         }
    
    6662 6679
       },
    
    ... ... @@ -7716,9 +7733,10 @@
    7716 7733
           "BUILD_FLAVOUR": "validate",
    
    7717 7734
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    7718 7735
           "CROSS_EMULATOR": "qemu-loongarch64 -L /usr/loongarch64-linux-gnu",
    
    7736
    +      "CROSS_STAGE": "2",
    
    7719 7737
           "CROSS_TARGET": "loongarch64-linux-gnu",
    
    7720 7738
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7721
    -      "RUNTEST_ARGS": "",
    
    7739
    +      "RUNTEST_ARGS": "-e config.timeout=900",
    
    7722 7740
           "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate"
    
    7723 7741
         }
    
    7724 7742
       },
    

  • 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/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
    

  • hadrian/src/Rules/Register.hs
    ... ... @@ -7,7 +7,6 @@ module Rules.Register (
    7 7
     import Base
    
    8 8
     import Context
    
    9 9
     import Expression ( getContextData )
    
    10
    -import Flavour
    
    11 10
     import Oracles.Setting
    
    12 11
     import Hadrian.BuildPath
    
    13 12
     import Hadrian.Expression
    
    ... ... @@ -52,14 +51,6 @@ configurePackageRules = do
    52 51
               isGmp <- (== "gmp") <$> interpretInContext ctx getBignumBackend
    
    53 52
               when isGmp $
    
    54 53
                 need [buildP -/- "include/ghc-gmp.h"]
    
    55
    -        when (pkg == text) $ do
    
    56
    -          simdutf <- textWithSIMDUTF <$> flavour
    
    57
    -          when simdutf $ do
    
    58
    -            -- This is required, otherwise you get Error: hadrian:
    
    59
    -            -- Encountered missing or private dependencies:
    
    60
    -            -- system-cxx-std-lib ==1.0
    
    61
    -            cxxStdLib <- systemCxxStdLibConfPath $ PackageDbLoc stage Inplace
    
    62
    -            need [cxxStdLib]
    
    63 54
             Cabal.configurePackage ctx
    
    64 55
     
    
    65 56
         root -/- "**/autogen/cabal_macros.h" %> \out -> do
    
    ... ... @@ -114,6 +105,12 @@ registerPackageRules rs stage iplace = do
    114 105
                 target (Context stage compiler vanilla iplace) (GhcPkg Recache stage) [] []
    
    115 106
             writeFileLines stamp []
    
    116 107
     
    
    108
    +    -- Special rule for registering system-cxx-std-lib
    
    109
    +    root -/- relativePackageDbPath (PackageDbLoc stage iplace) -/- systemCxxStdLibConf %> \file -> do
    
    110
    +        copyFile ("mk" -/- "system-cxx-std-lib-1.0.conf") file
    
    111
    +        buildWithResources rs $
    
    112
    +            target (Context stage compiler vanilla iplace) (GhcPkg Recache stage) [] []
    
    113
    +
    
    117 114
         -- Register a package.
    
    118 115
         root -/- relativePackageDbPath (PackageDbLoc stage iplace) -/- "*.conf" %> \conf -> do
    
    119 116
             historyDisable
    

  • hadrian/src/Settings/Packages.hs
    ... ... @@ -88,11 +88,10 @@ packageArgs = do
    88 88
                 -- 1. ghcWithInterpreter must be True ("Use interpreter" =
    
    89 89
                 --    "YES")
    
    90 90
                 -- 2. For non-cross case it can be enabled
    
    91
    -            -- 3. For cross case, disable for stage0 since that runs
    
    92
    -            --    on the host and must rely on external interpreter to
    
    93
    -            --    load target code, otherwise enable for stage1 since
    
    94
    -            --    that runs on the target and can use target's own
    
    95
    -            --    ghci object linker
    
    91
    +            -- 3. For cross case, disable for stage0 and stage1 since these run
    
    92
    +            --    on the host and must rely on external interpreter to load
    
    93
    +            --    target code, otherwise enable for stage2 since that runs on
    
    94
    +            --    the target and can use target's own ghci object linker
    
    96 95
                 [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage2]] `cabalFlag` "internal-interpreter"
    
    97 96
                 , orM [ notM cross, haveCurses ]  `cabalFlag` "terminfo"
    
    98 97
                 , arg "-build-tool-depends"
    
    ... ... @@ -115,7 +114,8 @@ packageArgs = do
    115 114
                  , compilerStageOption ghcDebugAssertions ? arg "-DDEBUG" ]
    
    116 115
     
    
    117 116
               , builder (Cabal Flags) ? mconcat
    
    118
    -            [ (expr (ghcWithInterpreter stage)) `cabalFlag` "internal-interpreter"
    
    117
    +            [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage1]] `cabalFlag` "interpreter"
    
    118
    +            , andM [expr (ghcWithInterpreter stage), notM (expr cross)] `cabalFlag` "internal-interpreter"
    
    119 119
                 , ifM stage0
    
    120 120
                       -- We build a threaded stage 1 if the bootstrapping compiler
    
    121 121
                       -- supports it.