X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FDriverPipeline.hs;h=88b6b9045fecf84a3483736097651f56975c7763;hb=e1b45af148b2db08518a543f58c28a60c1f815b6;hp=ef2c239177dd99ba96cca42e46c10e20d7cefd27;hpb=7eb5e29b4a7b6fef55512bc7bf3308e712ca3eba;p=ghc-hetmet.git diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index ef2c239..88b6b90 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -58,7 +58,6 @@ import Data.List ( isSuffixOf ) import Data.Maybe import System.Exit import System.Environment -import System.FilePath -- --------------------------------------------------------------------------- -- Pre-process @@ -583,17 +582,22 @@ runPhase :: Phase -- Do this phase first -- Unlit phase runPhase (Unlit sf) _stop dflags _basename _suff input_fn get_output_fn maybe_loc - = do let unlit_flags = getOpts dflags opt_L - -- The -h option passes the file name for unlit to put in a #line directive + = do output_fn <- get_output_fn dflags (Cpp sf) maybe_loc - SysTools.runUnlit dflags - (map SysTools.Option unlit_flags ++ - [ SysTools.Option "-h" - , SysTools.Option input_fn - , SysTools.FileOption "" input_fn - , SysTools.FileOption "" output_fn - ]) + let unlit_flags = getOpts dflags opt_L + flags = map SysTools.Option unlit_flags ++ + [ -- The -h option passes the file name for unlit to + -- put in a #line directive + SysTools.Option "-h" + -- cpp interprets \b etc as escape sequences, + -- so we use / for filenames in pragmas + , SysTools.Option $ reslash Forwards $ normalise input_fn + , SysTools.FileOption "" input_fn + , SysTools.FileOption "" output_fn + ] + + SysTools.runUnlit dflags flags return (Cpp sf, dflags, maybe_loc, output_fn) @@ -1215,7 +1219,12 @@ linkBinary dflags o_files dep_packages = do framework_opts = concat [ ["-framework", fw] | fw <- reverse frameworks ] -- reverse because they're added in reverse order from the cmd line #endif - +#ifdef mingw32_TARGET_OS + let dynMain = if not opt_Static then + (head (libraryDirs (getPackageDetails (pkgState dflags) rtsPackageId))) ++ "/Main.dyn_o" + else + "" +#endif -- probably _stub.o files extra_ld_inputs <- readIORef v_Ld_inputs @@ -1257,6 +1266,9 @@ linkBinary dflags o_files dep_packages = do ++ map SysTools.Option ( md_c_flags ++ o_files +#ifdef mingw32_TARGET_OS + ++ [dynMain] +#endif ++ extra_ld_inputs ++ lib_path_opts ++ extra_ld_opts