sparc -mcpu=v9 is not used in assembly phase
|Reported by:||duncan||Owned by:||igloo|
|Type of failure:||Test Case:|
|Related Tickets:||Differential Rev(s):|
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.
Change History (4)
comment:2 Changed 7 years ago by igloo
- difficulty set to Unknown
- Milestone set to 6.10.2
- Priority changed from normal to high