diff options
author | Ben Gamari <ben@smart-cactus.org> | 2018-10-11 10:31:58 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-10-11 10:31:58 -0400 |
commit | 52b514003c60492f21790a823c488c49ec5fc89d (patch) | |
tree | a87141d383de4bb147dfdb7ae2a8fb751376d462 /compiler/main/SysTools.hs | |
parent | 2fc8ce5f0c8c81771c26266ac0b150ca9b75c5f3 (diff) | |
parent | 7ce9ead4fddfbffb5cb63cce0f1b4533b7bcc0ad (diff) | |
download | haskell-ghc-8.2.tar.gz |
Merge commit '7ce9ead4fddfbffb5cb63cce0f1b4533b7bcc0ad' into ghc-8.2ghc-8.2
John Ericson from Obsidian Systems proposed that we merge these
backports, which Obsidian bases its cross-compiled builds on, to the
upstream stable branch. I don't see why not.
Diffstat (limited to 'compiler/main/SysTools.hs')
-rw-r--r-- | compiler/main/SysTools.hs | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index b2d85a782a..61cc24efcf 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -13,6 +13,7 @@ module SysTools ( -- Initialisation initSysTools, + initLlvmTargets, -- Interface to system tools runUnlit, runCpp, runCc, -- [Option] -> IO () @@ -187,6 +188,20 @@ stuff. ************************************************************************ -} +initLlvmTargets :: Maybe String + -> IO LlvmTargets +initLlvmTargets mbMinusB + = do top_dir <- findTopDir mbMinusB + let llvmTargetsFile = top_dir </> "llvm-targets" + llvmTargetsStr <- readFile llvmTargetsFile + case maybeReadFuzzy llvmTargetsStr of + Just s -> return (fmap mkLlvmTarget <$> s) + Nothing -> pgmError ("Can't parse " ++ show llvmTargetsFile) + where + mkLlvmTarget :: (String, String, String) -> LlvmTarget + mkLlvmTarget (dl, cpu, attrs) = LlvmTarget dl cpu (words attrs) + + initSysTools :: Maybe String -- Maybe TopDir path (without the '-B' prefix) -> IO Settings -- Set all the mutable variables above, holding -- (a) the system programs @@ -322,6 +337,7 @@ initSysTools mbMinusB -- We just assume on command line lc_prog <- getSetting "LLVM llc command" lo_prog <- getSetting "LLVM opt command" + lcc_prog <- getSetting "LLVM clang command" let iserv_prog = libexec "ghc-iserv" @@ -365,6 +381,7 @@ initSysTools mbMinusB sPgm_libtool = libtool_path, sPgm_lo = (lo_prog,[]), sPgm_lc = (lc_prog,[]), + sPgm_lcc = (lcc_prog,[]), sPgm_i = iserv_prog, sOpt_L = [], sOpt_P = [], @@ -373,6 +390,7 @@ initSysTools mbMinusB sOpt_a = [], sOpt_l = [], sOpt_windres = [], + sOpt_lcc = [], sOpt_lo = [], sOpt_lc = [], sOpt_i = [], @@ -587,8 +605,7 @@ runLlvmLlc dflags args = do -- assembler) runClang :: DynFlags -> [Option] -> IO () runClang dflags args = do - -- we simply assume its available on the PATH - let clang = "clang" + let (clang,_) = pgm_lcc dflags -- be careful what options we call clang with -- see #5903 and #7617 for bugs caused by this. (_,args0) = pgm_a dflags @@ -818,9 +835,6 @@ getLinkerInfo' dflags = do -- that doesn't support --version. We can just assume that's -- what we're using. return $ DarwinLD [] - OSiOS -> - -- Ditto for iOS - return $ DarwinLD [] OSMinGW32 -> -- GHC doesn't support anything but GNU ld on Windows anyway. -- Process creation is also fairly expensive on win32, so @@ -1666,7 +1680,7 @@ linkDynLib dflags0 o_files dep_packages ++ pkg_lib_path_opts ++ pkg_link_opts )) - OSDarwin -> do + _ | os == OSDarwin -> do ------------------------------------------------------------------- -- Making a darwin dylib ------------------------------------------------------------------- @@ -1726,7 +1740,6 @@ linkDynLib dflags0 o_files dep_packages ++ map Option pkg_link_opts ++ map Option pkg_framework_opts ) - OSiOS -> throwGhcExceptionIO (ProgramError "dynamic libraries are not supported on iOS target") _ -> do ------------------------------------------------------------------- -- Making a DSO |