summaryrefslogtreecommitdiff
path: root/ghc/compiler/ghci/Linker.lhs
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-12-12 17:36:19 +0000
committersimonmar <unknown>2002-12-12 17:36:19 +0000
commitb3016a12ae6495234f9521a73ab223ab05aaa766 (patch)
tree4c13dff7f63e82c12b6ef035bd04b04a9617d218 /ghc/compiler/ghci/Linker.lhs
parent6d353fcbc9480b46cc675b5d7f077fd6cecee377 (diff)
downloadhaskell-b3016a12ae6495234f9521a73ab223ab05aaa766.tar.gz
[project @ 2002-12-12 17:36:16 by simonmar]
A modification to the way we build link lines. Currently the link line is constructed like this, for packages p1, p2 etc.: libraries p1 ++ extra_libs p1 ++ libraries p2 ++ extra_libs p2 ++ ... extra_ld_opts p1 ++ extra_ld_opts p2 ++ .. This change makes it follow this pattern: libraries p1 ++ extra_libs p1 ++ extra_ld_opts p1 ++ libraries p2 ++ extra_libs p2 ++ extra_ld_opts p2 ++ ... which seems more useful: in particular it means that using foo-config (eg. gtk-config) to populate extra_ld_opts should now work properly, and extra_libs is no longer strictly speaking needed (you can just use -l options in extra_ld_opts and get the same effect). Also: - There's now no difference between -l<lib> and -optl-l<lib> - GHCi grabs libs from extra_ld_opts as well as extra_libs
Diffstat (limited to 'ghc/compiler/ghci/Linker.lhs')
-rw-r--r--ghc/compiler/ghci/Linker.lhs8
1 files changed, 5 insertions, 3 deletions
diff --git a/ghc/compiler/ghci/Linker.lhs b/ghc/compiler/ghci/Linker.lhs
index 9baebc2a72..d71bcd7f1d 100644
--- a/ghc/compiler/ghci/Linker.lhs
+++ b/ghc/compiler/ghci/Linker.lhs
@@ -30,8 +30,8 @@ import ByteCodeItbls ( ItblEnv )
import ByteCodeAsm ( CompiledByteCode(..), bcoFreeNames, UnlinkedBCO(..))
import Packages
-import DriverState ( v_Library_paths, v_Cmdline_libraries,
- getPackageConfigMap )
+import DriverState ( v_Library_paths, v_Opt_l, getPackageConfigMap,
+ getStaticOpts )
import Finder ( findModule, findLinkable )
import HscTypes
import Name ( Name, nameModule, isExternalName )
@@ -384,7 +384,8 @@ linkLibraries :: DynFlags
-- specified on the command line.
linkLibraries dflags objs
= do { lib_paths <- readIORef v_Library_paths
- ; minus_ls <- readIORef v_Cmdline_libraries
+ ; opt_l <- getStaticOpts v_Opt_l
+ ; let minus_ls = [ lib | '-':'l':lib <- opt_l ]
; let cmdline_lib_specs = map Object objs ++ map DLL minus_ls
; if (null cmdline_lib_specs) then return ()
@@ -671,6 +672,7 @@ linkPackage dflags pkg
= do
let dirs = Packages.library_dirs pkg
let libs = Packages.hs_libraries pkg ++ extra_libraries pkg
+ ++ [ lib | '-':'l':lib <- extra_ld_opts pkg ]
classifieds <- mapM (locateOneObj dirs) libs
#ifdef darwin_TARGET_OS
let fwDirs = Packages.framework_dirs pkg