lol
1diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs
2--- a/compiler/ghci/Linker.hs
3+++ b/compiler/ghci/Linker.hs
4@@ -119,9 +119,9 @@
5 -- that is really important
6 pkgs_loaded :: ![PackageKey],
7
8- -- we need to remember the name of the last temporary DLL/.so
9- -- so we can link it
10- last_temp_so :: !(Maybe (FilePath, String)) }
11+ -- we need to remember the name of previous temporary DLL/.so
12+ -- libraries so we can link them (see #10322)
13+ temp_sos :: ![(FilePath, String)] }
14
15
16 emptyPLS :: DynFlags -> PersistentLinkerState
17@@ -131,7 +131,7 @@
18 pkgs_loaded = init_pkgs,
19 bcos_loaded = [],
20 objs_loaded = [],
21- last_temp_so = Nothing }
22+ temp_sos = [] }
23
24 -- Packages that don't need loading, because the compiler
25 -- shares them with the interpreted program.
26@@ -841,19 +841,19 @@
27 dflags2 = dflags1 {
28 -- We don't want the original ldInputs in
29 -- (they're already linked in), but we do want
30- -- to link against the previous dynLoadObjs
31- -- library if there was one, so that the linker
32+ -- to link against previous dynLoadObjs
33+ -- libraries if there were any, so that the linker
34 -- can resolve dependencies when it loads this
35 -- library.
36 ldInputs =
37- case last_temp_so pls of
38- Nothing -> []
39- Just (lp, l) ->
40+ concatMap
41+ (\(lp, l) ->
42 [ Option ("-L" ++ lp)
43 , Option ("-Wl,-rpath")
44 , Option ("-Wl," ++ lp)
45 , Option ("-l" ++ l)
46- ],
47+ ])
48+ (temp_sos pls),
49 -- Even if we're e.g. profiling, we still want
50 -- the vanilla dynamic libraries, so we set the
51 -- ways / build tag to be just WayDyn.
52@@ -868,7 +868,7 @@
53 consIORef (filesToNotIntermediateClean dflags) soFile
54 m <- loadDLL soFile
55 case m of
56- Nothing -> return pls { last_temp_so = Just (libPath, libName) }
57+ Nothing -> return pls { temp_sos = (libPath, libName) : temp_sos pls }
58 Just err -> panic ("Loading temp shared object failed: " ++ err)
59
60 rmDupLinkables :: [Linkable] -- Already loaded