From owner-freebsd-stable Mon May 7 15:53:10 2001 Delivered-To: freebsd-stable@freebsd.org Received: from mailb.telia.com (mailb.telia.com [194.22.194.6]) by hub.freebsd.org (Postfix) with ESMTP id 58DAA37B423 for ; Mon, 7 May 2001 15:53:04 -0700 (PDT) (envelope-from ertr1013@student.uu.se) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by mailb.telia.com (8.9.3/8.9.3) with ESMTP id AAA04642 for ; Tue, 8 May 2001 00:53:01 +0200 (CEST) Received: from ertr1013.student.uu.se (h185n2fls20o913.telia.com [212.181.163.185]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id AAA20139 for ; Tue, 8 May 2001 00:53:01 +0200 (CEST) Received: (qmail 7601 invoked by uid 1001); 7 May 2001 22:53:03 -0000 Date: Tue, 8 May 2001 00:53:03 +0200 From: Erik Trulsson To: freebsd-stable@FreeBSD.ORG Subject: Re: CFLAGS Optimization Message-ID: <20010508005303.A7567@student.uu.se> Mail-Followup-To: freebsd-stable@FreeBSD.ORG References: <20010507230417.F508-100000@gateway.bogus> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010507230417.F508-100000@gateway.bogus>; from nuno.mailinglists@pt-quorum.com on Mon, May 07, 2001 at 11:36:31PM +0100 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, May 07, 2001 at 11:36:31PM +0100, Nuno Teixeira wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello to all, > > I came from Linux and at that time I used CFLAGS to optimize general > programs and linux kernel. > > For example: > > [i686]: > CFLAGS='-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro > - -march=pentiumpro -fomit-frame-pointer -fno-exceptions' You do know that gcc doesn't have any optimization-level above -O3 ? It is therefore fairly pointless to specify stuff like -O4 or -O9 > > [i586]: > CFLAGS='-O3 -mcpu=pentium -march=pentium -ffast-math -funroll-loops > - -fomit-frame-pointer -fforce-mem -fforce-addr -malign-double > - -fno-exceptions' > > [i486]: > CFLAGS='-O3 -funroll-all-loops -malign-double -mcpu=i486 -march=i486 > - -fomit-frame-pointer -fno-exceptions' It is pointless to use both -mcpu=X and -march=X since -march=X implies -mcpu=X. > > Can I use CFLAGS on FreeBSD too? If I put the CFLAGS on > /etc/defaults/make.conf, the kernel is affected by it? > Does CFLAGS can optimize programs and kernel on FreeBSD OS? > Yes, you can use CFLAGS on FreeBSD. For the kernel you should use COPTFLAGS instead. Don't modify /etc/defaults/make.conf. Use /etc/make.conf instead. Finally a warning: using -O2 and -O3 is known to produce bad code sometimes. If you compile with any optimization flags other than -O you should not expect to get much help if anything breaks. (Other than the advise to use a plain -O instead.) -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message