... |
... |
@@ -3459,6 +3459,7 @@ compilerInfo dflags |
3459
|
3459
|
("Project Patch Level1", cProjectPatchLevel1),
|
3460
|
3460
|
("Project Patch Level2", cProjectPatchLevel2),
|
3461
|
3461
|
("Project Unit Id", cProjectUnitId),
|
|
3462
|
+ ("ghc-internal Unit Id", unitIdString ghcInternalUnitId), -- See Note [Special unit-ids]
|
3462
|
3463
|
("Booter version", cBooterVersion),
|
3463
|
3464
|
("Stage", cStage),
|
3464
|
3465
|
("Build platform", cBuildPlatformString),
|
... |
... |
@@ -3512,6 +3513,23 @@ compilerInfo dflags |
3512
|
3513
|
expandDirectories :: FilePath -> Maybe FilePath -> String -> String
|
3513
|
3514
|
expandDirectories topd mtoold = expandToolDir useInplaceMinGW mtoold . expandTopDir topd
|
3514
|
3515
|
|
|
3516
|
+-- Note [Special unit-ids]
|
|
3517
|
+-- ~~~~~~~~~~~~~~~~~~~~~~~
|
|
3518
|
+-- Certain units are special to the compiler:
|
|
3519
|
+-- - Wired-in identifiers reference a specific unit-id of `ghc-internal`.
|
|
3520
|
+-- - GHC plugins must be linked against a specific unit-id of `ghc`,
|
|
3521
|
+-- namely the same one as the compiler.
|
|
3522
|
+-- - When using Template Haskell, splices refer to the Template Haskell
|
|
3523
|
+-- interface defined in `ghc-internal`, and must be linked against the same
|
|
3524
|
+-- unit-id as the compiler.
|
|
3525
|
+--
|
|
3526
|
+-- We therefore expose the unit-id of `ghc-internal` ("ghc-internal Unit Id") and
|
|
3527
|
+-- ghc ("Project Unit Id") through `ghc --info`.
|
|
3528
|
+--
|
|
3529
|
+-- This allows build tools to act accordingly, eg, if a user wishes to build a
|
|
3530
|
+-- GHC plugin, `cabal-install` might force them to use the exact `ghc` unit
|
|
3531
|
+-- that the compiler was linked against.
|
|
3532
|
+
|
3515
|
3533
|
{- -----------------------------------------------------------------------------
|
3516
|
3534
|
Note [DynFlags consistency]
|
3517
|
3535
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|