[Git][ghc/ghc][wip/T25282] Expose ghc-internal unit id through the settings file

Teo Camarasu pushed to branch wip/T25282 at Glasgow Haskell Compiler / GHC Commits: 6977b999 by Teo Camarasu at 2025-06-17T19:21:28+01:00 Expose ghc-internal unit id through the settings file This in combination with the unit id of the compiler library allows cabal to know of the two unit ids that should not be reinstalled (in specific circumstances) as: - when using plugins, we want to link against exactly the compiler unit id - when using TemplateHaskell we want to link against exactly the package that contains the TemplateHaskell interfaces, which is `ghc-internal` See: https://github.com/haskell/cabal/issues/10087 Resolves #25282 - - - - - 1 changed file: - compiler/GHC/Driver/Session.hs Changes: ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -3450,6 +3450,7 @@ compilerInfo dflags ("Project Patch Level1", cProjectPatchLevel1), ("Project Patch Level2", cProjectPatchLevel2), ("Project Unit Id", cProjectUnitId), + ("ghc-internal Unit Id", ghcInternalUnitId), -- See Note [Special unit-ids] ("Booter version", cBooterVersion), ("Stage", cStage), ("Build platform", cBuildPlatformString), @@ -3500,6 +3501,23 @@ compilerInfo dflags expandDirectories :: FilePath -> Maybe FilePath -> String -> String expandDirectories topd mtoold = expandToolDir useInplaceMinGW mtoold . expandTopDir topd +-- Note [Special unit-ids] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- Certain units are special to the compiler: +-- - Wired-in identifiers reference a specific unit-id of `ghc-internal`. +-- - GHC plugins must be linked against a specific unit-id of `ghc`, +-- namely the same one as the compiler. +-- - When using Template Haskell, splices refer to the Template Haskell +-- interface defined in `ghc-internal`, and must be linked against the same +-- unit-id as the compiler. +-- +-- We therefore expose the unit-id of `ghc-internal` ("ghc-internal Unit Id") and +-- ghc ("Project Unit Id") through `ghc --info`. +-- +-- This allows build tools to act accordingly, eg, if a user wishes to build a +-- GHC plugin, `cabal-install` might force them to use the exact `ghc` unit +-- that the compiler was linked against. + {- ----------------------------------------------------------------------------- Note [DynFlags consistency] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6977b9999447c4039476ce57aa5fcc55... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6977b9999447c4039476ce57aa5fcc55... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Teo Camarasu (@teo)