#2872: sparc -mcpu=v9 is not used in assembly phase
--------------------+-------------------------------------------------------
Reporter: duncan | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.8.3 | Severity: normal
Keywords: | Testcase:
Os: Solaris | Architecture: sparc
--------------------+-------------------------------------------------------
The ghc `DriverPipeline.hs` adds `-mcpu=v9` when compiling .hs files on
sparc:
{{{
#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
}}}
This is great, but it does not add -mcpu=v9 when it calls gcc to assemble
the .s file. So it fails because the .s file uses v9 instructions but
we're not telling the assembler to use v9:
{{{
/tmp/ghc16216_0/ghc16216_0.split__1.s:22:0:
Error: Architecture mismatch on "blu,pn %icc,.LL4".
/tmp/ghc16216_0/ghc16216_0.split__1.s:22:0:
(Requires v9|v9a|v9b; requested architecture is v8.)
}}}
If one re-runs that failing command with -opta-mcpu=v9 then of course it
works.
The general rule is that any -mcpu flags passed to gcc at the compile
stage also have to be passed to gcc at the assembly phase.
Looking at the code it appears that the `-mcpu=v9` flag is passed for the
`HCc` and `As` but not `SplitAs` phases. Of course the `SplitAs` phase is
used during ghc bootstrapping which is where I found this failure. This is
in ghc-6.8.3 but the code looks to be the same in 6.10 so I don't think
it's already been fixed.
The workaround is to use `SRC_HC_OPTS=-opta-mcpu=v9` in `mk/build.mk`.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2872>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs