[Git][ghc/ghc][ghc-9.6] 16 commits: Bump hsc2hs submodule

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Jan 26 04:00:48 UTC 2023



Ben Gamari pushed to branch ghc-9.6 at Glasgow Haskell Compiler / GHC


Commits:
db682cb1 by Cheng Shao at 2023-01-25T11:22:52+00:00
Bump hsc2hs submodule

(cherry picked from commit 1142f858d761afc4d09923d52a2aaacf1a8c8679)

- - - - -
bf9d21cf by Cheng Shao at 2023-01-25T11:23:07+00:00
Bump process submodule

(cherry picked from commit d46867297de5f7f26963ed819949a876737d462f)

- - - - -
1768ca30 by Cheng Shao at 2023-01-25T11:25:19+00:00
ci: Bump DOCKER_REV

(cherry picked from commit 84ae657307380d50786206ce0f2b95498a06ed27)

- - - - -
a684181f by Cheng Shao at 2023-01-25T11:25:33+00:00
ci: enable xz parallel compression for x64 jobs

(cherry picked from commit d53598c5b71521d6706fc0f4b5713110195d5578)

- - - - -
75b01e54 by Cheng Shao at 2023-01-25T11:25:41+00:00
ci: use in-image emsdk for js jobs

(cherry picked from commit d31fcbca6cf4bc166904cfd25696503401ad631d)

- - - - -
a38079b5 by Cheng Shao at 2023-01-25T11:25:49+00:00
ci: improve nix-shell for gen_ci.hs and fix some ghc/hlint warnings

- Add a ghc environment including prebuilt dependencies to the
  nix-shell. Get rid of the ad hoc cabal cache and all dependencies
  are now downloaded from the nixos binary cache.
- Make gen_ci.hs a cabal package with HLS integration, to make future
  hacking of gen_ci.hs easier.
- Fix some ghc/hlint warnings after I got HLS to work.
- For the lint-ci-config job, do a shallow clone to save a few minutes
  of unnecessary git checkout time.

(cherry picked from commit 93b9bbc177ca848bc80dc23aea3571c42d640192)

- - - - -
8a79d2a3 by Cheng Shao at 2023-01-25T11:25:59+00:00
ci: source the toolchain env file in wasm jobs

(cherry picked from commit 8acc56c79d21d33fceed9d094fbb1702c3f7cb01)

- - - - -
02fe30d2 by Cheng Shao at 2023-01-25T11:28:40+00:00
ci: add wasm ci jobs via gen_ci.hs

- There is one regular wasm job run in validate pipelines
- Additionally, int-native/unreg wasm jobs run in nightly/release pipelines

Also, remove the legacy handwritten wasm ci jobs in .gitlab-ci.yml.

(cherry picked from commit 87194df0984a85acb3726ed5c69cfae89af56b85)

- - - - -
99d1829e by Matthew Pickering at 2023-01-25T11:46:08+00:00
wasm ci: Remove wasm release jobs

This removes the wasm release jobs, as we do not yet intend to
distribute these binaries.

(cherry picked from commit b6eb9bccd56a11b5e8c208bb5490309317fd5275)

- - - - -
c7cd0f11 by Cheng Shao at 2023-01-25T11:46:08+00:00
Fix typo in recent darwin tests fix

Corrects a typo in !9647. Otherwise T18623 will still fail on darwin
and stall other people's work.

(cherry picked from commit c45a5fffef2c76efbf5d3a009c3f6d0244a63f0d)

- - - - -
19ed3dc9 by Cheng Shao at 2023-01-25T11:46:08+00:00
hadrian: add hi_core flavour transformer

The hi_core flavour transformer enables -fwrite-if-simplified-core for
stage1 libraries, which emit core into interface files to make it
possible to restart code generation. Building boot libs with it makes
it easier to use GHC API to prototype experimental backends that needs
core/stg at link time.

(cherry picked from commit 1fe806d33b7ef5615bec47bacc76a9e84963dd54)

- - - - -
cfb33584 by Cheng Shao at 2023-01-25T11:46:08+00:00
hadrian: add missing docs for recently added flavour transformers

(cherry picked from commit 317cad26585f0e91c8e3bd41ddbc3444b642b16b)

- - - - -
52966198 by Cheng Shao at 2023-01-25T11:46:08+00:00
hadrian: disable alloca for in-tree GMP on wasm32

