diff options
author | Simon Marlow <marlowsd@gmail.com> | 2017-03-31 22:47:47 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-03-31 22:47:49 -0400 |
commit | 308287999fcc929891fbcf1221525dd7cbb77860 (patch) | |
tree | 3a381468905d165d747204e8f563751b63e8e888 /compiler/main/SysTools.hs | |
parent | 546c2a17ae3b21448f7fd467cc47807ae977e51f (diff) | |
download | haskell-308287999fcc929891fbcf1221525dd7cbb77860.tar.gz |
askCc should be using the linker, not the compiler
When GHCi tries to find a shared lib, it calls "gcc --print-file-name"
to ask gcc where to find it. But since we're looking for libraries,
we're really using the linker here, not the C compiler, so we should be
respecting the values of -pgml and -optl rather than -pgmc and -optc.
Test Plan: validate
Reviewers: bgamari, niteria, austin, hvr, erikd
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3393
Diffstat (limited to 'compiler/main/SysTools.hs')
-rw-r--r-- | compiler/main/SysTools.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 1b567e966a..fd3faf1851 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -31,7 +31,7 @@ module SysTools ( linkDynLib, - askCc, + askLd, touch, -- String -> String -> IO () copy, @@ -480,11 +480,12 @@ runCc dflags args = do isContainedIn :: String -> String -> Bool xs `isContainedIn` ys = any (xs `isPrefixOf`) (tails ys) -askCc :: DynFlags -> [Option] -> IO String -askCc dflags args = do - let (p,args0) = pgm_c dflags - args1 = map Option (getOpts dflags opt_c) - args2 = args0 ++ args1 ++ args +-- | Run the linker with some arguments and return the output +askLd :: DynFlags -> [Option] -> IO String +askLd dflags args = do + let (p,args0) = pgm_l dflags + args1 = map Option (getOpts dflags opt_l) + args2 = args0 ++ args1 ++ args mb_env <- getGccEnv args2 runSomethingWith dflags "gcc" p args2 $ \real_args -> readCreateProcessWithExitCode' (proc p real_args){ env = mb_env } |