From 0116f0598ac43a9a6f2cb2d5f42b284955695e9b Mon Sep 17 00:00:00 2001 From: simonpj Date: Thu, 12 Jun 2003 16:50:19 +0000 Subject: [PATCH] [project @ 2003-06-12 16:50:19 by simonpj] ---------------------------------- 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). --- ghc/compiler/ghci/Linker.lhs | 11 +++++++++-- ghc/compiler/main/DriverState.hs | 9 +++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/ghci/Linker.lhs b/ghc/compiler/ghci/Linker.lhs index 5f19e2b..e965d01 100644 --- a/ghc/compiler/ghci/Linker.lhs +++ b/ghc/compiler/ghci/Linker.lhs @@ -35,7 +35,7 @@ import DriverState ( v_Cmdline_frameworks, v_Framework_paths ) #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 @@ -327,7 +327,14 @@ linkExpr hsc_env pcs root_ul_bco 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)) diff --git a/ghc/compiler/main/DriverState.hs b/ghc/compiler/main/DriverState.hs index 78ee4d3..76c8295 100644 --- a/ghc/compiler/main/DriverState.hs +++ b/ghc/compiler/main/DriverState.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $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 -- @@ -478,7 +478,12 @@ mungePackagePaths top_dir ps = map munge_pkg ps -- 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 () -- 1.7.10.4