59 lines
2.7 KiB
Diff
59 lines
2.7 KiB
Diff
|
From 4177e22ecf45b33758d19780dbf4ab32fed6cbac Mon Sep 17 00:00:00 2001
|
||
|
From: Peter Trommler <peter.trommler@th-nuernberg.de>
|
||
|
Date: Mon, 14 Dec 2015 19:16:22 +0100
|
||
|
Subject: [PATCH 1/1] link command line libs to temp so
|
||
|
|
||
|
Symbols in libraries specified on the GHCis command line are
|
||
|
not available to compiled modules because shared libraries
|
||
|
are loaded with local scope. So we link all libraries specified
|
||
|
on the command line into each temporary shared library.
|
||
|
---
|
||
|
compiler/ghci/Linker.hs | 15 ++++++++++++++-
|
||
|
1 file changed, 14 insertions(+), 1 deletion(-)
|
||
|
|
||
|
Index: ghc-7.10.3/compiler/ghci/Linker.hs
|
||
|
===================================================================
|
||
|
--- ghc-7.10.3.orig/compiler/ghci/Linker.hs
|
||
|
+++ ghc-7.10.3/compiler/ghci/Linker.hs
|
||
|
@@ -818,11 +818,14 @@ dynLoadObjs :: DynFlags -> PersistentLin
|
||
|
dynLoadObjs _ pls [] = return pls
|
||
|
dynLoadObjs dflags pls objs = do
|
||
|
let platform = targetPlatform dflags
|
||
|
+ let minus_ls = [ lib | Option ('-':'l':lib) <- ldInputs dflags ]
|
||
|
+ let minus_big_ls = [ lib | Option ('-':'L':lib) <- ldInputs dflags ]
|
||
|
(soFile, libPath , libName) <- newTempLibName dflags (soExt platform)
|
||
|
let -- When running TH for a non-dynamic way, we still need to make
|
||
|
-- -l flags to link against the dynamic libraries, so we turn
|
||
|
-- Opt_Static off
|
||
|
dflags1 = gopt_unset dflags Opt_Static
|
||
|
+
|
||
|
dflags2 = dflags1 {
|
||
|
-- We don't want the original ldInputs in
|
||
|
-- (they're already linked in), but we do want
|
||
|
@@ -838,7 +841,16 @@ dynLoadObjs dflags pls objs = do
|
||
|
, Option ("-Wl," ++ lp)
|
||
|
, Option ("-l" ++ l)
|
||
|
])
|
||
|
- (temp_sos pls),
|
||
|
+ (temp_sos pls)
|
||
|
+ ++ concatMap
|
||
|
+ (\lp ->
|
||
|
+ [ Option ("-L" ++ lp)
|
||
|
+ , Option ("-Wl,-rpath")
|
||
|
+ , Option ("-Wl," ++ lp)
|
||
|
+ ])
|
||
|
+ minus_big_ls
|
||
|
+ ++ map (\l -> Option ("-l" ++ l)) minus_ls,
|
||
|
+ -- add -l options and -L options from dflags
|
||
|
-- Even if we're e.g. profiling, we still want
|
||
|
-- the vanilla dynamic libraries, so we set the
|
||
|
-- ways / build tag to be just WayDyn.
|
||
|
@@ -1031,6 +1043,7 @@ data LibrarySpec
|
||
|
|
||
|
| Framework String -- Only used for darwin, but does no harm
|
||
|
|
||
|
+
|
||
|
-- 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.
|