good (working) CFLAGS for SPARC64

Christian Baer christian.baer at
Thu Feb 1 12:52:28 UTC 2007

Hello everybody! :-)

I've been reading up a little on how to make my system a little faster.
If you are running some Core2 Duo or a fast AMD64, you might not bother
to even think about this, as the system will be fast enough "as is". But
the fastest CPUs supported by FreeBSD are UltraSPARC II with 450MHz,
probably making the U60 and U80 the fastest current SPARC64 machines for
FreeBSD. Just the same, my U60 with 2GB auf RAM and 2 450MHz CPUs isn't
exactly Formular 1. :-)

Since the SPARC plattform in general seems to benifit a great deal from
optimization flags at compile time (much more than i386) I thought it
might be a good idea to look at a few options.

First of all, I can't really find the options FreeBSD seems to have, no
matter if I'm compiling world, kernel or something else. The file that
the handbook states: /usr/share/examples/etc/make.conf doesn't exist.
Actually, /usr/share/examples/etc/ doesn't even exist on my machine. I
am running FreeBSD 6.2-STABLE (updated late night; CET). There is a file
in /usr/src/share/examples/etc/ but it seems to be from the i386
platform (CPU-type is PIII) and doesn't contain really sane defaults for
SPARC64 and certainly doesn't seem to contain the defaults that apply to
my system (from what I've observed). Is there such thing as a make.conf
that contains all the defaults for sparc64? If so, where is it?

Looking at what I see when compiling just about anything, I'd say the
CFLAGS are set to "-O2 -pipe", where the second option doesn't really do
much about the code being created. CXXFLAGS probably isn't set so the
options there are the same as for CFLAGS. If these are the only settings
passed on to the cc, it will probably create code that is "optimized"
for the V7. At least, that would be the default according to the
documentation of the gcc. V7 code isn't really all that good for any v9
CPU, including my UltraSPARC II, as the istruction set is rather

I was thinking of setting the CFLAGS to something like
-O2 -pipe -mcpu=ultrasparc -m64

Is that a sane configuration? Will the world and the kernel run with
those? Has anyone ever tried that? :-)

Since -O3 doesn't really help speeding up the result much (exept when
you aretrying to kill time while compiling), I haven't bothered with
that one. Does FreeBSD even compile with that on?


More information about the freebsd-sparc64 mailing list