summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-03-07 13:56:53 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2022-03-07 16:41:59 +0000
commit6e5a247c3646033180925e99d230c17d2730e773 (patch)
treede347bc9906992c0786add48410e65286a03867d
parent706deee0524ca6af26c8b8d5cff17a6e401a2c18 (diff)
downloadhaskell-wip/remove-part-of-ghci.tar.gz
Remove partOfGhci check in the loaderwip/remove-part-of-ghci
This special logic has been part of GHC ever since template haskell was introduced in 9af77fa423926fbda946b31e174173d0ec5ebac8. It's hard to believe in any case that this special logic pays its way at all. Given * The list is out-of-date, which has potential to lead to miscompilation when using "editline", which was removed in 2010 (46aed8a4). * The performance benefit seems negligable as each load only happens once anyway and packages specified by package flags are preloaded into the linker state at the start of compilation. Therefore we just remove this logic. Fixes #19791
-rw-r--r--compiler/GHC/Linker/Loader.hs36
1 files changed, 7 insertions, 29 deletions
diff --git a/compiler/GHC/Linker/Loader.hs b/compiler/GHC/Linker/Loader.hs
index 7ac5fffab1..8db50f0180 100644
--- a/compiler/GHC/Linker/Loader.hs
+++ b/compiler/GHC/Linker/Loader.hs
@@ -69,9 +69,6 @@ import GHC.Types.Unique.DFM
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-#if defined(CAN_LOAD_DLL)
-import GHC.Utils.Constants (isWindowsHost, isDarwinHost)
-#endif
import GHC.Utils.Error
import GHC.Utils.Logger
import GHC.Utils.TmpFs
@@ -1295,23 +1292,6 @@ unload_wkr interp keep_linkables pls@LoaderState{..} = do
-- letting go of them (plus of course depopulating
-- the symbol table which is done in the main body)
--- If this package is already part of the GHCi binary, we'll already
--- have the right DLLs for this package loaded, so don't try to
--- load them again.
---
--- But on Win32 we must load them 'again'; doing so is a harmless no-op
--- as far as the loader is concerned, but it does initialise the list
--- of DLL handles that rts/Linker.c maintains, and that in turn is
--- used by lookupSymbol. So we must call addDLL for each library
--- just to get the DLL handle into the list.
-#if defined(CAN_LOAD_DLL)
-partOfGHCi :: [PackageName]
-partOfGHCi
- | isWindowsHost || isDarwinHost = []
- | otherwise = map (PackageName . mkFastString)
- ["base", "template-haskell", "editline"]
-#endif
-
showLS :: LibrarySpec -> String
showLS (Objects nms) = "(static) [" ++ intercalate ", " nms ++ "]"
showLS (Archive nm) = "(static archive) " ++ nm
@@ -1429,16 +1409,14 @@ loadPackage interp hsc_env pkg
maybePutSDoc logger
(text "Loading unit " <> pprUnitInfoForUser pkg <> text " ... ")
- -- See comments with partOfGHCi
#if defined(CAN_LOAD_DLL)
- when (unitPackageName pkg `notElem` partOfGHCi) $ do
- loadFrameworks interp platform pkg
- -- See Note [Crash early load_dyn and locateLib]
- -- Crash early if can't load any of `known_dlls`
- mapM_ (load_dyn interp hsc_env True) known_dlls
- -- For remaining `dlls` crash early only when there is surely
- -- no package's DLL around ... (not is_dyn)
- mapM_ (load_dyn interp hsc_env (not is_dyn) . platformSOName platform) dlls
+ loadFrameworks interp platform pkg
+ -- See Note [Crash early load_dyn and locateLib]
+ -- Crash early if can't load any of `known_dlls`
+ mapM_ (load_dyn interp hsc_env True) known_dlls
+ -- For remaining `dlls` crash early only when there is surely
+ -- no package's DLL around ... (not is_dyn)
+ mapM_ (load_dyn interp hsc_env (not is_dyn) . platformSOName platform) dlls
#endif
-- After loading all the DLLs, we can load the static objects.
-- Ordering isn't important here, because we do one final link