X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FDriverPipeline.hs;h=6721b9154c2eb15a2030b262f89850cabbf30918;hb=aa9a4f1053d3c554629a2ec25955e7530c95b892;hp=0db12cd2546971365dea6762c98808dbf1951c33;hpb=6837025d796bf1487be3d572937e18d0e2cf727b;p=ghc-hetmet.git diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 0db12cd..6721b91 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1,3 +1,6 @@ +{-# OPTIONS -fno-cse #-} +-- -fno-cse is needed for GLOBAL_VAR's to behave properly + ----------------------------------------------------------------------------- -- -- GHC Driver @@ -47,7 +50,7 @@ import SrcLoc ( unLoc ) import SrcLoc ( Located(..) ) import FastString -import Control.Exception as Exception +import Exception import Data.IORef ( readIORef, writeIORef, IORef ) import GHC.Exts ( Int(..) ) import System.Directory @@ -348,7 +351,7 @@ compileFile :: HscEnv -> Phase -> (FilePath, Maybe Phase) -> IO FilePath compileFile hsc_env stop_phase (src, mb_phase) = do exists <- doesFileExist src when (not exists) $ - throwDyn (CmdLineError ("does not exist: " ++ src)) + ghcError (CmdLineError ("does not exist: " ++ src)) let dflags = hsc_dflags hsc_env @@ -448,7 +451,7 @@ runPipeline stop_phase hsc_env0 (input_fn, mb_phase) mb_basename output maybe_lo -- before B in a normal compilation pipeline. when (not (start_phase `happensBefore` stop_phase)) $ - throwDyn (UsageError + ghcError (UsageError ("cannot compile this file to desired target: " ++ input_fn)) @@ -774,7 +777,7 @@ runPhase (Hsc src_flavour) stop hsc_env basename suff input_fn get_output_fn _ma Nothing -- No "module i of n" progress info case mbResult of - Nothing -> throwDyn (PhaseFailed "hsc" (ExitFailure 1)) + Nothing -> ghcError (PhaseFailed "hsc" (ExitFailure 1)) Just HscNoRecomp -> do SysTools.touch dflags' "Touching object file" o_file -- The .o file must have a later modification date @@ -815,7 +818,7 @@ runPhase Cmm stop hsc_env basename _ input_fn get_output_fn maybe_loc ok <- hscCmmFile hsc_env' input_fn - when (not ok) $ throwDyn (PhaseFailed "cmm" (ExitFailure 1)) + when (not ok) $ ghcError (PhaseFailed "cmm" (ExitFailure 1)) return (next_phase, dflags, maybe_loc, output_fn) @@ -1349,7 +1352,7 @@ linkBinary dflags o_files dep_packages = do -- parallel only: move binary to another dir -- HWL success <- runPhase_MoveBinary dflags output_fn dep_packages if success then return () - else throwDyn (InstallationError ("cannot move binary")) + else ghcError (InstallationError ("cannot move binary")) exeFileName :: DynFlags -> FilePath @@ -1430,13 +1433,19 @@ linkDynLib dflags o_files dep_packages = do let verb = getVerbFlag dflags let o_file = outputFile dflags - pkg_lib_paths <- getPackageLibraryPath dflags dep_packages + -- We don't want to link our dynamic libs against the RTS package, + -- because the RTS lib comes in several flavours and we want to be + -- able to pick the flavour when a binary is linked. + pkgs <- getPreloadPackagesAnd dflags dep_packages + let pkgs_no_rts = filter ((/= rtsPackageId) . packageConfigId) pkgs + + let pkg_lib_paths = collectLibraryPaths pkgs_no_rts let pkg_lib_path_opts = map ("-L"++) pkg_lib_paths let lib_paths = libraryPaths dflags let lib_path_opts = map ("-L"++) lib_paths - pkg_link_opts <- getPackageLinkOpts dflags dep_packages + let pkg_link_opts = collectLinkOpts dflags pkgs_no_rts -- probably _stub.o files extra_ld_inputs <- readIORef v_Ld_inputs