Commit 1777f480 authored by rl@cse.unsw.edu.au's avatar rl@cse.unsw.edu.au

Make sure GCC uses the Sparc V9 instruction set

We only support Sparc V9 and better as V8 lacks an atomic CAS instruction
which we need for SMP. This means that we have to pass -mcpu=v9 to GCC when
compiling and assembling. Hardcoding the flag is hackish but seems to be
our best bet at the moment. It can still be overridden by the user as GCC
picks the best -mcpu flag regardless of the ordering.
parent ac548e9f
...@@ -859,6 +859,15 @@ runPhase cc_phase stop dflags basename suff input_fn get_output_fn maybe_loc ...@@ -859,6 +859,15 @@ runPhase cc_phase stop dflags basename suff input_fn get_output_fn maybe_loc
++ map SysTools.Option ( ++ map SysTools.Option (
md_c_flags md_c_flags
++ pic_c_flags ++ pic_c_flags
#ifdef sparc_TARGET_ARCH
-- We only support SparcV9 and better because V8 lacks an atomic CAS
-- instruction. Note that the user can still override this
-- (e.g., -mcpu=ultrasparc) as GCC picks the "best" -mcpu flag
-- regardless of the ordering.
--
-- This is a temporary hack.
++ ["-mcpu=v9"]
#endif
++ (if hcc && mangle ++ (if hcc && mangle
then md_regd_c_flags then md_regd_c_flags
else []) else [])
...@@ -946,6 +955,16 @@ runPhase As stop dflags _basename _suff input_fn get_output_fn maybe_loc ...@@ -946,6 +955,16 @@ runPhase As stop dflags _basename _suff input_fn get_output_fn maybe_loc
SysTools.runAs dflags SysTools.runAs dflags
(map SysTools.Option as_opts (map SysTools.Option as_opts
++ [ SysTools.Option ("-I" ++ p) | p <- cmdline_include_paths ] ++ [ SysTools.Option ("-I" ++ p) | p <- cmdline_include_paths ]
#ifdef sparc_TARGET_ARCH
-- We only support SparcV9 and better because V8 lacks an atomic CAS
-- instruction so we have to make sure that the assembler accepts the
-- instruction set. Note that the user can still override this
-- (e.g., -mcpu=ultrasparc). GCC picks the "best" -mcpu flag
-- regardless of the ordering.
--
-- This is a temporary hack.
++ [ SysTools.Option "-mcpu=v9" ]
#endif
++ [ SysTools.Option "-c" ++ [ SysTools.Option "-c"
, SysTools.FileOption "" input_fn , SysTools.FileOption "" input_fn
, SysTools.Option "-o" , SysTools.Option "-o"
......
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