Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 May 2001 00:53:03 +0200
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: CFLAGS Optimization
Message-ID:  <20010508005303.A7567@student.uu.se>
In-Reply-To: <20010507230417.F508-100000@gateway.bogus>; from nuno.mailinglists@pt-quorum.com on Mon, May 07, 2001 at 11:36:31PM %2B0100
References:  <20010507230417.F508-100000@gateway.bogus>

next in thread | previous in thread | raw e-mail | index | archive | help
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.)


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010508005303.A7567>