optimization levels for 6-STABLE build{kernel,world}

Oliver Fromme olli at lurza.secnetix.de
Wed Sep 13 02:06:15 PDT 2006


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.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.


'Instead of asking why a piece of software is using "1970s technology,"
start asking why software is ignoring 30 years of accumulated wisdom.'


More information about the freebsd-stable mailing list