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

Stefan Lambrev stefan.lambrev at sun-fish.com
Wed Sep 13 02:17:19 PDT 2006


Hello,

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.
>
> Best regards
>    Oliver
>
>   
May be default flags have to be set here:
/usr/src/share/examples/etc/make.conf ?
I'm asking because in this file I read:

# CFLAGS controls the compiler settings used when compiling C code.
# Note that optimization settings other than -O and -O2 are not recommended
# or supported for compiling the world or the kernel - please revert any
# nonstandard optimization settings to "-O" or -O2 before submitting bug
# reports without patches to the developers.
#
#CFLAGS= -O -pipe

May be "-fno-strict-aliasing" have to be added here then ?

-- 
Best Wishes,
Stefan Lambrev
ICQ# 24134177



More information about the freebsd-stable mailing list