Commit c2cd83e7 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.

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.
parent b9dc9005
......@@ -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
......@@ -1004,13 +1005,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
......
......@@ -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
......
......@@ -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
......
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