... |
... |
@@ -3450,6 +3450,7 @@ compilerInfo dflags |
3450
|
3450
|
("Project Patch Level1", cProjectPatchLevel1),
|
3451
|
3451
|
("Project Patch Level2", cProjectPatchLevel2),
|
3452
|
3452
|
("Project Unit Id", cProjectUnitId),
|
|
3453
|
+ ("ghc-internal Unit Id", ghcInternalUnitId), -- See Note [Special unit-ids]
|
3453
|
3454
|
("Booter version", cBooterVersion),
|
3454
|
3455
|
("Stage", cStage),
|
3455
|
3456
|
("Build platform", cBuildPlatformString),
|
... |
... |
@@ -3500,6 +3501,23 @@ compilerInfo dflags |
3500
|
3501
|
expandDirectories :: FilePath -> Maybe FilePath -> String -> String
|
3501
|
3502
|
expandDirectories topd mtoold = expandToolDir useInplaceMinGW mtoold . expandTopDir topd
|
3502
|
3503
|
|
|
3504
|
+-- Note [Special unit-ids]
|
|
3505
|
+-- ~~~~~~~~~~~~~~~~~~~~~~~
|
|
3506
|
+-- Certain units are special to the compiler:
|
|
3507
|
+-- - Wired-in identifiers reference a specific unit-id of `ghc-internal`.
|
|
3508
|
+-- - GHC plugins must be linked against a specific unit-id of `ghc`,
|
|
3509
|
+-- namely the same one as the compiler.
|
|
3510
|
+-- - When using Template Haskell, splices refer to the Template Haskell
|
|
3511
|
+-- interface defined in `ghc-internal`, and must be linked against the same
|
|
3512
|
+-- unit-id as the compiler.
|
|
3513
|
+--
|
|
3514
|
+-- We therefore expose the unit-id of `ghc-internal` ("ghc-internal Unit Id") and
|
|
3515
|
+-- ghc ("Project Unit Id") through `ghc --info`.
|
|
3516
|
+--
|
|
3517
|
+-- This allows build tools to act accordingly, eg, if a user wishes to build a
|
|
3518
|
+-- GHC plugin, `cabal-install` might force them to use the exact `ghc` unit
|
|
3519
|
+-- that the compiler was linked against.
|
|
3520
|
+
|
3503
|
3521
|
{- -----------------------------------------------------------------------------
|
3504
|
3522
|
Note [DynFlags consistency]
|
3505
|
3523
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|