Skip to content

Commit 3183a19

Browse files
committed
rts: Add no-ghc-internal flag
1 parent adba76c commit 3183a19

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

compiler/GHC/Driver/DynFlags.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,8 @@ packageFlagsChanged idflags1 idflags0 =
878878
[ Opt_HideAllPackages
879879
, Opt_HideAllPluginPackages
880880
, Opt_AutoLinkPackages
881-
, Opt_NoRts ]
881+
, Opt_NoRts
882+
, Opt_NoGhcInternal ]
882883

883884
instance Outputable PackageFlag where
884885
ppr (ExposePackage n arg rn) = text n <> braces (ppr arg <+> ppr rn)

compiler/GHC/Driver/Flags.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ data GeneralFlag
863863
-- temporary flags
864864
| Opt_AutoLinkPackages
865865
| Opt_NoRts
866+
| Opt_NoGhcInternal
866867
| Opt_ImplicitImportQualified
867868

868869
-- keeping stuff

compiler/GHC/Driver/Session.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,8 @@ dynamic_flags_deps = [
13141314
(NoArg (setGeneralFlag Opt_NoHsMain))
13151315
, make_ord_flag defGhcFlag "no-rts"
13161316
(NoArg (setGeneralFlag Opt_NoRts))
1317+
, make_ord_flag defGhcFlag "no-ghc-internal"
1318+
(NoArg (setGeneralFlag Opt_NoGhcInternal))
13171319
, make_ord_flag defGhcFlag "fno-state-hack"
13181320
(NoArg (setGeneralFlag Opt_G_NoStateHack))
13191321
, make_ord_flag defGhcFlag "fno-opt-coercion"

compiler/GHC/Unit/State.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,11 @@ mkUnitState logger dflags cfg = do
16361636
-- it modifies the unit ids of wired in packages, but when we process
16371637
-- package arguments we need to key against the old versions.
16381638
--
1639-
(pkgs2, wired_map) <- findWiredInUnits logger (rtsWayUnitId dflags:wiredInUnitIds) prec_map pkgs1 vis_map2
1639+
let wired_ids_all = rtsWayUnitId dflags : wiredInUnitIds
1640+
wired_ids
1641+
| gopt Opt_NoGhcInternal dflags = filter (/= ghcInternalUnitId) wired_ids_all
1642+
| otherwise = wired_ids_all
1643+
(pkgs2, wired_map) <- findWiredInUnits logger wired_ids prec_map pkgs1 vis_map2
16401644

16411645
--
16421646
-- Sanity check. If the rtsWayUnitId is not in the database, then we have a
@@ -1648,6 +1652,7 @@ mkUnitState logger dflags cfg = do
16481652
, nest 2 $ vcat
16491653
[ text "pkgs1_count =" <+> ppr (length pkgs1)
16501654
, text "Opt_NoRts =" <+> ppr (gopt Opt_NoRts dflags)
1655+
, text "Opt_NoGhcInternal =" <+> ppr (gopt Opt_NoGhcInternal dflags)
16511656
, text "ghcLink =" <+> text (show (ghcLink dflags))
16521657
, text "platform =" <+> text (show (targetPlatform dflags))
16531658
, text "rtsWayUnitId=" <+> ppr (rtsWayUnitId dflags)
@@ -1664,7 +1669,9 @@ mkUnitState logger dflags cfg = do
16641669
<> text " Please check your installation."
16651670
<> text " If this target doesn't need the RTS (e.g. building a shared library), you can add -no-rts to the relevant package's ghc-options in cabal.project to bypass this check."
16661671

1667-
let pkgs3 = if gopt Opt_NoRts dflags && not (anyUniqMap (== ghcInternalUnitId) wired_map)
1672+
let pkgs3 = if gopt Opt_NoGhcInternal dflags
1673+
then pkgs2
1674+
else if gopt Opt_NoRts dflags && not (anyUniqMap (== ghcInternalUnitId) wired_map)
16681675
then pkgs2
16691676
else
16701677
-- At this point we should have `ghcInternalUnitId`, and the `rtsWiredUnitId dflags`.

0 commit comments

Comments
 (0)