summaryrefslogtreecommitdiff
path: root/ghc/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/Main.hs')
-rw-r--r--ghc/Main.hs13
1 files changed, 10 insertions, 3 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs
index ef3de102c0..5b1f33bb4e 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -41,7 +41,7 @@ import GHC.Platform.Host
import GHCi.UI ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings )
#endif
-import GHC.Runtime.Loader ( loadFrontendPlugin )
+import GHC.Runtime.Loader ( loadFrontendPlugin, initializeSessionPlugins )
import GHC.Unit.Env
import GHC.Unit (UnitId, homeUnitDepends)
@@ -257,16 +257,23 @@ main' postLoadMode units dflags0 args flagWarnings = do
-- we've finished manipulating the DynFlags, update the session
_ <- GHC.setSessionDynFlags dflags5
dflags6 <- GHC.getSessionDynFlags
- hsc_env <- GHC.getSession
+
+ -- Must do this before loading plugins
+ liftIO $ initUniqSupply (initialUnique dflags6) (uniqueIncrement dflags6)
+
+ -- Initialise plugins here because the plugin author might already expect this
+ -- subsequent call to `getLogger` to be affected by a plugin.
+ initializeSessionPlugins
+ hsc_env <- getSession
logger <- getLogger
+
---------------- Display configuration -----------
case verbosity dflags6 of
v | v == 4 -> liftIO $ dumpUnitsSimple hsc_env
| v >= 5 -> liftIO $ dumpUnits hsc_env
| otherwise -> return ()
- liftIO $ initUniqSupply (initialUnique dflags6) (uniqueIncrement dflags6)
---------------- Final sanity checking -----------
liftIO $ checkOptions postLoadMode dflags6 srcs objs units