Gentoo Archives: gentoo-dev

From: Dominique Michel <dominique.michel@×××××××××.ch>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] CFLAGS paragraph for the GWN
Date: Sat, 30 Sep 2006 21:01:33
Message-Id: 20060930225827.725ae31d@localhost
In Reply to: [gentoo-dev] [RFC] CFLAGS paragraph for the GWN by Lionel Bouton
1 Le Sat, 30 Sep 2006 22:35:58 +0200,
2 Lionel Bouton <lionel-dev@××××××.name> a écrit :
3
4 > Hi, I just had an unpleasant experience with -ffast-math and GCC 4.1.1
5 > (it borked my LDAP authentication on several systems which worked with
6 > the same CFLAGS as long as GCC 3.4.6 was used).
7 >
8 > There is a lot of material out there about CFLAGS and Gentoo (google
9 > returns 387000 pages) but what's working for someone might not for
10 > another. There are flags that work for a GCC version and most ebuilds
11 > and don't work with another GCC version (my unfortunate experience) or
12 > some ebuilds. Flag combination/architecture/LDFLAGS might be an issue too.
13 >
14 > There are already good resources (http://gentoo-wiki.com/CFLAGS_matrix
15 > was mentioned to me by robbat2) but they may not be advertised enough.
16 > I'd like to propose a paragraph to the GWN editor which presents some
17 > gotchas and good references on the subject.
18 >
19 > Here's a draft for review. You're welcomed to expand on the subject.
20 >
21 > --- Draft BEGIN ---
22 > <section>
23 > <title>CFLAGS</title>
24 > <body>
25 >
26 > <p>
27 > Being able to tune the CFLAGS is part of one of the core principles of
28 > Gentoo: let the user be in control. Being in control brings both
29 > benefits and problems and CFLAGS tuning is not an exception.
30 > </p>
31 > <p>
32 > The recent upgrade to gcc-4.1.1 for x86 and amd64 users changed the
33 > landscape. Users that spent some time tuning their CFLAGS with gcc-3.4.6
34 > might find out that an upgrade to gcc-4.1.1 leaves them with an unstable
35 > system. Example of this are :
36 > <ul>
37 > <li>nss_ldap stopped working with -ffast-math</li>
38 > <li>...</li>
39 > </ul>
40 > </p>
41 > <p>
42 > Users with unsupported CFLAGS (see the <uri
43 > link='http://gentoo-wiki.com/CFLAGS_matrix'>CFLAGS matrix</uri> for
44 > example) might want to return to safe CFLAGS (see <uri
45 > link='http://gentoo-wiki.com/Safe_Cflags'>Safe CFLAGS</uri>) if recent
46 > updates caused them stability problems. On the other hand, more
47 > adventurous users might want to experiment with CFLAGS that didn't work
48 > properly with gcc-3.4.6... As always, the user is in control.
49 > </p>
50 > </body>
51 > </section>
52 > --- Draft END ---
53 >
54 > If possible, I'd like to expand the list of 3.4.6 -> 4.1.1 upgrade
55 > problems which are linked to experimental CFLAGS. If you want to expand
56 > the subject to cover other tuning/stability gotchas that recent updates
57 > might have brought into the light, please feel free to do so. As English
58 > is not my native tongue, feel free to spell check too.
59 >
60 > Cheers,
61 >
62 > Lionel.
63 My personal experience with other CFLAGS as the ones in the handbook is at
64 gcc-4.1.1 have a better optimisation with the default gentoo CFLAGS. Even
65 with -O2, the result is a faster system, and -O3 seam to be safer with math
66 related applications as with gcc-3.4.*.
67
68 But in the other hand, other flags seam to be more problematic as with
69 gcc-3.4.*. And the new optimisations flags as the vectorisation flags are not
70 easy to use, because the result depend on the code of the program. They can or
71 not brake the code, and when the program run well, they can make it faster
72 or slower. All depend of the size and complexity of the loops. And I think also
73 of the arch.
74
75 So my conclusion is:
76 For system flags, just keep the default, and if you want to experiment, do
77 profiling for each single program you want to optimize.
78
79 Cheers,
80 Dominique
81
82 --
83 Dominique Michel
84 --
85 gentoo-dev@g.o mailing list