summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-11-18 12:40:20 -0600
committerAustin Seipp <austin@well-typed.com>2014-12-15 08:55:58 -0600
commit550877a8496d57dcab30f7864a84833df5e13d19 (patch)
tree3377c2e6821fa30ea1ea55d33091b6829a1c9fa8
parent3b65fb4f440f8e8da14f3285fa41fc06ff5b909a (diff)
downloadhaskell-550877a8496d57dcab30f7864a84833df5e13d19.tar.gz
Fix detection of GNU gold linker if invoked via gcc with parameters
Previously the linker was called without any commandline parameters to detect whether bfd or gold is used. However the -fuse-ld parameter can be used to switch between gold and bfd and should be taken into account here. Trac #9336 Signed-off-by: Austin Seipp <austin@well-typed.com> (cherry picked from commit e7b414a3cc0e27049f2608f5e0a00c47146cc46d)
-rw-r--r--compiler/main/SysTools.lhs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
index cd9b9f57e2..8c02cc4033 100644
--- a/compiler/main/SysTools.lhs
+++ b/compiler/main/SysTools.lhs
@@ -739,7 +739,10 @@ getLinkerInfo' :: DynFlags -> IO LinkerInfo
getLinkerInfo' dflags = do
let platform = targetPlatform dflags
os = platformOS platform
- (pgm,_) = pgm_l dflags
+ (pgm,args0) = pgm_l dflags
+ args1 = map Option (getOpts dflags opt_l)
+ args2 = args0 ++ args1
+ args3 = filter notNull (map showOpt args2)
-- Try to grab the info from the process output.
parseLinkerInfo stdo _stde _exitc
@@ -790,7 +793,7 @@ getLinkerInfo' dflags = do
-- In practice, we use the compiler as the linker here. Pass
-- -Wl,--version to get linker version info.
(exitc, stdo, stde) <- readProcessEnvWithExitCode pgm
- ["-Wl,--version"]
+ (["-Wl,--version"] ++ args3)
en_locale_env
-- Split the output by lines to make certain kinds
-- of processing easier. In particular, 'clang' and 'gcc'