[Git][ghc/ghc][wip/toolchain-selection] 2 commits: ghc-toolchain: Toolchain Selection

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Mon Jul 17 19:45:43 UTC 2023



Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC


Commits:
102316ef by Rodrigo Mesquita at 2023-07-17T20:43:52+01:00
ghc-toolchain: Toolchain Selection

This commit integrates ghc-toolchain, the brand new way of configuring
toolchains for GHC, with the Hadrian build system, with configure, and
extends and improves the first iteration of ghc-toolchain.

The general overview is

* We introduce a program invoked `ghc-toolchain --triple=...` which, when run,
  produces a file with a `Target`. A `GHC.Toolchain.Target.Target`
  describes the properties of a target and the toolchain (executables
  and configured flags) to produce code for that target

* Hadrian was modified to read Target files, and will both
  * Invoke the toolchain configured in the Target file as needed
  * Produce a `settings` file for GHC based on the Target file for that stage

* `./configure` will invoke ghc-toolchain to generate target files, but
  it will also generate target files based on the flags configure itself
  configured (through `.in` files that are substituted)

  * By default, the Targets generated by configure are still (for now) the ones used by Hadrian

  * But we additionally validate the Target files generated by
    ghc-toolchain against the ones generated by configure, to get a head
    start on catching configuration bugs before we transition
    completely.

  * When we make that transition, we will want to drop a lot of the
    toolchain configuration logic from configure, but keep it otherwise.

* For each compiler stage we should have 1 target file (up to a stage compiler we can't run in our machine)
  * We just have a HOST target file, which we use as the target for stage0
  * And a TARGET target file, which we use for stage1 (and later stages, if not cross compiling)
  * Note there is no BUILD target file, because we only support cross compilation where BUILD=HOST
  * (for more details on cross-compilation see discussion on !9263)

See also
* Note [How we configure the bundled windows toolchain]
* Note [ghc-toolchain consistency checking]
* Note [ghc-toolchain overview]

Ticket: #19877
MR: !9263

- - - - -
47576085 by Rodrigo Mesquita at 2023-07-17T20:45:32+01:00
Add flag to enable/disable ghc-toolchain based configurations

This flag is disabled by default, and we'll use the
configure-generated-toolchains by default until we remove the toolchain
configuration logic from configure.

- - - - -


30 changed files:

- compiler/GHC/Linker/Static.hs
- compiler/GHC/Platform.hs
- configure.ac
- distrib/configure.ac.in
- hadrian/.gitignore
- hadrian/bindist/Makefile
- hadrian/bindist/config.mk.in
- hadrian/cabal.project
- + hadrian/cfg/default.host.target.in
- + hadrian/cfg/default.target.in
- hadrian/cfg/system.config.in
- hadrian/hadrian.cabal
- hadrian/src/Base.hs
- hadrian/src/Builder.hs
- hadrian/src/Context.hs
- hadrian/src/Flavour.hs
- hadrian/src/Hadrian/Haskell/Hash.hs
- hadrian/src/Hadrian/Oracles/TextFile.hs
- hadrian/src/Oracles/Flag.hs
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Rules/BinaryDist.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Rules/Gmp.hs
- hadrian/src/Rules/Libffi.hs
- hadrian/src/Rules/Lint.hs
- hadrian/src/Rules/Test.hs
- hadrian/src/Settings.hs
- hadrian/src/Settings/Builders/Cabal.hs
- hadrian/src/Settings/Builders/Cc.hs
- hadrian/src/Settings/Builders/Common.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5d6039a1170ce5889420b0f252153d87845cc862...475760858e0eb932195bda495a285f40a6853153

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5d6039a1170ce5889420b0f252153d87845cc862...475760858e0eb932195bda495a285f40a6853153
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/20230717/d2f3affa/attachment.html>


More information about the ghc-commits mailing list