optimization levels for 6-STABLE build{kernel,world}
Ruslan Ermilov
ru at freebsd.org
Wed Sep 13 03:19:16 PDT 2006
On Wed, Sep 13, 2006 at 03:08:23AM -0700, Pete Slagle wrote:
> 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?
>
Doesn't matter; kern.pre.mk will automatically add -fno-strict-aliasing
to COPTFLAGS if needed:
: . if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
: COPTFLAGS+= -fno-strict-aliasing
: . endif
Cheers,
--
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20060913/f6c97816/attachment.pgp
More information about the freebsd-stable
mailing list