[Git][ghc/ghc][wip/romes/hardwire-ghc-unit-id] 8 commits: Hardwire a better unit-id for ghc

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Tue Apr 4 09:45:32 UTC 2023



Matthew Pickering pushed to branch wip/romes/hardwire-ghc-unit-id at Glasgow Haskell Compiler / GHC


Commits:
b8123b2c by romes at 2023-04-03T10:20:02+01:00
Hardwire a better unit-id for ghc

Previously, the unit-id of ghc-the-library was fixed as `ghc`.
This was done primarily because the compiler must know the unit-id of
some packages (including ghc) a-priori to define wired-in names.

However, as seen in #20742, a reinstallable `ghc` whose unit-id is fixed
to `ghc` might result in subtle bugs when different ghc's interact.

A good example of this is having GHC_A load a plugin compiled by GHC_B,
where GHC_A and GHC_B are linked to ghc-libraries that are ABI
incompatible. Without a distinction between the unit-id of the ghc library
GHC_A is linked against and the ghc library the plugin it is loading was
compiled against, we can't check compatibility.

This patch gives a slightly better unit-id to ghc (ghc-version) by
(1) Not setting -this-unit-id to ghc, but rather to the new unit-id (modulo stage0)
(2) Adding a definition to `GHC.Settings.Config` whose value is the new unit-id.
    (2.1) `GHC.Settings.Config` is generated by Hadrian
    (2.2) and also by cabal through `compiler/Setup.hs`
This unit-id definition is imported by `GHC.Unit.Types` and used to
set the wired-in unit-id of "ghc", which was previously fixed to "ghc"

The commits following this one will improve the unit-id with a
cabal-style package hash and check compatibility when loading plugins.

Note that we also ensure that ghc's unit key matches unit id both when
hadrian or cabal builds ghc, and in this way we no longer need to add
`ghc` to the WiringMap.

- - - - -
f939dfc1 by romes at 2023-04-03T10:20:02+01:00
Validate compatibility of ghcs when loading plugins

- - - - -
c9b48a23 by romes at 2023-04-03T10:20:02+01:00
Add hashes to unit-ids created by hadrian

Co-author: @mpickering

- - - - -
6e7abf19 by GHC GitLab CI at 2023-04-03T10:20:02+01:00
Fix sed command in install makefile

- - - - -
13824cd5 by Matthew Pickering at 2023-04-03T17:14:10+01:00
fixes

- - - - -
104c2b4c by Matthew Pickering at 2023-04-03T17:31:17+01:00
add flag

- - - - -
5d179c5d by Matthew Pickering at 2023-04-03T17:33:33+01:00
Use hash-unit-ids in release jobs

- - - - -
8efe61f3 by Matthew Pickering at 2023-04-04T10:38:52+01:00
Fix passing opts to toolargs

- - - - -


30 changed files:

- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Runtime/Loader.hs
- compiler/GHC/Unit/Types.hs
- compiler/Setup.hs
- compiler/ghc.cabal.in
- hadrian/bindist/Makefile
- hadrian/hadrian.cabal
- hadrian/src/CommandLine.hs
- hadrian/src/Context.hs
- hadrian/src/Flavour.hs
- hadrian/src/Flavour/Type.hs
- hadrian/src/Hadrian/BuildPath.hs
- hadrian/src/Hadrian/Builder/Git.hs
- hadrian/src/Hadrian/Haskell/Cabal.hs
- hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
- + hadrian/src/Hadrian/Haskell/Hash.hs
- + hadrian/src/Hadrian/Haskell/Hash.hs-boot
- hadrian/src/Hadrian/Package.hs
- hadrian/src/Rules.hs
- hadrian/src/Rules/BinaryDist.hs
- hadrian/src/Rules/CabalReinstall.hs
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Rules/Library.hs
- hadrian/src/Rules/Register.hs
- hadrian/src/Settings.hs
- hadrian/src/Settings/Builders/Cabal.hs
- hadrian/src/Settings/Builders/Ghc.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4ab30288e9fc996c8ef4add845e77aaa14fbe4ed...8efe61f3714e20bc32cefdd5f69a74c28220a441

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4ab30288e9fc996c8ef4add845e77aaa14fbe4ed...8efe61f3714e20bc32cefdd5f69a74c28220a441
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/20230404/e85c6e0a/attachment.html>


More information about the ghc-commits mailing list