----------------------------------
Fix the no-GHC.Err problem in GHCi
----------------------------------
Merge this to the stable branch.
Pattern-match failure error-ids are wired-in, which means the
GHC.Err interface isn't loaded, which in turn confused the linker
when tried to find what package GHC.Err is from.
Now we exclude wired-in names from the free variables looked at
by the linker (in Linker.linkExpr), and make sure the base package
is loaded unconditionally (DriverState.initPackageList).
#endif
import Finder ( findModule, findLinkable )
import HscTypes
#endif
import Finder ( findModule, findLinkable )
import HscTypes
-import Name ( Name, nameModule, isExternalName )
+import Name ( Name, nameModule, isExternalName, isWiredInName )
import NameEnv
import NameSet ( nameSetToList )
import Module
import NameEnv
import NameSet ( nameSetToList )
import Module
free_names = nameSetToList (bcoFreeNames root_ul_bco)
needed_mods :: [Module]
free_names = nameSetToList (bcoFreeNames root_ul_bco)
needed_mods :: [Module]
- needed_mods = [ nameModule n | n <- free_names, isExternalName n ]
+ needed_mods = [ nameModule n | n <- free_names,
+ isExternalName n, -- Names from other modules
+ not (isWiredInName n) -- Exclude wired-in names
+ ] -- (see note below)
+ -- Exclude wired-in names because we may not have read
+ -- their interface files, so getLinkDeps will fail
+ -- All wired-in names are in the base package, which we link
+ -- by default, so we can safely ignore them here.
dieWith msg = throwDyn (ProgramError (showSDoc msg))
dieWith msg = throwDyn (ProgramError (showSDoc msg))
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.90 2003/02/04 15:09:40 simonpj Exp $
+-- $Id: DriverState.hs,v 1.91 2003/06/12 16:50:19 simonpj Exp $
--
-- Settings for the driver
--
--
-- Settings for the driver
--
-- earlier packages may depend on later ones, but not vice versa
GLOBAL_VAR(v_ExplicitPackages, initPackageList, [PackageName])
-- earlier packages may depend on later ones, but not vice versa
GLOBAL_VAR(v_ExplicitPackages, initPackageList, [PackageName])
-initPackageList = [rtsPackage]
+initPackageList = [basePackage, rtsPackage]
+ -- basePackage is part of this list entirely because of
+ -- wired-in names in GHCi. See the notes on wired-in names in
+ -- Linker.linkExpr. By putting the base backage in initPackageList
+ -- we make sure that it'll always by linked.
+
-- add a package requested from the command-line
addPackage :: String -> IO ()
-- add a package requested from the command-line
addPackage :: String -> IO ()