[commit: ghc] master: Fix llvm backend when 32bit build on 64bit OSX. (#7617) (fa1e593)
David Terei
davidterei at gmail.com
Wed Jan 23 09:55:07 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/fa1e5933bf39f3c4cc09457f7fc9d7e928b5e611
>---------------------------------------------------------------
commit fa1e5933bf39f3c4cc09457f7fc9d7e928b5e611
Author: David Terei <davidterei at gmail.com>
Date: Tue Jan 22 23:05:46 2013 -0800
Fix llvm backend when 32bit build on 64bit OSX. (#7617)
>---------------------------------------------------------------
compiler/main/DriverPipeline.hs | 16 ++++++++--------
compiler/main/SysTools.lhs | 13 ++++++++++---
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index f14bfbe..4daaca3 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1232,18 +1232,18 @@ runPhase As input_fn dflags
let whichAsProg | hscTarget dflags == HscLlvm &&
platformOS (targetPlatform dflags) == OSDarwin
= do
+ -- be careful what options we call clang with
+ -- see #5903 and #7617 for bugs caused by this.
llvmVer <- liftIO $ figureLlvmVersion dflags
return $ case llvmVer of
- Just n | n >= 30 ->
- (SysTools.runClang, getOpts dflags opt_c)
+ Just n | n >= 30 -> SysTools.runClang
+ _ -> SysTools.runAs
- _ -> (SysTools.runAs, getOpts dflags opt_a)
+ | otherwise = return SysTools.runAs
- | otherwise
- = return (SysTools.runAs, getOpts dflags opt_a)
-
- (as_prog, as_opts) <- whichAsProg
- let cmdline_include_paths = includePaths dflags
+ as_prog <- whichAsProg
+ let as_opts = getOpts dflags opt_a
+ cmdline_include_paths = includePaths dflags
next_phase <- maybeMergeStub
output_fn <- phaseOutputFilename next_phase
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
index f4e5f2c..28ff499 100644
--- a/compiler/main/SysTools.lhs
+++ b/compiler/main/SysTools.lhs
@@ -527,12 +527,19 @@ runClang :: DynFlags -> [Option] -> IO ()
runClang dflags args = do
-- we simply assume its available on the PATH
let clang = "clang"
+ -- be careful what options we call clang with
+ -- see #5903 and #7617 for bugs caused by this.
+ (_,args0) = pgm_a dflags
+ args1 = args0 ++ args
+ mb_env <- getGccEnv args1
Exception.catch (do
- runSomething dflags "Clang (Assembler)" clang args
+ runSomethingFiltered dflags id "Clang (Assembler)" clang args1 mb_env
)
(\(err :: SomeException) -> do
- errorMsg dflags $ text $ "Error running clang! you need clang installed"
- ++ " to use the LLVM backend"
+ errorMsg dflags $
+ text ("Error running clang! you need clang installed to use the" ++
+ "LLVM backend") $+$
+ text "(or GHC tried to execute clang incorrectly)"
throw err
)
More information about the ghc-commits
mailing list