summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>2009-09-17 04:41:21 +0000
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>2009-09-17 04:41:21 +0000
commitc2cd83e7d85c11e6a33e1cde263eb2312566d535 (patch)
treee9c96c20e74ff2f82ca2d63c3b2022e634051bb2
parentb9dc90050bf28adeb03e429aac4809661f6080ef (diff)
downloadhaskell-c2cd83e7d85c11e6a33e1cde263eb2312566d535.tar.gz
Fix build on Mac OS 10.6 (Snow Leopard)
- We have -m32 as machine-dependent option for gcc for a 32 bit build - Like on OpenBSD, SL requires -fno-stack-protector to avoid triggering the stack smashing checks inserted by gcc by default on this platform.
-rw-r--r--compiler/main/DriverPipeline.hs10
-rw-r--r--compiler/main/DynFlags.hs14
-rw-r--r--rts/ghc.mk2
3 files changed, 15 insertions, 11 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 1e342a038f..c095abc5a5 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -988,7 +988,8 @@ runPhase cc_phase _stop hsc_env _basename _suff input_fn get_output_fn maybe_loc
-- Also useful for plain .c files, just in case GHC saw a
-- -x c option.
[ SysTools.Option "-x", if cc_phase `eqPhase` Ccpp
- then SysTools.Option "c++" else SysTools.Option "c"] ++
+ then SysTools.Option "c++"
+ else SysTools.Option "c"] ++
[ SysTools.FileOption "" input_fn
, SysTools.Option "-o"
, SysTools.FileOption "" output_fn
@@ -1005,13 +1006,6 @@ runPhase cc_phase _stop hsc_env _basename _suff input_fn get_output_fn maybe_loc
-- This is a temporary hack.
++ ["-mcpu=v9"]
#endif
-#if defined(darwin_TARGET_OS) && defined(i386_TARGET_ARCH)
- -- By default, gcc on OS X will generate SSE
- -- instructions, which need things 16-byte aligned,
- -- but we don't 16-byte align things. Thus drop
- -- back to generic i686 compatibility. Trac #2983.
- ++ ["-march=i686"]
-#endif
++ (if hcc && mangle
then md_regd_c_flags
else [])
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 850a3064ad..46c9d200ac 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2293,10 +2293,20 @@ machdepCCOpts _dflags
-- -fomit-frame-pointer : *must* in .hc files; because we're stealing
-- the fp (%ebp) for our register maps.
= let n_regs = stolen_x86_regs _dflags
- sta = opt_Static
in
- ( [ if sta then "-DDONT_WANT_WIN32_DLL_SUPPORT" else ""
+ (
+#if darwin_TARGET_OS
+ -- By default, gcc on OS X will generate SSE
+ -- instructions, which need things 16-byte aligned,
+ -- but we don't 16-byte align things. Thus drop
+ -- back to generic i686 compatibility. Trac #2983.
+ --
+ -- Since Snow Leopard (10.6), gcc defaults to x86_64.
+ ["-march=i686", "-m32"],
+#else
+ [ if opt_Static then "-DDONT_WANT_WIN32_DLL_SUPPORT" else ""
],
+#endif
[ "-fno-defer-pop",
"-fomit-frame-pointer",
-- we want -fno-builtin, because when gcc inlines
diff --git a/rts/ghc.mk b/rts/ghc.mk
index 9c33896621..970adaa1a7 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -191,7 +191,7 @@ rts_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
rts_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
# Otherwise the stack-smash handler gets triggered.
-ifeq "$(TargetOS_CPP)" "openbsd"
+ifneq "$(findstring $(TargetOS_CPP), darwin openbsd)" ""
rts_HC_OPTS += -optc-fno-stack-protector
endif