[project @ 2006-01-06 16:30:17 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverPipeline.hs
index 07fe113..171cecf 100644 (file)
@@ -330,7 +330,10 @@ link BatchCompile dflags batch_attempt_linking hpt
                                 <+> text "...")
 
        -- Don't showPass in Batch mode; doLink will do that for us.
-        staticLink dflags obj_files pkg_deps
+       let link = case ghcLink dflags of
+               MkDLL       -> doMkDLL
+               StaticLink  -> staticLink
+       link dflags obj_files pkg_deps
 
         debugTraceMsg dflags 3 (text "link: done")
 
@@ -852,6 +855,23 @@ runPhase cc_phase stop dflags basename suff input_fn get_output_fn maybe_loc
                | otherwise         = As
        output_fn <- get_output_fn next_phase maybe_loc
 
+       let
+         more_hcc_opts =
+#if i386_TARGET_ARCH
+               -- on x86 the floating point regs have greater precision
+               -- than a double, which leads to unpredictable results.
+               -- By default, we turn this off with -ffloat-store unless
+               -- the user specified -fexcess-precision.
+               (if excessPrecision then [] else [ "-ffloat-store" ]) ++
+#endif
+               -- gcc's -fstrict-aliasing allows two accesses to memory
+               -- to be considered non-aliasing if they have different types.
+               -- This interacts badly with the C code we generate, which is
+               -- very weakly typed, being derived from C--.
+               ["-fno-strict-aliasing"]
+
+
+
        SysTools.runCc dflags (
                -- force the C compiler to interpret this file as C when
                -- compiling .hc files, by adding the -x c option.
@@ -868,13 +888,13 @@ runPhase cc_phase stop dflags basename suff input_fn get_output_fn maybe_loc
                       ++ (if hcc && mangle
                             then md_regd_c_flags
                             else [])
+                      ++ (if hcc 
+                            then more_hcc_opts
+                            else [])
                       ++ [ verb, "-S", "-Wimplicit", "-O" ]
                       ++ [ "-D__GLASGOW_HASKELL__="++cProjectVersionInt ]
                       ++ cc_opts
                       ++ split_opt
-#if x86_TARGET_ARCH
-                      ++ (if excessPrecision then [] else [ "-ffloat-store" ])
-#endif
                       ++ include_paths
                       ++ pkg_extra_cc_opts
                       ))
@@ -1376,9 +1396,9 @@ getOptionsFromSource file
                       | otherwise -> return []
 
 getOptionsFromStringBuffer :: StringBuffer -> FilePath -> [(Int,String)]
-getOptionsFromStringBuffer buffer@(StringBuffer _ len# _) fn = 
+getOptionsFromStringBuffer buffer@(StringBuffer _ len _) fn = 
   let 
-       ls = lines (lexemeToString buffer (I# len#))  -- lazy, so it's ok
+       ls = lines (lexemeToString buffer len)  -- lazy, so it's ok
   in
   look 1 ls
   where