From owner-freebsd-stable@FreeBSD.ORG Wed Sep 13 10:56:45 2006 Return-Path: X-Original-To: freebsd-stable@Freebsd.org Delivered-To: freebsd-stable@Freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A66C816A412 for ; Wed, 13 Sep 2006 10:56:45 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1C8443D46 for ; Wed, 13 Sep 2006 10:56:44 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (pkdapa@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k8DAubux069762; Wed, 13 Sep 2006 12:56:43 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k8DAubr9069760; Wed, 13 Sep 2006 12:56:37 +0200 (CEST) (envelope-from olli) From: Oliver Fromme Message-Id: <200609131056.k8DAubr9069760@lurza.secnetix.de> To: freebsd-stable@voidcaptain.com (Pete Slagle) Date: Wed, 13 Sep 2006 12:56:37 +0200 (CEST) In-Reply-To: <4507D897.4030502@voidcaptain.com> X-Mailer: ELM [version 2.5 PL8] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Wed, 13 Sep 2006 12:56:43 +0200 (CEST) Cc: freebsd-stable@Freebsd.org Subject: Re: optimization levels for 6-STABLE build{kernel,world} X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-stable@Freebsd.org List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2006 10:56:45 -0000 Pete Slagle wrote: > Oliver Fromme wrote: > > Marc G. Fournier 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 Which is exactly the default, so there's no reason to specify it at all. If, at some point in the future, the default changes (e.g. -O3 is considered "good and safe", or any other -fno-xxx option becomes necessary with -O2), then you won't benefit from it, because you override it. > COPTFLAGS= -O2 -pipe As Ruslan explained, -fno-strict-aliasing will be added automatically in the case of COPTFLAGS if necessary. So my recommendation is still: Don't override CFLAGS or COPTFLAGS. Chances are that you make things worse, now or at some point in the future. > 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? In the general case, it would be better to remove those two lines completely. :-) 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. (On the statement print "42 monkeys" + "1 snake":) By the way, both perl and Python get this wrong. Perl gives 43 and Python gives "42 monkeys1 snake", when the answer is clearly "41 monkeys and 1 fat snake". -- Jim Fulton