Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Nov 2003 09:59:07 +0100
From:      Simon Barner <barner@in.tum.de>
To:        Zhang Weiwu <weiwuzhang@hotmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: optimize with -O2 or -O?
Message-ID:  <20031104085907.GA90790@zi025.glhnet.mhn.de>
In-Reply-To: <3FA76159.6010807@hotmail.com>
References:  <3FA76159.6010807@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--/9DWx/yDrRhgMJTb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

> I read the gcc man page. It is not clear what -O implys. Is -O equal to=
=20
> -O1 or -O2? If I wish to optimize making does it make sense to add=20
> CFLAGS=3D-O2 in the make.conf(5)?

Hi,

-O =3D=3D -O1 (see `info gcc' -> Invoking GCC -> Optimize Options)

It is recommended not to use anything higher than -O since GCC is known to
procduce broken code on higher optimization levels.

Depending on what gcc version you are using, also specifing CPUTYPE=3D...
in /etc/make.conf might bring you troubles (for certain CPUs, e.g.=20
athlon IIRC).

Post the output of `gcc --version' and people will be able to tell you.

What you could try is to use -O2 for some selected ports, but the question
is whether you will see a measurable performance gain.

Some ports that are known to build alright at -O2 (e.g. mplayer) have
WITH_OPTIMIZED_CFLAGS knob.

Regards,
 Simon

--/9DWx/yDrRhgMJTb
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/p2pbCkn+/eutqCoRAsswAKCghQRUts4BuYaD4jlUKQay6+KS+wCg312h
wXzlZYVDduBGi8MccemCL3M=
=K7Ud
-----END PGP SIGNATURE-----

--/9DWx/yDrRhgMJTb--



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