Commit d0608373 authored by Simon Marlow's avatar Simon Marlow

Only add -O to C compilations if there was -O on the command line

In 1e2b3780 I changed the option
ordering for C compilations.  A side effect was that -optc options
came before the automatic -O we were adding, which made it so that the
-debug RTS was getting optimised when it shouldn't have been.

Perhaps we shouldn't have automatic -O options added to C
compilations.  But that might cause problems for build systems that
are relying on the current behaviour, so I've made a minor change
instead: now C optimisation level == Haskell optimisation level.
parent bdfefb3b
......@@ -1116,8 +1116,9 @@ runPhase (RealPhase cc_phase) input_fn dflags
split_opt | hcc && split_objs = [ "-DUSE_SPLIT_MARKERS" ]
| otherwise = [ ]
let cc_opt | optLevel dflags >= 2 = "-O2"
| otherwise = "-O"
let cc_opt | optLevel dflags >= 2 = [ "-O2" ]
| optLevel dflags >= 1 = [ "-O" ]
| otherwise = []
-- Decide next phase
let next_phase = As
......@@ -1187,7 +1188,8 @@ runPhase (RealPhase cc_phase) input_fn dflags
then gcc_extra_viac_flags ++ more_hcc_opts
else [])
++ verbFlags
++ [ "-S", cc_opt ]
++ [ "-S" ]
++ cc_opt
++ [ "-D__GLASGOW_HASKELL__="++cProjectVersionInt ]
++ framework_paths
++ split_opt
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment