optimization levels for 6-STABLE build{kernel,world}
Pete Slagle
freebsd-stable at voidcaptain.com
Wed Sep 13 03:08:55 PDT 2006
Oliver Fromme wrote:
> Marc G. Fournier <freebsd at hub.org> wrote:
> > What are ppl currently using for CFLAGS/COPTFLAGS in /etc/make.conf for
> > building kernel/world? I know awhile back it wasn't recommended to go
> > above -O2, for instance, but suspect that has changed ... ?
>
> The best optimization is probably to not override the
> defaults at all, because they're already pretty optimal.
> In fact, by overriding the defaults there's a good chance
> to make things worse. :-)
>
> The default CFLAGS are "-O2 -pipe -fno-strict-aliasing".
> Anything above -O2 isn't supported, and using -O2 without
> -fno-strict-aliasing also isn't supported (and will create
> broken code for some programs). A common mistake is to
> specify CFLAGS="-O2 -pipe" and omit -fno-strict-aliasing.
> That'll shot you in the foot sooner or later.
/etc/make.conf on most of my 6.1 machines contains (in part) this:
CFLAGS= -O2 -pipe -fno-strict-aliasing
COPTFLAGS= -O2 -pipe
I no longer remember exactly why, but at some point I must have
understood or assumed that to be the recommendation.
Just to be completely clear, are you saying that this
CFLAGS= -O2 -pipe -fno-strict-aliasing
COPTFLAGS= -O2 -pipe -fno-strict-aliasing
would be better in the general case?
More information about the freebsd-stable
mailing list