loader breaks with -O2 optimizations
Josh Carroll
josh.carroll at gmail.com
Wed Oct 31 07:03:15 PDT 2007
> Maybe, what happens if you use just -O2 -pipe? -funroll-loops is not an
> appropriate thing to be using globally anyway, unless your intention is
> to randomly make some code slower.
I encountered the same thing in 7.0-BETA1 and resolved it with an edit
to make.conf, specifically:
.if ! ${.CURDIR:M*/boot/i386/boot2*}
CFLAGS+=-O2 -pipe
CXXFLAGS+=-O2 -pipe
.endif
That way, everything else in world is built with -O2 (which I have
never had a problem with, by the way), but loader's CFLAGS are
retained.
The crux of the problem is that gcc takes the LAST -O option as the
effective one. That is:
gcc -Os ... -O2
is the equivalent of:
gcc -O2 ...
Which is exactly what's happening in this case (the loader Makefile
sets CFLAGS to include -Os to optimize for size).
Short of finding a way to prepend to CFLAGS so that a Makefile's
CFLAGS are appended to what is defined in make.conf, I don't see
another way around this. The make.conf hack seems to work, though.
Regards,
Josh
More information about the freebsd-current
mailing list