summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-11-27 17:30:00 +0000
committerIan Lynagh <igloo@earth.li>2010-11-27 17:30:00 +0000
commit9142c238bd014c45e30fc79eee69fa6ab3f469d8 (patch)
treeb67c39856302f48740f06894284ad064ddcffadb /compiler
parent71d0e9a03797a194209cb61b7f75c2e1c8ddf237 (diff)
downloadhaskell-9142c238bd014c45e30fc79eee69fa6ab3f469d8.tar.gz
Always enable the archive-loading code
If the GHCi .o lib doesn't exist, load the .a instead
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ghc.mk24
-rw-r--r--compiler/ghci/Linker.lhs41
-rw-r--r--compiler/main/DynFlags.hs1
3 files changed, 27 insertions, 39 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 0f419c62e6..60a65d44e7 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -136,12 +136,6 @@ ifeq "$(RelocatableBuild)" "YES"
else
@echo 'cRelocatableBuild = False' >> $@
endif
- @echo 'cUseArchivesForGhci :: Bool' >> $@
-ifeq "$(UseArchivesForGhci)" "YES"
- @echo 'cUseArchivesForGhci = True' >> $@
-else
- @echo 'cUseArchivesForGhci = False' >> $@
-endif
@echo 'cLibFFI :: Bool' >> $@
ifeq "$(UseLibFFIForAdjustors)" "YES"
@echo 'cLibFFI = True' >> $@
@@ -363,10 +357,9 @@ compiler_CONFIGURE_OPTS += --ghc-option=-DNO_REGS
endif
# If we're profiling GHC then we want lots of SCCs, so -auto-all
-# We also don't want to waste time building the non-profiling library,
-# either normally or for ghci. Unfortunately this means that we have to
-# tell ghc-pkg --force as it gets upset when libHSghc-6.9.a doesn't
-# exist.
+# We also don't want to waste time building the non-profiling library.
+# Unfortunately this means that we have to tell ghc-pkg --force as it
+# gets upset when libHSghc-6.9.a doesn't exist.
ifeq "$(GhcProfiled)" "YES"
compiler_stage2_CONFIGURE_OPTS += --ghc-option=-auto-all
# We seem to still build the vanilla libraries even if we say
@@ -375,7 +368,6 @@ compiler_stage2_CONFIGURE_OPTS += --ghc-option=-auto-all
# their absence when we register the package. So for now, we just
# leave the vanilla libraries enabled.
# compiler_stage2_CONFIGURE_OPTS += --disable-library-vanilla
-compiler_stage2_CONFIGURE_OPTS += --disable-library-for-ghci
compiler_stage2_CONFIGURE_OPTS += --ghc-pkg-option=--force
endif
@@ -472,6 +464,16 @@ $(eval $(call build-package,compiler,stage1,0))
$(eval $(call build-package,compiler,stage2,1))
$(eval $(call build-package,compiler,stage3,2))
+# after build-package, because that adds --enable-library-for-ghci
+# to compiler_stage*_CONFIGURE_OPTS:
+# We don't build the GHCi library for the ghc package. We can load it
+# the .a file instead, and as object splitting isn't on for the ghc
+# package this isn't much slower.However, not building the package saves
+# a significant chunk of disk space.
+compiler_stage1_CONFIGURE_OPTS += --disable-library-for-ghci
+compiler_stage2_CONFIGURE_OPTS += --disable-library-for-ghci
+compiler_stage3_CONFIGURE_OPTS += --disable-library-for-ghci
+
# after build-package, because that sets compiler_stage1_HC_OPTS:
compiler_stage1_HC_OPTS += $(GhcStage1HcOpts)
compiler_stage2_HC_OPTS += $(GhcStage2HcOpts)
diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs
index cc90cb5702..29228b1b7e 100644
--- a/compiler/ghci/Linker.lhs
+++ b/compiler/ghci/Linker.lhs
@@ -1106,41 +1106,28 @@ loadFrameworks pkg
locateOneObj :: [FilePath] -> String -> IO LibrarySpec
locateOneObj dirs lib
| not isDynamicGhcLib
- -- When the GHC package was not compiled as dynamic library
- -- (=DYNAMIC not set), we search for .o libraries.
- = do mb_libSpec <- if cUseArchivesForGhci
- then do mb_arch_path <- findFile mk_arch_path dirs
- case mb_arch_path of
- Just arch_path ->
- return (Just (Archive arch_path))
- Nothing ->
- return Nothing
- else do mb_obj_path <- findFile mk_obj_path dirs
- case mb_obj_path of
- Just obj_path ->
- return (Just (Object obj_path))
- Nothing ->
- return Nothing
- case mb_libSpec of
- Just ls -> return ls
- Nothing -> return (DLL lib)
-
+ -- When the GHC package was not compiled as dynamic library
+ -- (=DYNAMIC not set), we search for .o libraries or, if they
+ -- don't exist, .a libraries.
+ = findObject `orElse` findArchive `orElse` assumeDll
| otherwise
-- When the GHC package was compiled as dynamic library (=DYNAMIC set),
-- we search for .so libraries first.
- = do { mb_lib_path <- findFile mk_dyn_lib_path dirs
- ; case mb_lib_path of
- Just _ -> return (DLL dyn_lib_name)
- Nothing ->
- do { mb_obj_path <- findFile mk_obj_path dirs
- ; case mb_obj_path of
- Just obj_path -> return (Object obj_path)
- Nothing -> return (DLL lib) }} -- We assume
+ = findDll `orElse` findObject `orElse` findArchive `orElse` assumeDll
where
mk_obj_path dir = dir </> (lib <.> "o")
mk_arch_path dir = dir </> ("lib" ++ lib <.> "a")
dyn_lib_name = lib ++ "-ghc" ++ cProjectVersion
mk_dyn_lib_path dir = dir </> mkSOName dyn_lib_name
+ findObject = liftM (fmap Object) $ findFile mk_obj_path dirs
+ findArchive = liftM (fmap Archive) $ findFile mk_arch_path dirs
+ findDll = liftM (fmap DLL) $ findFile mk_dyn_lib_path dirs
+ assumeDll = return (DLL lib)
+ infixr `orElse`
+ f `orElse` g = do m <- f
+ case m of
+ Just x -> return x
+ Nothing -> g
-- ----------------------------------------------------------------------------
-- Loading a dyanmic library (dlopen()-ish on Unix, LoadLibrary-ish on Win32)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 7a4607a4b6..df51f94906 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2285,7 +2285,6 @@ compilerInfo = [("Project name", String cProjectName),
("Object splitting", String cSplitObjs),
("Have native code generator", String cGhcWithNativeCodeGen),
("Have llvm code generator", String cGhcWithLlvmCodeGen),
- ("Use archives for ghci", String (show cUseArchivesForGhci)),
("Support SMP", String cGhcWithSMP),
("Unregisterised", String cGhcUnregisterised),
("Tables next to code", String cGhcEnableTablesNextToCode),