When building in-tree GMP for wasm32, disable its alloca usage, since
it may potentially cause stack overflow (e.g. #22602).

(cherry picked from commit 0900b58432c0e42263c62b0e151b0268129a290a)

- - - - -
b8f2090a by Cheng Shao at 2023-01-25T11:46:08+00:00
Bump process submodule

Includes a critical fix for wasm32, see
https://github.com/haskell/process/pull/272 for details. Also changes
the existing cross test to include process stuff and avoid future
regression here.

(cherry picked from commit db0f1bfd0cada59d8a8673e98fc40e8b9c11a9c5)

- - - - -
9194c9c0 by Cheng Shao at 2023-01-25T11:46:08+00:00
CmmToC: fix CmmRegOff for 64-bit register on a 32-bit target

We used to print the offset value to a platform word sized integer.
This is incorrect when the offset is negative (e.g. output of cmm
constant folding) and the register is 64-bit but on a 32-bit target,
and may lead to incorrect runtime result (e.g. #22607).

The fix is simple: just treat it as a proper MO_Add, with the correct
width info inferred from the register itself.

Metric Increase:
    T12707
    T13379
    T4801
    T5321FD
    T5321Fun

(cherry picked from commit d151546e59a50158f25c3df6728b00d3c27bb4b9)

- - - - -
b9bbcff4 by Cheng Shao at 2023-01-25T11:46:08+00:00
compiler: fix handling of MO_F_Neg in wasm NCG

In the wasm NCG, we used to compile MO_F_Neg to 0.0-x. It was an
oversight, there actually exists f32.neg/f64.neg opcodes in the wasm
spec and those should be used instead! The old behavior almost works,
expect when GHC compiles the -0.0 literal, which will incorrectly
become 0.0.

(cherry picked from commit bc038c3bd45ee99db9fba23a823a906735740200)

- - - - -


18 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- + .gitlab/gen-ci.cabal
- .gitlab/gen_ci.hs
- .gitlab/generate_jobs
- .gitlab/hello.hs
- + .gitlab/hie.yaml
- .gitlab/jobs.yaml
- compiler/GHC/CmmToAsm/Wasm/Asm.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/Wasm/Types.hs
- compiler/GHC/CmmToC.hs
- hadrian/doc/flavours.md
- hadrian/src/Flavour.hs
- hadrian/src/Settings/Builders/Configure.hs
- libraries/process
- testsuite/tests/rts/T18623/all.T
- utils/hsc2hs


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -2,7 +2,7 @@ variables:
   GIT_SSL_NO_VERIFY: "1"
 
   # Commit of ghc/ci-images repository from which to pull Docker images
-  DOCKER_REV: 0de79b7676de197f5d4b79f22a8220a7d563a427
+  DOCKER_REV: dd01591a50ea4e2aa3c106cf50ca54d38663f912
 
   # Sequential version number of all cached things.
   # Bump to invalidate GitLab CI cache.
@@ -262,26 +262,20 @@ lint-author:
     - *drafts-can-fail-lint
 
 lint-ci-config:
-  image: "nixos/nix:2.8.0"
+  image: nixos/nix:2.12.0
   extends: .lint
+  # We don't need history/submodules in this job
   variables:
-    BUILD_FLAVOUR: default
+    GIT_DEPTH: 1
+    GIT_SUBMODULE_STRATEGY: none
   before_script:
-    - mkdir -p ~/.cabal
-    - cp -Rf cabal-cache/* ~/.cabal || true
+    - echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
+    - nix-channel --update
   script:
-    - nix shell --extra-experimental-features nix-command --extra-experimental-features flakes nixpkgs#cabal-install nixpkgs#ghc -c cabal update
     - .gitlab/generate_jobs
-        # 1 if .gitlab/generate_jobs changed the output of the generated config
-    - nix shell --extra-experimental-features nix-command --extra-experimental-features flakes nixpkgs#git -c git diff --exit-code
-  after_script:
-    - rm -Rf cabal-cache
-    - cp -Rf ~/.cabal cabal-cache
+    # 1 if .gitlab/generate_jobs changed the output of the generated config
+    - nix shell nixpkgs#git -c git diff --exit-code
   dependencies: []
-  cache:
-    key: lint-ci-$CACHE_REV
-    paths:
-      - cabal-cache
 
 lint-submods:
   extends: .lint-submods
@@ -542,8 +536,6 @@ doc-tarball:
 hackage-doc-tarball:
   stage: packaging
   needs:
-    - job: x86_64-linux-fedora33-release-hackage
-      optional: true
     - job: nightly-x86_64-linux-fedora33-release-hackage
       optional: true
     - job: release-x86_64-linux-fedora33-release-hackage
@@ -946,63 +938,3 @@ pages:
   artifacts:
     paths:
       - public
-
-.x86_64-linux-ubuntu20_04-cross_wasm32-wasi-release:
-  stage: full-build
-  rules:
-    - when: always
-  tags:
-    - x86_64-linux
-  image: registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-ubuntu20_04:$DOCKER_REV
-  before_script:
-    - sudo chown ghc:ghc -R .
-  variables:
-    BIN_DIST_NAME: ghc-x86_64-linux-ubuntu20_04-cross_wasm32-wasi-int_$BIGNUM_BACKEND-release
-    BUILD_FLAVOUR: perf
-    CONFIGURE_ARGS: --with-intree-gmp --with-system-libffi
-    XZ_OPT: "-9"
-    CONF_CC_OPTS_STAGE2: -Wno-int-conversion -Wno-strict-prototypes -mnontrapping-fptoint -msign-ext -mbulk-memory -mmutable-globals -mreference-types
-    CONF_CXX_OPTS_STAGE2: -fno-exceptions -Wno-int-conversion -Wno-strict-prototypes -mnontrapping-fptoint -msign-ext -mbulk-memory -mmutable-globals -mreference-types
-    CONF_GCC_LINKER_OPTS_STAGE2: -Wl,--error-limit=0,--growable-table,--stack-first -Wno-unused-command-line-argument
-    CROSS_EMULATOR: wasmtime
-    CROSS_TARGET: wasm32-wasi
-    HADRIAN_ARGS: --docs=none
-    TEST_ENV: x86_64-linux-ubuntu20_04-cross_wasm32-wasi-int_$BIGNUM_BACKEND-release
-  script:
-    - |
-      pushd libraries/process
-      curl https://patch-diff.githubusercontent.com/raw/haskell/process/pull/240.diff | git apply
-      popd
-      pushd utils/hsc2hs
-      curl https://patch-diff.githubusercontent.com/raw/haskell/hsc2hs/pull/68.diff | git apply
-      popd
-
-      pushd "$(mktemp -d)"
-      curl -L https://gitlab.haskell.org/ghc/ghc-wasm-meta/-/archive/master/ghc-wasm-meta-master.tar.gz | tar xz --strip-components=1
-      PREFIX=/tmp/.ghc-wasm SKIP_GHC=1 ./setup.sh
-      source /tmp/.ghc-wasm/env
-      popd
-
-      .gitlab/ci.sh setup
-      .gitlab/ci.sh configure
-      .gitlab/ci.sh build_hadrian
-      .gitlab/ci.sh test_hadrian
-
-  after_script:
-    - cat ci-timings
-
-  artifacts:
-    expire_in: 1 year
-    paths:
-      - ghc-x86_64-linux-ubuntu20_04-cross_wasm32-wasi-int_$BIGNUM_BACKEND-release.tar.xz
-    when: always
-
-x86_64-linux-ubuntu20_04-cross_wasm32-wasi-int_gmp-release:
-  extends: .x86_64-linux-ubuntu20_04-cross_wasm32-wasi-release
-  variables:
-    BIGNUM_BACKEND: gmp
-
-x86_64-linux-ubuntu20_04-cross_wasm32-wasi-int_native-release:
-  extends: .x86_64-linux-ubuntu20_04-cross_wasm32-wasi-release
-  variables:
-    BIGNUM_BACKEND: native


=====================================
.gitlab/ci.sh
=====================================
@@ -237,6 +237,10 @@ function set_toolchain_paths() {
   export CABAL
   export HAPPY
   export ALEX
+
+  if [[ "${CROSS_TARGET:-}" == *"wasm"* ]]; then
+    source "/home/ghc/.ghc-wasm/env"
+  fi
 }
 
 function cabal_update() {
@@ -256,11 +260,6 @@ function setup() {
       cp -Rf "$CABAL_CACHE"/* "$CABAL_DIR"
   fi
 
-  case "${CONFIGURE_WRAPPER:-}" in
-    emconfigure) time_it "setup" setup_emscripten ;;
-    *) ;;
-  esac
-
   case $toolchain_source in
     extracted) time_it "setup" setup_toolchain ;;
     *) ;;
@@ -377,14 +376,6 @@ function setup_toolchain() {
   $cabal_install alex --constraint="alex>=$MIN_ALEX_VERSION"
 }
 
-function setup_emscripten() {
-  git clone https://github.com/emscripten-core/emsdk.git
-  cd emsdk
-  ./emsdk install latest
-  ./emsdk activate latest
-  cd ..
-}
-
 function cleanup_submodules() {
   start_section "clean submodules"
   if [ -d .git ]; then
@@ -423,7 +414,7 @@ EOF
 
 function configure() {
   case "${CONFIGURE_WRAPPER:-}" in
-    emconfigure) source emsdk/emsdk_env.sh ;;
+    emconfigure) source "$EMSDK/emsdk_env.sh" ;;
     *) ;;
   esac
 
@@ -521,6 +512,13 @@ function build_hadrian() {
 
   check_release_build
 
+  # We can safely enable parallel compression for x64. By the time
+  # hadrian calls tar/xz to produce bindist, there's no other build
+  # work taking place.
+  if [[ "${CI_JOB_NAME:-}" != *"i386"* ]]; then
+    XZ_OPT="${XZ_OPT:-} -T$cores"
+  fi
+
   if [[ -n "${REINSTALL_GHC:-}" ]]; then
     run_hadrian build-cabal -V
   else
@@ -554,7 +552,7 @@ function make_install_destdir() {
 # install the binary distribution in directory $1 to $2.
 function install_bindist() {
   case "${CONFIGURE_WRAPPER:-}" in
-    emconfigure) source emsdk/emsdk_env.sh ;;
+    emconfigure) source "$EMSDK/emsdk_env.sh" ;;
     *) ;;
   esac
 


=====================================
.gitlab/gen-ci.cabal
=====================================
@@ -0,0 +1,18 @@
+cabal-version: 3.0
+name:          gen-ci
+version:       0.1.0.0
+build-type:    Simple
+
+common warnings
+  ghc-options: -Wall
+
+executable gen_ci
+  import:           warnings
+  main-is:          gen_ci.hs
+  build-depends:
+    , aeson       >=1.8.1
+    , base
+    , bytestring
+    , containers
+
+  default-language: Haskell2010


=====================================
.gitlab/gen_ci.hs
=====================================
@@ -7,12 +7,11 @@
 build-depends: base, aeson >= 1.8.1, containers, bytestring
 -}
 
-import Data.Coerce
-import Data.String (String)
 import Data.Aeson as A
 import qualified Data.Map as Map
 import Data.Map (Map)
-import qualified Data.ByteString.Lazy as B hiding (putStrLn)
+import Data.Maybe
+import qualified Data.ByteString.Lazy as B
 import qualified Data.ByteString.Lazy.Char8 as B
 import Data.List (intercalate)
 import Data.Set (Set)
@@ -135,10 +134,11 @@ data BuildConfig
 
 -- Extra arguments to pass to ./configure due to the BuildConfig
 configureArgsStr :: BuildConfig -> String
-configureArgsStr bc = intercalate " " $
+configureArgsStr bc = unwords $
   ["--enable-unregisterised"| unregisterised bc ]
   ++ ["--disable-tables-next-to-code" | not (tablesNextToCode bc) ]
   ++ ["--with-intree-gmp" | Just _ <- pure (crossTarget bc) ]
+  ++ ["--with-system-libffi" | crossTarget bc == Just "wasm32-wasi" ]
 
 -- Compute the hadrian flavour from the BuildConfig
 mkJobFlavour :: BuildConfig -> Flavour
@@ -232,7 +232,7 @@ noTntc = vanilla { tablesNextToCode = False }
 
 -- | These tags have to match what we call the runners on gitlab
 runnerTag :: Arch -> Opsys -> String
-runnerTag arch (Linux distro) =
+runnerTag arch (Linux _) =
   case arch of
     Amd64   -> "x86_64-linux"
     AArch64 -> "aarch64-linux"
@@ -241,6 +241,7 @@ runnerTag AArch64 Darwin = "aarch64-darwin"
 runnerTag Amd64 Darwin = "x86_64-darwin-m1"
 runnerTag Amd64 Windows = "new-x86_64-windows"
 runnerTag Amd64 FreeBSD13 = "x86_64-freebsd13"
+runnerTag _ _ = error "Invalid arch/opsys"
 
 tags :: Arch -> Opsys -> BuildConfig -> [String]
 tags arch opsys _bc = [runnerTag arch opsys] -- Tag for which runners we can use
@@ -324,14 +325,14 @@ dockerImage _ _ = Nothing
 -- The "proper" solution would be to use a dependent monoidal map where each key specifies
 -- the combination behaviour of it's values. Ie, whether setting it multiple times is an error
 -- or they should be combined.
-newtype MonoidalMap k v = MonoidalMap (Map k v)
+newtype MonoidalMap k v = MonoidalMap { unMonoidalMap :: Map k v }
     deriving (Eq, Show, Functor, ToJSON)
 
 instance (Ord k, Semigroup v) => Semigroup (MonoidalMap k v) where
     (MonoidalMap a) <> (MonoidalMap b) = MonoidalMap (Map.unionWith (<>) a b)
 
 instance (Ord k, Semigroup v) => Monoid (MonoidalMap k v) where
-    mempty = MonoidalMap (Map.empty)
+    mempty = MonoidalMap Map.empty
 
 mminsertWith :: Ord k => (a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
 mminsertWith f k v (MonoidalMap m) = MonoidalMap (Map.insertWith f k v m)
@@ -498,13 +499,13 @@ instance ToJSON ManualFlag where
   toJSON OnSuccess = "on_success"
 
 instance ToJSON OnOffRules where
-  toJSON rules = toJSON [(object ([
+  toJSON rules = toJSON [object ([
     "if" A..= and_all (map one_rule (enumRules rules))
     , "when" A..= toJSON (when rules)]
     -- Necessary to stop manual jobs stopping pipeline progress
     -- https://docs.gitlab.com/ee/ci/yaml/#rulesallow_failure
     ++
-    ["allow_failure" A..= True | when rules == Manual ]))]
+    ["allow_failure" A..= True | when rules == Manual ])]
 
     where
       one_rule (OnOffRule onoff r) = ruleString onoff r
@@ -580,7 +581,7 @@ instance ToJSON Job where
     , "allow_failure" A..= jobAllowFailure
     -- Joining up variables like this may well be the wrong thing to do but
     -- at least it doesn't lose information silently by overriding.
-    , "variables" A..= fmap (intercalate " ") jobVariables
+    , "variables" A..= fmap unwords jobVariables
     , "artifacts" A..= jobArtifacts
     , "cache" A..= jobCache
     , "after_script" A..= jobAfterScript
@@ -608,6 +609,7 @@ job arch opsys buildConfig = (jobName, Job {..})
         , "bash .gitlab/ci.sh test_hadrian" ]
       | otherwise
       = [ "find libraries -name config.sub -exec cp config.sub {} \\;" | Darwin == opsys ] ++
+        [ "sudo apk del --purge glibc*" | opsys == Linux Alpine, isNothing $ crossTarget buildConfig ] ++
         [ "sudo chown ghc:ghc -R ." | Linux {} <- [opsys]] ++
         [ ".gitlab/ci.sh setup"
         , ".gitlab/ci.sh configure"
@@ -677,11 +679,11 @@ job arch opsys buildConfig = (jobName, Job {..})
 
 -- | Modify all jobs in a 'JobGroup'
 modifyJobs :: (a -> a) -> JobGroup a -> JobGroup a
-modifyJobs f = fmap f
+modifyJobs = fmap
 
 -- | Modify just the validate jobs in a 'JobGroup'
 modifyValidateJobs :: (a -> a) -> JobGroup a -> JobGroup a
-modifyValidateJobs f jg = jg { v = f <$> (v jg) }
+modifyValidateJobs f jg = jg { v = f <$> v jg }
 
 -- Generic helpers
 
@@ -691,19 +693,26 @@ addJobRule r j = j { jobRules = enableRule r (jobRules j) }
 addVariable :: String -> String -> Job -> Job
 addVariable k v j = j { jobVariables = mminsertWith (++) k [v] (jobVariables j) }
 
+setVariable :: String -> String -> Job -> Job
+setVariable k v j = j { jobVariables = MonoidalMap $ Map.insert k [v] $ unMonoidalMap $ jobVariables j }
+
+delVariable :: String -> Job -> Job
+delVariable k j = j { jobVariables = MonoidalMap $ Map.delete k $ unMonoidalMap $ jobVariables j }
+
 -- Building the standard jobs
 --
 -- | Make a normal validate CI job
 validate :: Arch -> Opsys -> BuildConfig -> (String, Job)
-validate arch opsys bc =
-  job arch opsys bc
+validate = job
 
 -- | Make a normal nightly CI job
+nightly :: Arch -> Opsys -> BuildConfig -> ([Char], Job)
 nightly arch opsys bc =
   let (n, j) = job arch opsys bc
   in ("nightly-" ++ n, addJobRule Nightly . keepArtifacts "8 weeks" . highCompression $ j)
 
 -- | Make a normal release CI job
+release :: Arch -> Opsys -> BuildConfig -> ([Char], Job)
 release arch opsys bc =
   let (n, j) = job arch opsys (bc { buildFlavour = Release })
   in ("release-" ++ n, addJobRule ReleaseOnly . keepArtifacts "1 year" . ignorePerfFailures . highCompression $ j)
@@ -786,10 +795,10 @@ flattenJobGroup (ValidateOnly a b) = [a, b]
 
 -- | Specification for all the jobs we want to build.
 jobs :: Map String Job
-jobs = Map.fromList $ concatMap flattenJobGroup $
+jobs = Map.fromList $ concatMap (filter is_enabled_job . flattenJobGroup)
      [ disableValidate (standardBuilds Amd64 (Linux Debian10))
-     , (standardBuildsWithConfig Amd64 (Linux Debian10) dwarf)
-     , (validateBuilds Amd64 (Linux Debian10) nativeInt)
+     , standardBuildsWithConfig Amd64 (Linux Debian10) dwarf
+     , validateBuilds Amd64 (Linux Debian10) nativeInt
      , fastCI (validateBuilds Amd64 (Linux Debian10) unreg)
      , fastCI (validateBuilds Amd64 (Linux Debian10) debug)
      , modifyValidateJobs manual tsan_jobs
@@ -804,7 +813,7 @@ jobs = Map.fromList $ concatMap flattenJobGroup $
      , disableValidate (standardBuildsWithConfig Amd64 (Linux Centos7) (splitSectionsBroken vanilla))
      -- Fedora33 job is always built with perf so there's one job in the normal
      -- validate pipeline which is built with perf.
-     , (standardBuildsWithConfig Amd64 (Linux Fedora33) releaseConfig)
+     , standardBuildsWithConfig Amd64 (Linux Fedora33) releaseConfig
      -- This job is only for generating head.hackage docs
      , hackage_doc_job (disableValidate (standardBuildsWithConfig Amd64 (Linux Fedora33) releaseConfig))
      , disableValidate (standardBuildsWithConfig Amd64 (Linux Fedora33) dwarf)
@@ -822,9 +831,14 @@ jobs = Map.fromList $ concatMap flattenJobGroup $
         )
         { bignumBackend = Native
         }
+     , make_wasm_jobs wasm_build_config
+     , disableValidate $ make_wasm_jobs wasm_build_config { bignumBackend = Native }
+     , disableValidate $ make_wasm_jobs wasm_build_config { unregisterised = True }
      ]
 
   where
+    is_enabled_job (_, Job {jobRules = OnOffRules {..}}) = not $ Disable `S.member` rule_set
+
     hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-base-url")
 
     tsan_jobs =
@@ -835,6 +849,22 @@ jobs = Map.fromList $ concatMap flattenJobGroup $
         . addVariable "HADRIAN_ARGS" "--docs=none") $
       validateBuilds Amd64 (Linux Debian10) tsan
 
+    make_wasm_jobs cfg =
+      modifyJobs
+        ( delVariable "BROKEN_TESTS"
+            . setVariable "HADRIAN_ARGS" "--docs=none"
+            . delVariable "INSTALL_CONFIGURE_ARGS"
+        )
+        $ validateBuilds Amd64 (Linux Alpine) cfg
+
+    wasm_build_config =
+      (crossConfig "wasm32-wasi" NoEmulatorNeeded Nothing)
+        {
+          fullyStatic = True
+          , buildFlavour     = Release -- TODO: This needs to be validate but wasm backend doesn't pass yet
+        }
+
+main :: IO ()
 main = do
   as <- getArgs
   (case as of


=====================================
.gitlab/generate_jobs
=====================================
@@ -1,9 +1,13 @@
-#! /usr/bin/env nix-shell
-#! nix-shell -i bash -p cabal-install ghc jq
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p cabal-install "haskell.packages.ghc924.ghcWithPackages (pkgs: with pkgs; [aeson])" git jq
+
+# shellcheck shell=bash
+
+set -euo pipefail
 
 cd "$(dirname "${BASH_SOURCE[0]}")"
 tmp=$(mktemp)
-./gen_ci.hs $tmp
+cabal run gen_ci -- $tmp
 rm -f jobs.yaml
 echo "### THIS IS A GENERATED FILE, DO NOT MODIFY DIRECTLY" > jobs.yaml
 cat $tmp | jq | tee -a jobs.yaml


=====================================
.gitlab/hello.hs
=====================================
@@ -1,4 +1,4 @@
-{-# OPTIONS_GHC -Wno-missing-fields #-}
+{-# OPTIONS_GHC -Wall -Wno-missing-fields #-}
 
 import GHC hiding (parseModule)
 import GHC.Data.StringBuffer
@@ -9,6 +9,7 @@ import GHC.Platform
 import GHC.Plugins
 import GHC.Settings
 import GHC.Settings.Config
+import System.Mem.Weak
 
 fakeSettings :: Settings
 fakeSettings =
@@ -41,5 +42,6 @@ parse dflags src = do
 
 main :: IO ()
 main = do
+  _ <- mkWeak runGhc runGhc Nothing
   m <- parse fakeDynFlags "main = putStrLn \"hello world\""
   putStrLn $ showSDoc fakeDynFlags $ ppr m


=====================================
.gitlab/hie.yaml
=====================================
@@ -0,0 +1,2 @@
+cradle:
+  cabal:


=====================================
.gitlab/jobs.yaml
=====================================
@@ -485,6 +485,128 @@
       "XZ_OPT": "-9"
     }
   },
+  "nightly-x86_64-linux-alpine3_12-cross_wasm32-wasi-release+fully_static": {
+    "after_script": [
+      ".gitlab/ci.sh save_cache",
+      ".gitlab/ci.sh clean",
+      "cat ci_timings"
+    ],
+    "allow_failure": false,
+    "artifacts": {
+      "expire_in": "8 weeks",
+      "paths": [
+        "ghc-x86_64-linux-alpine3_12-cross_wasm32-wasi-release+fully_static.tar.xz",
+        "junit.xml"
+      ],
+      "reports": {
+        "junit": "junit.xml"
+      },
+      "when": "always"
+    },
+    "cache": {
+      "key": "x86_64-linux-alpine3_12-$CACHE_REV",
+      "paths": [
+        "cabal-cache",
+        "toolchain"
+      ]
+    },
+    "dependencies": [],
+    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV",
+    "needs": [
+      {
+        "artifacts": false,
+        "job": "hadrian-ghc-in-ghci"
+      }
+    ],
+    "rules": [
+      {
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+        "when": "on_success"
+      }
+    ],
+    "script": [
+      "sudo chown ghc:ghc -R .",
+      ".gitlab/ci.sh setup",
+      ".gitlab/ci.sh configure",
+      ".gitlab/ci.sh build_hadrian",
+      ".gitlab/ci.sh test_hadrian"
+    ],
+    "stage": "full-build",
+    "tags": [
+      "x86_64-linux"
+    ],
+    "variables": {
+      "BIGNUM_BACKEND": "gmp",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-cross_wasm32-wasi-release+fully_static",
+      "BUILD_FLAVOUR": "release+fully_static",
+      "CONFIGURE_ARGS": "--disable-ld-override --with-intree-gmp --with-system-libffi",
+      "CROSS_TARGET": "wasm32-wasi",
+      "HADRIAN_ARGS": "--docs=none",
+      "TEST_ENV": "x86_64-linux-alpine3_12-cross_wasm32-wasi-release+fully_static",
+      "XZ_OPT": "-9"
+    }
+  },
+  "nightly-x86_64-linux-alpine3_12-int_native-cross_wasm32-wasi-release+fully_static": {
+    "after_script": [
+      ".gitlab/ci.sh save_cache",
+      ".gitlab/ci.sh clean",
+      "cat ci_timings"
+    ],
+    "allow_failure": false,
+    "artifacts": {
+      "expire_in": "8 weeks",
+      "paths": [
+        "ghc-x86_64-linux-alpine3_12-int_native-cross_wasm32-wasi-release+fully_static.tar.xz",
+        "junit.xml"
+      ],
+      "reports": {
+        "junit": "junit.xml"
+      },
+      "when": "always"
+    },
+    "cache": {
+      "key": "x86_64-linux-alpine3_12-$CACHE_REV",
+      "paths": [
+        "cabal-cache",
+        "toolchain"
+      ]
+    },
+    "dependencies": [],
+    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV",
+    "needs": [
+      {
+        "artifacts": false,
+        "job": "hadrian-ghc-in-ghci"
+      }
+    ],
+    "rules": [
+      {
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+        "when": "on_success"
+      }
+    ],
+    "script": [
+      "sudo chown ghc:ghc -R .",
+      ".gitlab/ci.sh setup",
+      ".gitlab/ci.sh configure",
+      ".gitlab/ci.sh build_hadrian",
+      ".gitlab/ci.sh test_hadrian"
+    ],
+    "stage": "full-build",
+    "tags": [
+      "x86_64-linux"
+    ],
+    "variables": {
+      "BIGNUM_BACKEND": "native",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-int_native-cross_wasm32-wasi-release+fully_static",
+      "BUILD_FLAVOUR": "release+fully_static",
+      "CONFIGURE_ARGS": "--disable-ld-override --with-intree-gmp --with-system-libffi",
+      "CROSS_TARGET": "wasm32-wasi",
+      "HADRIAN_ARGS": "--docs=none",
+      "TEST_ENV": "x86_64-linux-alpine3_12-int_native-cross_wasm32-wasi-release+fully_static",
+      "XZ_OPT": "-9"
+    }
+  },
   "nightly-x86_64-linux-alpine3_12-int_native-validate+fully_static": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
@@ -525,6 +647,7 @@
       }
     ],
     "script": [
+      "sudo apk del --purge glibc*",
       "sudo chown ghc:ghc -R .",
       ".gitlab/ci.sh setup",
       ".gitlab/ci.sh configure",
@@ -547,6 +670,67 @@
       "XZ_OPT": "-9"
     }
   },
+  "nightly-x86_64-linux-alpine3_12-unreg-cross_wasm32-wasi-release+fully_static": {
+    "after_script": [
+      ".gitlab/ci.sh save_cache",
+      ".gitlab/ci.sh clean",
+      "cat ci_timings"
+    ],
+    "allow_failure": false,
+    "artifacts": {
+      "expire_in": "8 weeks",
+      "paths": [
+        "ghc-x86_64-linux-alpine3_12-unreg-cross_wasm32-wasi-release+fully_static.tar.xz",
+        "junit.xml"
+      ],
+      "reports": {
+        "junit": "junit.xml"
+      },
+      "when": "always"
+    },
+    "cache": {
+      "key": "x86_64-linux-alpine3_12-$CACHE_REV",
+      "paths": [
+        "cabal-cache",
+        "toolchain"
+      ]
+    },
+    "dependencies": [],
+    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV",
+    "needs": [
+      {
+        "artifacts": false,
+        "job": "hadrian-ghc-in-ghci"
+      }
+    ],
+    "rules": [
+      {
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+        "when": "on_success"
+      }
+    ],
+    "script": [
+      "sudo chown ghc:ghc -R .",
+      ".gitlab/ci.sh setup",
+      ".gitlab/ci.sh configure",
+      ".gitlab/ci.sh build_hadrian",
+      ".gitlab/ci.sh test_hadrian"
+    ],
+    "stage": "full-build",
+    "tags": [
+      "x86_64-linux"
+    ],
+    "variables": {
+      "BIGNUM_BACKEND": "gmp",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-unreg-cross_wasm32-wasi-release+fully_static",
+      "BUILD_FLAVOUR": "release+fully_static",
+      "CONFIGURE_ARGS": "--disable-ld-override --enable-unregisterised --with-intree-gmp --with-system-libffi",
+      "CROSS_TARGET": "wasm32-wasi",
+      "HADRIAN_ARGS": "--docs=none",
+      "TEST_ENV": "x86_64-linux-alpine3_12-unreg-cross_wasm32-wasi-release+fully_static",
+      "XZ_OPT": "-9"
+    }
+  },
   "nightly-x86_64-linux-alpine3_12-validate+fully_static": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
@@ -587,6 +771,7 @@
       }
     ],
     "script": [
+      "sudo apk del --purge glibc*",
       "sudo chown ghc:ghc -R .",
       ".gitlab/ci.sh setup",
       ".gitlab/ci.sh configure",
@@ -2097,6 +2282,7 @@
       }
     ],
     "script": [
+      "sudo apk del --purge glibc*",
       "sudo chown ghc:ghc -R .",
       ".gitlab/ci.sh setup",
       ".gitlab/ci.sh configure",
@@ -2160,6 +2346,7 @@
       }
     ],
     "script": [
+      "sudo apk del --purge glibc*",
       "sudo chown ghc:ghc -R .",
       ".gitlab/ci.sh setup",
       ".gitlab/ci.sh configure",
@@ -2975,17 +3162,17 @@
       "TEST_ENV": "x86_64-freebsd13-validate"
     }
   },
-  "x86_64-linux-alpine3_12-int_native-validate+fully_static": {
+  "x86_64-linux-alpine3_12-cross_wasm32-wasi-release+fully_static": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
       ".gitlab/ci.sh clean",
       "cat ci_timings"
     ],
-    "allow_failure": true,
+    "allow_failure": false,
     "artifacts": {
       "expire_in": "2 weeks",
       "paths": [
-        "ghc-x86_64-linux-alpine3_12-int_native-validate+fully_static.tar.xz",
+        "ghc-x86_64-linux-alpine3_12-cross_wasm32-wasi-release+fully_static.tar.xz",
         "junit.xml"
       ],
       "reports": {
@@ -3010,7 +3197,7 @@
     ],
     "rules": [
       {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"disabled\" != \"disabled\")",
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
         "when": "on_success"
       }
     ],
@@ -3026,14 +3213,13 @@
       "x86_64-linux"
     ],
     "variables": {
-      "BIGNUM_BACKEND": "native",
-      "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-int_native-validate+fully_static",
-      "BROKEN_TESTS": "encoding004 T10458 ghcilink002 linker_unload_native",
-      "BUILD_FLAVOUR": "validate+fully_static",
-      "CONFIGURE_ARGS": "--disable-ld-override ",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
-      "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
-      "TEST_ENV": "x86_64-linux-alpine3_12-int_native-validate+fully_static"
+      "BIGNUM_BACKEND": "gmp",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-cross_wasm32-wasi-release+fully_static",
+      "BUILD_FLAVOUR": "release+fully_static",
+      "CONFIGURE_ARGS": "--disable-ld-override --with-intree-gmp --with-system-libffi",
+      "CROSS_TARGET": "wasm32-wasi",
+      "HADRIAN_ARGS": "--docs=none",
+      "TEST_ENV": "x86_64-linux-alpine3_12-cross_wasm32-wasi-release+fully_static"
     }
   },
   "x86_64-linux-alpine3_12-validate+fully_static": {
@@ -3076,6 +3262,7 @@
       }
     ],
     "script": [
+      "sudo apk del --purge glibc*",
       "sudo chown ghc:ghc -R .",
       ".gitlab/ci.sh setup",
       ".gitlab/ci.sh configure",
@@ -3097,65 +3284,6 @@
       "TEST_ENV": "x86_64-linux-alpine3_12-validate+fully_static"
     }
   },
-  "x86_64-linux-centos7-validate": {
-    "after_script": [
-      ".gitlab/ci.sh save_cache",
-      ".gitlab/ci.sh clean",
-      "cat ci_timings"
-    ],
-    "allow_failure": false,
-    "artifacts": {
-      "expire_in": "2 weeks",
-      "paths": [
-        "ghc-x86_64-linux-centos7-validate.tar.xz",
-        "junit.xml"
-      ],
-      "reports": {
-        "junit": "junit.xml"
-      },
-      "when": "always"
-    },
-    "cache": {
-      "key": "x86_64-linux-centos7-$CACHE_REV",
-      "paths": [
-        "cabal-cache",
-        "toolchain"
-      ]
-    },
-    "dependencies": [],
-    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-centos7:$DOCKER_REV",
-    "needs": [
-      {
-        "artifacts": false,
-        "job": "hadrian-ghc-in-ghci"
-      }
-    ],
-    "rules": [
-      {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"disabled\" != \"disabled\")",
-        "when": "on_success"
-      }
-    ],
-    "script": [
-      "sudo chown ghc:ghc -R .",
-      ".gitlab/ci.sh setup",
-      ".gitlab/ci.sh configure",
-      ".gitlab/ci.sh build_hadrian",
-      ".gitlab/ci.sh test_hadrian"
-    ],
-    "stage": "full-build",
-    "tags": [
-      "x86_64-linux"
-    ],
-    "variables": {
-      "BIGNUM_BACKEND": "gmp",
-      "BIN_DIST_NAME": "ghc-x86_64-linux-centos7-validate",
-      "BUILD_FLAVOUR": "validate",
-      "CONFIGURE_ARGS": "",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
-      "TEST_ENV": "x86_64-linux-centos7-validate"
-    }
-  },
   "x86_64-linux-deb10-int_native-validate": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
@@ -3390,7 +3518,7 @@
       "TEST_ENV": "x86_64-linux-deb10-unreg-validate"
     }
   },
-  "x86_64-linux-deb10-validate": {
+  "x86_64-linux-deb10-validate+debug_info": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
       ".gitlab/ci.sh clean",
@@ -3400,7 +3528,7 @@
     "artifacts": {
       "expire_in": "2 weeks",
       "paths": [
-        "ghc-x86_64-linux-deb10-validate.tar.xz",
+        "ghc-x86_64-linux-deb10-validate+debug_info.tar.xz",
         "junit.xml"
       ],
       "reports": {
@@ -3425,7 +3553,7 @@
     ],
     "rules": [
       {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"disabled\" != \"disabled\")",
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
         "when": "on_success"
       }
     ],
@@ -3442,13 +3570,13 @@
     ],
     "variables": {
       "BIGNUM_BACKEND": "gmp",
-      "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate",
-      "BUILD_FLAVOUR": "validate",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+debug_info",
+      "BUILD_FLAVOUR": "validate+debug_info",
       "CONFIGURE_ARGS": "",
-      "TEST_ENV": "x86_64-linux-deb10-validate"
+      "TEST_ENV": "x86_64-linux-deb10-validate+debug_info"
     }
   },
-  "x86_64-linux-deb10-validate+debug_info": {
+  "x86_64-linux-deb10-validate+llvm": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
       ".gitlab/ci.sh clean",
@@ -3458,7 +3586,7 @@
     "artifacts": {
       "expire_in": "2 weeks",
       "paths": [
-        "ghc-x86_64-linux-deb10-validate+debug_info.tar.xz",
+        "ghc-x86_64-linux-deb10-validate+llvm.tar.xz",
         "junit.xml"
       ],
       "reports": {
@@ -3483,7 +3611,7 @@
     ],
     "rules": [
       {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && ($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/) && (\"true\" == \"true\") && (\"true\" == \"true\")",
         "when": "on_success"
       }
     ],
@@ -3500,68 +3628,10 @@
     ],
     "variables": {
       "BIGNUM_BACKEND": "gmp",
-      "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+debug_info",
-      "BUILD_FLAVOUR": "validate+debug_info",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+llvm",
+      "BUILD_FLAVOUR": "validate+llvm",
       "CONFIGURE_ARGS": "",
-      "TEST_ENV": "x86_64-linux-deb10-validate+debug_info"
-    }
-  },
-  "x86_64-linux-deb10-validate+llvm": {
-    "after_script": [
-      ".gitlab/ci.sh save_cache",
-      ".gitlab/ci.sh clean",
-      "cat ci_timings"
-    ],
-    "allow_failure": false,
-    "artifacts": {
-      "expire_in": "2 weeks",
-      "paths": [
-        "ghc-x86_64-linux-deb10-validate+llvm.tar.xz",
-        "junit.xml"
-      ],
-      "reports": {
-        "junit": "junit.xml"
-      },
-      "when": "always"
-    },
-    "cache": {
-      "key": "x86_64-linux-deb10-$CACHE_REV",
-      "paths": [
-        "cabal-cache",
-        "toolchain"
-      ]
-    },
-    "dependencies": [],
-    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV",
-    "needs": [
-      {
-        "artifacts": false,
-        "job": "hadrian-ghc-in-ghci"
-      }
-    ],
-    "rules": [
-      {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && ($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/) && (\"true\" == \"true\") && (\"true\" == \"true\")",
-        "when": "on_success"
-      }
-    ],
-    "script": [
-      "sudo chown ghc:ghc -R .",
-      ".gitlab/ci.sh setup",
-      ".gitlab/ci.sh configure",
-      ".gitlab/ci.sh build_hadrian",
-      ".gitlab/ci.sh test_hadrian"
-    ],
-    "stage": "full-build",
-    "tags": [
-      "x86_64-linux"
-    ],
-    "variables": {
-      "BIGNUM_BACKEND": "gmp",
-      "BIN_DIST_NAME": "ghc-x86_64-linux-deb10-validate+llvm",
-      "BUILD_FLAVOUR": "validate+llvm",
-      "CONFIGURE_ARGS": "",
-      "TEST_ENV": "x86_64-linux-deb10-validate+llvm"
+      "TEST_ENV": "x86_64-linux-deb10-validate+llvm"
     }
   },
   "x86_64-linux-deb10-validate+thread_sanitizer": {
@@ -3745,122 +3815,6 @@
       "TEST_ENV": "x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate"
     }
   },
-  "x86_64-linux-deb11-validate": {
-    "after_script": [
-      ".gitlab/ci.sh save_cache",
-      ".gitlab/ci.sh clean",
-      "cat ci_timings"
-    ],
-    "allow_failure": false,
-    "artifacts": {
-      "expire_in": "2 weeks",
-      "paths": [
-        "ghc-x86_64-linux-deb11-validate.tar.xz",
-        "junit.xml"
-      ],
-      "reports": {
-        "junit": "junit.xml"
-      },
-      "when": "always"
-    },
-    "cache": {
-      "key": "x86_64-linux-deb11-$CACHE_REV",
-      "paths": [
-        "cabal-cache",
-        "toolchain"
-      ]
-    },
-    "dependencies": [],
-    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV",
-    "needs": [
-      {
-        "artifacts": false,
-        "job": "hadrian-ghc-in-ghci"
-      }
-    ],
-    "rules": [
-      {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"disabled\" != \"disabled\")",
-        "when": "on_success"
-      }
-    ],
-    "script": [
-      "sudo chown ghc:ghc -R .",
-      ".gitlab/ci.sh setup",
-      ".gitlab/ci.sh configure",
-      ".gitlab/ci.sh build_hadrian",
-      ".gitlab/ci.sh test_hadrian"
-    ],
-    "stage": "full-build",
-    "tags": [
-      "x86_64-linux"
-    ],
-    "variables": {
-      "BIGNUM_BACKEND": "gmp",
-      "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-validate",
-      "BUILD_FLAVOUR": "validate",
-      "CONFIGURE_ARGS": "",
-      "TEST_ENV": "x86_64-linux-deb11-validate"
-    }
-  },
-  "x86_64-linux-deb9-validate": {
-    "after_script": [
-      ".gitlab/ci.sh save_cache",
-      ".gitlab/ci.sh clean",
-      "cat ci_timings"
-    ],
-    "allow_failure": false,
-    "artifacts": {
-      "expire_in": "2 weeks",
-      "paths": [
-        "ghc-x86_64-linux-deb9-validate.tar.xz",
-        "junit.xml"
-      ],
-      "reports": {
-        "junit": "junit.xml"
-      },
-      "when": "always"
-    },
-    "cache": {
-      "key": "x86_64-linux-deb9-$CACHE_REV",
-      "paths": [
-        "cabal-cache",
-        "toolchain"
-      ]
-    },
-    "dependencies": [],
-    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV",
-    "needs": [
-      {
-        "artifacts": false,
-        "job": "hadrian-ghc-in-ghci"
-      }
-    ],
-    "rules": [
-      {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"disabled\" != \"disabled\")",
-        "when": "on_success"
-      }
-    ],
-    "script": [
-      "sudo chown ghc:ghc -R .",
-      ".gitlab/ci.sh setup",
-      ".gitlab/ci.sh configure",
-      ".gitlab/ci.sh build_hadrian",
-      ".gitlab/ci.sh test_hadrian"
-    ],
-    "stage": "full-build",
-    "tags": [
-      "x86_64-linux"
-    ],
-    "variables": {
-      "BIGNUM_BACKEND": "gmp",
-      "BIN_DIST_NAME": "ghc-x86_64-linux-deb9-validate",
-      "BUILD_FLAVOUR": "validate",
-      "CONFIGURE_ARGS": "",
-      "TEST_ENV": "x86_64-linux-deb9-validate"
-    }
-  },
   "x86_64-linux-fedora33-release": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
@@ -3921,243 +3875,6 @@
       "TEST_ENV": "x86_64-linux-fedora33-release"
     }
   },
-  "x86_64-linux-fedora33-release-hackage": {
-    "after_script": [
-      ".gitlab/ci.sh save_cache",
-      ".gitlab/ci.sh clean",
-      "cat ci_timings"
-    ],
-    "allow_failure": false,
-    "artifacts": {
-      "expire_in": "2 weeks",
-      "paths": [
-        "ghc-x86_64-linux-fedora33-release.tar.xz",
-        "junit.xml"
-      ],
-      "reports": {
-        "junit": "junit.xml"
-      },
-      "when": "always"
-    },
-    "cache": {
-      "key": "x86_64-linux-fedora33-$CACHE_REV",
-      "paths": [
-        "cabal-cache",
-        "toolchain"
-      ]
-    },
-    "dependencies": [],
-    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora33:$DOCKER_REV",
-    "needs": [
-      {
-        "artifacts": false,
-        "job": "hadrian-ghc-in-ghci"
-      }
-    ],
-    "rules": [
-      {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"disabled\" != \"disabled\")",
-        "when": "on_success"
-      }
-    ],
-    "script": [
-      "sudo chown ghc:ghc -R .",
-      ".gitlab/ci.sh setup",
-      ".gitlab/ci.sh configure",
-      ".gitlab/ci.sh build_hadrian",
-      ".gitlab/ci.sh test_hadrian"
-    ],
-    "stage": "full-build",
-    "tags": [
-      "x86_64-linux"
-    ],
-    "variables": {
-      "BIGNUM_BACKEND": "gmp",
-      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release",
-      "BUILD_FLAVOUR": "release",
-      "CONFIGURE_ARGS": "",
-      "HADRIAN_ARGS": "--haddock-base-url",
-      "LLC": "/bin/false",
-      "OPT": "/bin/false",
-      "TEST_ENV": "x86_64-linux-fedora33-release"
-    }
-  },
-  "x86_64-linux-fedora33-validate+debug_info": {
-    "after_script": [
-      ".gitlab/ci.sh save_cache",
-      ".gitlab/ci.sh clean",
-      "cat ci_timings"
-    ],
-    "allow_failure": false,
-    "artifacts": {
-      "expire_in": "2 weeks",
-      "paths": [
-        "ghc-x86_64-linux-fedora33-validate+debug_info.tar.xz",
-        "junit.xml"
-      ],
-      "reports": {
-        "junit": "junit.xml"
-      },
-      "when": "always"
-    },
-    "cache": {
-      "key": "x86_64-linux-fedora33-$CACHE_REV",
-      "paths": [
-        "cabal-cache",
-        "toolchain"
-      ]
-    },
-    "dependencies": [],
-    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora33:$DOCKER_REV",
-    "needs": [
-      {
-        "artifacts": false,
-        "job": "hadrian-ghc-in-ghci"
-      }
-    ],
-    "rules": [
-      {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"disabled\" != \"disabled\")",
-        "when": "on_success"
-      }
-    ],
-    "script": [
-      "sudo chown ghc:ghc -R .",
-      ".gitlab/ci.sh setup",
-      ".gitlab/ci.sh configure",
-      ".gitlab/ci.sh build_hadrian",
-      ".gitlab/ci.sh test_hadrian"
-    ],
-    "stage": "full-build",
-    "tags": [
-      "x86_64-linux"
-    ],
-    "variables": {
-      "BIGNUM_BACKEND": "gmp",
-      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-validate+debug_info",
-      "BUILD_FLAVOUR": "validate+debug_info",
-      "CONFIGURE_ARGS": "",
-      "LLC": "/bin/false",
-      "OPT": "/bin/false",
-      "TEST_ENV": "x86_64-linux-fedora33-validate+debug_info"
-    }
-  },
-  "x86_64-linux-ubuntu20_04-validate": {
-    "after_script": [
-      ".gitlab/ci.sh save_cache",
-      ".gitlab/ci.sh clean",
-      "cat ci_timings"
-    ],
-    "allow_failure": false,
-    "artifacts": {
-      "expire_in": "2 weeks",
-      "paths": [
-        "ghc-x86_64-linux-ubuntu20_04-validate.tar.xz",
-        "junit.xml"
-      ],
-      "reports": {
-        "junit": "junit.xml"
-      },
-      "when": "always"
-    },
-    "cache": {
-      "key": "x86_64-linux-ubuntu20_04-$CACHE_REV",
-      "paths": [
-        "cabal-cache",
-        "toolchain"
-      ]
-    },
-    "dependencies": [],
-    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-ubuntu20_04:$DOCKER_REV",
-    "needs": [
-      {
-        "artifacts": false,
-        "job": "hadrian-ghc-in-ghci"
-      }
-    ],
-    "rules": [
-      {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"disabled\" != \"disabled\")",
-        "when": "on_success"
-      }
-    ],
-    "script": [
-      "sudo chown ghc:ghc -R .",
-      ".gitlab/ci.sh setup",
-      ".gitlab/ci.sh configure",
-      ".gitlab/ci.sh build_hadrian",
-      ".gitlab/ci.sh test_hadrian"
-    ],
-    "stage": "full-build",
-    "tags": [
-      "x86_64-linux"
-    ],
-    "variables": {
-      "BIGNUM_BACKEND": "gmp",
-      "BIN_DIST_NAME": "ghc-x86_64-linux-ubuntu20_04-validate",
-      "BUILD_FLAVOUR": "validate",
-      "CONFIGURE_ARGS": "",
-      "TEST_ENV": "x86_64-linux-ubuntu20_04-validate"
-    }
-  },
-  "x86_64-windows-int_native-validate": {
-    "after_script": [
-      "bash .gitlab/ci.sh save_cache",
-      "bash .gitlab/ci.sh clean"
-    ],
-    "allow_failure": false,
-    "artifacts": {
-      "expire_in": "2 weeks",
-      "paths": [
-        "ghc-x86_64-windows-int_native-validate.tar.xz",
-        "junit.xml"
-      ],
-      "reports": {
-        "junit": "junit.xml"
-      },
-      "when": "always"
-    },
-    "cache": {
-      "key": "no-caching",
-      "paths": []
-    },
-    "dependencies": [],
-    "image": null,
-    "needs": [
-      {
-        "artifacts": false,
-        "job": "hadrian-ghc-in-ghci"
-      }
-    ],
-    "rules": [
-      {
-        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"disabled\" != \"disabled\")",
-        "when": "on_success"
-      }
-    ],
-    "script": [
-      "bash .gitlab/ci.sh setup",
-      "bash .gitlab/ci.sh configure",
-      "bash .gitlab/ci.sh build_hadrian",
-      "bash .gitlab/ci.sh test_hadrian"
-    ],
-    "stage": "full-build",
-    "tags": [
-      "new-x86_64-windows"
-    ],
-    "variables": {
-      "BIGNUM_BACKEND": "native",
-      "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-validate",
-      "BUILD_FLAVOUR": "validate",
-      "CABAL_INSTALL_VERSION": "3.8.1.0",
-      "CONFIGURE_ARGS": "",
-      "GHC_VERSION": "9.4.3",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
-      "LANG": "en_US.UTF-8",
-      "MSYSTEM": "MINGW64",
-      "TEST_ENV": "x86_64-windows-int_native-validate"
-    }
-  },
   "x86_64-windows-validate": {
     "after_script": [
       "bash .gitlab/ci.sh save_cache",


=====================================
compiler/GHC/CmmToAsm/Wasm/Asm.hs
=====================================
@@ -359,6 +359,7 @@ asmTellWasmInstr ty_word instr = case instr of
   WasmF32DemoteF64 -> asmTellLine "f32.demote_f64"
   WasmF64PromoteF32 -> asmTellLine "f64.promote_f32"
   WasmAbs ty -> asmTellLine $ asmFromWasmType ty <> ".abs"
+  WasmNeg ty -> asmTellLine $ asmFromWasmType ty <> ".neg"
   WasmCond t -> do
     asmTellLine "if"
     asmWithTab $ asmTellWasmInstr ty_word t


=====================================
compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
=====================================
@@ -224,6 +224,28 @@ extendSubword W32 TagI64 (WasmExpr instr) =
   WasmExpr $ instr `WasmConcat` WasmI64Extend32S
 extendSubword _ _ expr = expr
 
+-- | Lower an unary homogeneous operation.
+lower_MO_Un_Homo ::
+  ( forall pre t.
+    WasmTypeTag t ->
+    WasmInstr
+      w
+      (t : pre)
+      (t : pre)
+  ) ->
+  CLabel ->
+  CmmType ->
+  [CmmExpr] ->
+  WasmCodeGenM w (SomeWasmExpr w)
+lower_MO_Un_Homo op lbl t0 [x] = case someWasmTypeFromCmmType t0 of
+  SomeWasmType ty -> do
+    WasmExpr x_instr <- lower_CmmExpr_Typed lbl ty x
+    pure $
+      SomeWasmExpr ty $
+        WasmExpr $
+          x_instr `WasmConcat` op ty
+lower_MO_Un_Homo _ _ _ _ = panic "lower_MO_Un_Homo: unreachable"
+
 -- | Lower a binary homogeneous operation. Homogeneous: result type is
 -- the same with operand types.
 lower_MO_Bin_Homo ::
@@ -699,11 +721,12 @@ lower_CmmMachOp lbl (MO_F_Sub w0) xs =
     lbl
     (cmmFloat w0)
     xs
-lower_CmmMachOp lbl (MO_F_Neg w0) [x] =
-  lower_CmmMachOp
+lower_CmmMachOp lbl (MO_F_Neg w0) xs =
+  lower_MO_Un_Homo
+    WasmNeg
     lbl
-    (MO_F_Sub w0)
-    [CmmLit $ CmmFloat 0 w0, x]
+    (cmmFloat w0)
+    xs
 lower_CmmMachOp lbl (MO_F_Mul w0) xs =
   lower_MO_Bin_Homo
     WasmMul


=====================================
compiler/GHC/CmmToAsm/Wasm/Types.hs
=====================================
@@ -305,6 +305,7 @@ data WasmInstr :: WasmType -> [WasmType] -> [WasmType] -> Type where
   WasmF32DemoteF64 :: WasmInstr w ('F64 : pre) ('F32 : pre)
   WasmF64PromoteF32 :: WasmInstr w ('F32 : pre) ('F64 : pre)
   WasmAbs :: WasmTypeTag t -> WasmInstr w (t : pre) (t : pre)
+  WasmNeg :: WasmTypeTag t -> WasmInstr w (t : pre) (t : pre)
   WasmCond :: WasmInstr w pre pre -> WasmInstr w (w : pre) pre
 
 newtype WasmExpr w t = WasmExpr (forall pre. WasmInstr w pre (t : pre))


=====================================
compiler/GHC/CmmToC.hs
=====================================
@@ -382,8 +382,8 @@ pprExpr platform e = case e of
     CmmRegOff reg 0    -> pprCastReg reg
 
     -- CmmRegOff is an alias of MO_Add
-    CmmRegOff reg i -> pprCastReg reg <> char '+' <>
-                       pprHexVal platform (fromIntegral i) (wordWidth platform)
+    CmmRegOff reg i    -> pprExpr platform $ CmmMachOp (MO_Add w) [CmmReg reg, CmmLit $ CmmInt (toInteger i) w]
+      where w = cmmRegWidth platform reg
 
     CmmMachOp mop args -> pprMachOpApp platform mop args
 


=====================================
hadrian/doc/flavours.md
=====================================
@@ -261,6 +261,10 @@ The supported transformers are listed below:
         <td>Just like `no_dynamic_ghc`, this transformer ensures statically-linked libraries
         </td>
     </tr>
+    <tr>
+        <td><code>native_bignum</code></td>
+        <td>Use the native <code>ghc-bignum</code> backend.</td>
+    </tr>
     <tr>
         <td><code>no_profiled_libs</code></td>
         <td>Disables building of libraries in profiled build ways.</td>
@@ -300,6 +304,18 @@ The supported transformers are listed below:
         <td>Enable Core, STG, and C-- linting in all compilation with the stage1
         compiler.</td>
     </tr>
+    <tr>
+        <td><code>haddock</code></td>
+        <td>Emit haddock documentation into the interface files via <code>-haddock</code>.</td>
+    </tr>
+    <tr>
+        <td><code>hi_core</code></td>
+        <td>Emit whole Core bindings into the interface files via <code>-fwrite-if-simplified-core</code>.</td>
+    </tr>
+    <tr>
+        <td><code>late_ccs</code></td>
+        <td>Enable <code>-fprof-late</code> in profiled libraries.</td>
+    </tr>
 </table>
 
 ### Static


=====================================
hadrian/src/Flavour.hs
=====================================
@@ -15,6 +15,7 @@ module Flavour
   , disableProfiledLibs
   , enableLinting
   , enableHaddock
+  , enableHiCore
   , useNativeBignum
   , omitPragmas
 
@@ -62,6 +63,7 @@ flavourTransformers = M.fromList
     , "debug_stage1_ghc" =: debugGhc stage0InTree
     , "lint"             =: enableLinting
     , "haddock"          =: enableHaddock
+    , "hi_core"          =: enableHiCore
     , "late_ccs"         =: enableLateCCS
     ]
   where (=:) = (,)
@@ -180,6 +182,13 @@ enableHaddock =
       [ arg "-haddock"
       ]
 
+-- | Build stage2 dependencies with options to emit Core into
+-- interface files which is sufficient to restart code generation.
+enableHiCore :: Flavour -> Flavour
+enableHiCore = addArgs
+    $ notStage0 ? builder (Ghc CompileHs)
+    ? pure ["-fwrite-if-simplified-core"]
+
 -- | Transform the input 'Flavour' so as to build with
 --   @-split-sections@ whenever appropriate.
 --   Note that this transformer doesn't do anything


=====================================
hadrian/src/Settings/Builders/Configure.hs
=====================================
@@ -10,12 +10,20 @@ configureBuilderArgs = do
     gmpPath    <- expr (gmpBuildPath stage)
     libffiPath <- expr (libffiBuildPath stage)
     mconcat [ builder (Configure gmpPath) ? do
+                targetArch <- getSetting TargetArch
                 targetPlatform <- getSetting TargetPlatform
                 buildPlatform <- getSetting BuildPlatform
-                pure [ "--enable-shared=no"
+                pure $ [ "--enable-shared=no"
                      , "--with-pic=yes"
                      , "--host=" ++ targetPlatform    -- GMP's host is our target
                      , "--build=" ++ buildPlatform ]
+                     -- Disable GMP's alloca usage on wasm32, it may
+                     -- cause stack overflow (#22602) due to the
+                     -- rather small 64KB default stack size. See
+                     -- https://gmplib.org/manual/Build-Options for
+                     -- more detailed explanation of this configure
+                     -- option.
+                     <> [ "--enable-alloca=malloc-reentrant" | targetArch == "wasm32" ]
 
             , builder (Configure libffiPath) ? do
                 top            <- expr topDirectory


=====================================
libraries/process
=====================================
@@ -1 +1 @@
-Subproject commit 7c6871d89bd87875b4e402de26d7267c11e617a9
+Subproject commit d9a8e6e749d2d60422037f3ef4733d521f18a7fc


=====================================
testsuite/tests/rts/T18623/all.T
=====================================
@@ -6,7 +6,7 @@ test('T18623',
      # fully clear.  Maybe it needs a higher limit due to LLVM?
      when(arch('aarch64'), skip),
      # Recent versions of osx report an error when running `ulimit -v`
-     when(arch('darwin'), skip),
+     when(opsys('darwin'), skip),
      when(arch('powerpc64le'), skip),
      cmd_prefix('ulimit -v ' + str(1024 ** 2) + ' && '),
      ignore_stdout],


=====================================
utils/hsc2hs
=====================================
@@ -1 +1 @@
-Subproject commit 219bba062e804db0bea4bf3ffcaaba2df46334f8
+Subproject commit 0811ae8f29d0cc2591bbe89bc034ae14143d0443



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/991b9ca567389114e8bfd7bd9c5483a1602b2427...b9bbcff4f8e7f179041cf799f5005ea362d58c8b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/991b9ca567389114e8bfd7bd9c5483a1602b2427...b9bbcff4f8e7f179041cf799f5005ea362d58c8b
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/20230125/26d0943c/attachment-0001.html>


More information about the ghc-commits mailing list