[commit: ghc] master: Fix #9047 (b847481)
git at git.haskell.org
git at git.haskell.org
Mon Jun 23 06:28:19 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/b84748121e777d098198f2583d11a9424c1b1650/ghc
>---------------------------------------------------------------
commit b84748121e777d098198f2583d11a9424c1b1650
Author: Austin Seipp <austin at well-typed.com>
Date: Mon Jun 23 00:07:10 2014 -0500
Fix #9047
Signed-off-by: Austin Seipp <austin at well-typed.com>
>---------------------------------------------------------------
b84748121e777d098198f2583d11a9424c1b1650
compiler/main/DriverPipeline.hs | 46 ++++++++++++++++++++++-------------------
compiler/main/DynFlags.hs | 2 ++
compiler/main/SysTools.lhs | 7 +++++--
3 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 39df2a1..b90a821 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1206,6 +1206,7 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags
-- might be a hierarchical module.
liftIO $ createDirectoryIfMissing True (takeDirectory output_fn)
+ ccInfo <- liftIO $ getCompilerInfo dflags
let runAssembler inputFilename outputFilename
= liftIO $ as_prog dflags
([ SysTools.Option ("-I" ++ p) | p <- cmdline_include_paths ]
@@ -1220,7 +1221,9 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags
++ (if platformArch (targetPlatform dflags) == ArchSPARC
then [SysTools.Option "-mcpu=v9"]
else [])
-
+ ++ (if ccInfo == AppleClang51
+ then [SysTools.Option "-Qunused-arguments"]
+ else [])
++ [ SysTools.Option "-x"
, if with_cpp
then SysTools.Option "assembler-with-cpp"
@@ -2129,26 +2132,27 @@ joinObjectFiles dflags o_files output_fn = do
let mySettings = settings dflags
ldIsGnuLd = sLdIsGnuLd mySettings
osInfo = platformOS (targetPlatform dflags)
- ld_r args ccInfo = SysTools.runLink dflags ([
- SysTools.Option "-nostdlib",
- SysTools.Option "-Wl,-r"
- ]
- ++ (if ccInfo == Clang then []
- else [SysTools.Option "-nodefaultlibs"])
- ++ (if osInfo == OSFreeBSD
- then [SysTools.Option "-L/usr/lib"]
- else [])
- -- gcc on sparc sets -Wl,--relax implicitly, but
- -- -r and --relax are incompatible for ld, so
- -- disable --relax explicitly.
- ++ (if platformArch (targetPlatform dflags) == ArchSPARC
- && ldIsGnuLd
- then [SysTools.Option "-Wl,-no-relax"]
- else [])
- ++ map SysTools.Option ld_build_id
- ++ [ SysTools.Option "-o",
- SysTools.FileOption "" output_fn ]
- ++ args)
+ ld_r args cc = SysTools.runLink dflags ([
+ SysTools.Option "-nostdlib",
+ SysTools.Option "-Wl,-r"
+ ]
+ ++ (if any (cc ==) [Clang, AppleClang, AppleClang51]
+ then []
+ else [SysTools.Option "-nodefaultlibs"])
+ ++ (if osInfo == OSFreeBSD
+ then [SysTools.Option "-L/usr/lib"]
+ else [])
+ -- gcc on sparc sets -Wl,--relax implicitly, but
+ -- -r and --relax are incompatible for ld, so
+ -- disable --relax explicitly.
+ ++ (if platformArch (targetPlatform dflags) == ArchSPARC
+ && ldIsGnuLd
+ then [SysTools.Option "-Wl,-no-relax"]
+ else [])
+ ++ map SysTools.Option ld_build_id
+ ++ [ SysTools.Option "-o",
+ SysTools.FileOption "" output_fn ]
+ ++ args)
-- suppress the generation of the .note.gnu.build-id section,
-- which we don't need and sometimes causes ld to emit a
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 7222af3..f82c404 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -3757,6 +3757,8 @@ data LinkerInfo
data CompilerInfo
= GCC
| Clang
+ | AppleClang
+ | AppleClang51
| UnknownCC
deriving Eq
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
index dc9642d..51d5af1 100644
--- a/compiler/main/SysTools.lhs
+++ b/compiler/main/SysTools.lhs
@@ -788,12 +788,15 @@ getCompilerInfo' dflags = do
-- Regular clang
| any ("clang version" `isPrefixOf`) stde =
return Clang
+ -- XCode 5.1 clang
+ | any ("Apple LLVM version 5.1" `isPrefixOf`) stde =
+ return AppleClang51
-- XCode 5 clang
| any ("Apple LLVM version" `isPrefixOf`) stde =
- return Clang
+ return AppleClang
-- XCode 4.1 clang
| any ("Apple clang version" `isPrefixOf`) stde =
- return Clang
+ return AppleClang
-- Unknown linker.
| otherwise = fail "invalid -v output, or compiler is unsupported"
More information about the ghc-commits
mailing list