Gentoo Archives: gentoo-user

From: "Bo Ørsted Andresen" <bo.andresen@××××.dk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How to properly change CFLAGS ?
Date: Wed, 23 Aug 2006 22:27:24
Message-Id: 200608240021.32144.bo.andresen@zlin.dk
In Reply to: Re: [gentoo-user] How to properly change CFLAGS ? by Michael Hennebry
1 On Wednesday 23 August 2006 23:48, Michael Hennebry wrote:
2 > > >>> Oh, and BTW, on gentoo your optimization choices for gcc are -O, -O2
3 note 'choices for gcc' above ^^^^^
4 > > >>> or nothing, because all other -O options are replaced with -O2 by
5 > > >>> toolchain.eclass.
6 >
7 > Perhaps I misunderstood the preceeding.
8 > I'd taken it to mean that recompiling any package with gentoo tools
9 > would result in -Os being replaced by -O2 .
10
11 I probably should have explained it better before. If you look at the gcc
12 ebuild (/usr/portage/sys-devel/gcc/gcc-YOUR_VERSION.ebuild) you will note a
13 line that says:
14
15 inherit toolchain
16
17 This inherits the toolchain.eclass for the gcc ebuild. In
18 the /usr/portage/eclass/toolchain.eclass you will find the following:
19
20 # In general gcc does not like optimization, and add -O2 where
21 # it is safe. This is especially true for gcc 3.3 + 3.4
22 replace-flags -O? -O2
23
24 This replaces -Os, -O3 or any other -O? with -O2. But it only applies to
25 ebuilds that inherits the toolchain.eclass.
26
27 In conclusion in order to find out what packages don't use your CFLAGS you
28 will either have to look at the ebuilds and any eclasses that they append or
29 simply install it and look at the CFLAGS in the pkg database when it is
30 installed:
31
32 # grep ^CFLAGS /etc/make.conf
33 CFLAGS="-O2 -march=pentium-m -pipe"
34
35 # cat /var/db/pkg/www-client/mozilla-firefox-1.5.0.6/CFLAGS
36 -march=pentium-m -pipe -Wno-return-type -w -freorder-blocks -fno-reorder-functions
37
38 As you can see the mozilla-firefox ebuild or any of it's eclasses has stripped
39 any -O? CFLAGS entirely...
40
41 The following command should show you a complete list of packages that you
42 have currently installed but which wasn't installed with your current CFLAGS:
43
44 # CFLAGS=$(source /etc/make.conf && echo "${CFLAGS}") ; \
45 grep -v "${CFLAGS//\-/\\-}" /var/db/pkg/*/*/CFLAGS
46
47 --
48 Bo Andresen

Replies

Subject Author
Re: [gentoo-user] How to properly change CFLAGS ? "Bo Ørsted Andresen" <bo.andresen@××××.dk>