Compiler Flags for SPARC64

Christian Baer christian.baer at uni-dortmund.de
Mon Feb 19 13:14:08 UTC 2007


Hello everybody out there!

Please excuse my posting this question again on this list, but the last
post on the freebsd-sparc64 didn't help much. There isn't really much
traffic on that list.

Assuming that gcc when run on sparc64 produces v7 code (for sun4/4c) by
default, I went about trying to improve that as v7 code is known to be a
fair bit slower as v9 (sun4u) code. The improvement can be as much as
100% for some apps like OpenSSL or OpenSSH.

I went about trying some Compiler flags. -mcpu=ultrasparc and -mcpu=v9
both came into mind. However this lead to several problems of programs
not compiling anymore. Most notably was the failure of 'make buildworld'.

When gcc is told to produce v9 code, it doesn't produce 64bit code (you
have to set -m64 for that), it just uses a few additional commands the
CPU knows, which should make the resulting code faster but no longer
compatible with older CPUs (non-UltraSPARC). This means that there
shouldn't be any problem with pointers that are now "strange" to the
code. But even if I explicitly set the -m32 flag, I still can't make the
world.

I discussed this in a German newsgroup, where someone told me that the
CPU is set to v9 by default on FreeBSD, as it only supports SPARC64 and
not SPARC32. Although this assumption makes sense, I couldn't find any
evidence to back it up. While some compiler flags are set by default
on some platforms for optimization for that particular CPU, there
doesn't seem to be anything set for sparc64. Additionaly, if the mcpu
were really set to ultrasparc or v9, then setting it again shouldn't
cause buildworld to stop with the error "I don't know what platform this
is."

Has anyone got any ideas on how to go on with this?

Regards
Chris


More information about the freebsd-questions mailing list