summaryrefslogtreecommitdiff
path: root/compiler/GHC/Runtime/Linker.hs
diff options
context:
space:
mode:
authorWander Hillen <wjw.hillen@gmail.com>2020-09-25 11:41:06 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-13 00:12:47 -0400
commit7fdcce6d4d13a10a1b2336c1d40482c64dba664d (patch)
tree66dfd350e5abef849793060d745d1a1df64e47df /compiler/GHC/Runtime/Linker.hs
parent9bbc84d20d0f50901351246cbe97c45234ca7d95 (diff)
downloadhaskell-7fdcce6d4d13a10a1b2336c1d40482c64dba664d.tar.gz
Initial ShortText code and conversion of package db code
Metric Decrease: Naperian T10421 T10421a T10547 T12150 T12234 T12425 T13035 T18140 T18304 T5837 T6048 T13253-spj T18282 T18223 T3064 T9961 Metric Increase T13701 HFSKJH
Diffstat (limited to 'compiler/GHC/Runtime/Linker.hs')
-rw-r--r--compiler/GHC/Runtime/Linker.hs22
1 files changed, 12 insertions, 10 deletions
diff --git a/compiler/GHC/Runtime/Linker.hs b/compiler/GHC/Runtime/Linker.hs
index aaa74b3625..4477a0ad2f 100644
--- a/compiler/GHC/Runtime/Linker.hs
+++ b/compiler/GHC/Runtime/Linker.hs
@@ -61,6 +61,7 @@ import GHC.Types.SrcLoc
import qualified GHC.Data.Maybe as Maybes
import GHC.Types.Unique.DSet
import GHC.Data.FastString
+import qualified GHC.Data.ShortText as ST
import GHC.Platform
import GHC.SysTools
import GHC.SysTools.FileCleanup
@@ -1282,10 +1283,10 @@ linkPackage hsc_env pkg
let dflags = hsc_dflags hsc_env
platform = targetPlatform dflags
is_dyn = interpreterDynamic (hscInterp hsc_env)
- dirs | is_dyn = Packages.unitLibraryDynDirs pkg
- | otherwise = Packages.unitLibraryDirs pkg
+ dirs | is_dyn = map ST.unpack $ Packages.unitLibraryDynDirs pkg
+ | otherwise = map ST.unpack $ Packages.unitLibraryDirs pkg
- let hs_libs = Packages.unitLibraries pkg
+ let hs_libs = map ST.unpack $ Packages.unitLibraries pkg
-- The FFI GHCi import lib isn't needed as
-- GHC.Runtime.Linker + rts/Linker.c link the
-- interpreted references to FFI to the compiled FFI.
@@ -1300,11 +1301,12 @@ linkPackage hsc_env pkg
-- libs do not exactly match the .so/.dll equivalents. So if the
-- package file provides an "extra-ghci-libraries" field then we use
-- that instead of the "extra-libraries" field.
- extra_libs =
- (if null (Packages.unitExtDepLibsGhc pkg)
- then Packages.unitExtDepLibsSys pkg
- else Packages.unitExtDepLibsGhc pkg)
- ++ [ lib | '-':'l':lib <- Packages.unitLinkerOptions pkg ]
+ extdeplibs = map ST.unpack (if null (Packages.unitExtDepLibsGhc pkg)
+ then Packages.unitExtDepLibsSys pkg
+ else Packages.unitExtDepLibsGhc pkg)
+ linkerlibs = [ lib | '-':'l':lib <- (map ST.unpack $ Packages.unitLinkerOptions pkg) ]
+ extra_libs = extdeplibs ++ linkerlibs
+
-- See Note [Fork/Exec Windows]
gcc_paths <- getGCCPaths dflags (platformOS platform)
dirs_env <- addEnvPaths "LIBRARY_PATH" dirs
@@ -1434,8 +1436,8 @@ loadFrameworks :: HscEnv -> Platform -> UnitInfo -> IO ()
loadFrameworks hsc_env platform pkg
= when (platformUsesFrameworks platform) $ mapM_ load frameworks
where
- fw_dirs = Packages.unitExtDepFrameworkDirs pkg
- frameworks = Packages.unitExtDepFrameworks pkg
+ fw_dirs = map ST.unpack $ Packages.unitExtDepFrameworkDirs pkg
+ frameworks = map ST.unpack $ Packages.unitExtDepFrameworks pkg
load fw = do r <- loadFramework hsc_env fw_dirs fw
case r of