summaryrefslogtreecommitdiff
path: root/compiler/ghci/Linker.hs
diff options
context:
space:
mode:
authorPeter Trommler <ptrommler@acm.org>2016-01-15 13:25:38 +0100
committerBen Gamari <ben@smart-cactus.org>2016-01-15 13:25:53 +0100
commitc6a3e2277aef2d3b8a472cc82542c9b22cea86bf (patch)
treeb63176e90f862592d759282702140711cddd29d3 /compiler/ghci/Linker.hs
parentfaf3f96f6e08c7e5bebc974f7e71580df0c11241 (diff)
downloadhaskell-c6a3e2277aef2d3b8a472cc82542c9b22cea86bf.tar.gz
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. Test Plan: validate Reviewers: simonmar, hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1631 GHC Trac Issues: #10458
Diffstat (limited to 'compiler/ghci/Linker.hs')
-rw-r--r--compiler/ghci/Linker.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs
index 8f1107fc26..44d272ec23 100644
--- a/compiler/ghci/Linker.hs
+++ b/compiler/ghci/Linker.hs
@@ -846,6 +846,8 @@ dynLoadObjs _ pls [] = return pls
dynLoadObjs hsc_env pls objs = do
let dflags = hsc_dflags hsc_env
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
dflags2 = dflags {
@@ -863,7 +865,17 @@ dynLoadObjs hsc_env 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.
+ --
-- When running TH for a non-dynamic way, we still
-- need to make -l flags to link against the dynamic
-- libraries, so we need to add WayDyn to ways.