1 |
Here's the third version of the draft, wiki-free and with less sugar |
2 |
too. More warnings. |
3 |
|
4 |
Thanks again for the input. |
5 |
|
6 |
--- Draft BEGIN --- |
7 |
<section> |
8 |
<title>CFLAGS</title> |
9 |
<body> |
10 |
|
11 |
<p> |
12 |
Being able to tune the CFLAGS is part of one of the core principles of |
13 |
Gentoo: let the user be in control. Being in control brings both |
14 |
benefits and problems. CFLAGS tuning is not an exception. |
15 |
</p> |
16 |
|
17 |
<warn> |
18 |
We would like to remind you that using anything beyond -O2 |
19 |
-fomit-frame-pointer -march/-mcpu/-mtune in CFLAGS or CXXFLAGS (and |
20 |
-mieee, -mabi etc. on selected archs that tell you to do this), and |
21 |
using anything at all in LDFLAGS or ASFLAGS, is usually not worth it for |
22 |
most users. There's usually very little benefit, high risks and much |
23 |
time spent on frustating tuning that could be enjoyed doing far more |
24 |
interesting things. |
25 |
</warn> |
26 |
|
27 |
<p> |
28 |
The recent upgrade to gcc-4.1.1 for x86 and amd64 users changed the |
29 |
CFLAGS landscape. Users that spent some time tuning their CFLAGS with |
30 |
gcc-3.4.6 might find out that an upgrade to gcc-4.1.1 leaves them with |
31 |
an unstable system. |
32 |
</p> |
33 |
<p>Example of this are :</p> |
34 |
<ul> |
35 |
<li>nss_ldap stopped working with <c>-ffast-math</c> (reported to break |
36 |
many packages changing with the actual gcc version)</li> |
37 |
<li><c>-fvisibility-inlines-hidden</c> still breaks some code</li> |
38 |
<li>if you used gcc-4.0, <c>-ftree-loop-linear</c> now breaks in |
39 |
gcc-4.1 (at least with mesa)</li> |
40 |
<li>again for gcc-4.0 users, <c>-ftree-vectorize</c> is known to be |
41 |
broken in gcc-4.1 (at least for x86 and ppc, amd64 users seem to be |
42 |
safe)</li> |
43 |
<li><c>-fforce-addr</c> and <c>-fweb</c> break regularly on x86 with |
44 |
video libraries or graphic processing apps which use hand-optimised ASM</li> |
45 |
</ul> |
46 |
|
47 |
<p>There are known-to-be-broken flags for all GCC versions that you want |
48 |
to check for too:</p> |
49 |
<ul> |
50 |
<li>-fvisibility=hidden</li> |
51 |
<li>-frename-registers</li> |
52 |
<li>-ftracer</li> |
53 |
<li>-D_FILE_OFFSET_BITS=64</li> |
54 |
<li>-msse -mmmx -m3dnow</li> |
55 |
<li>-W</li> |
56 |
<li>-mfpmath=sse,387</li> |
57 |
<li>-malign-double</li> |
58 |
</ul> |
59 |
|
60 |
<p> |
61 |
Users with unsupported CFLAGS might want to return to safe CFLAGS (see |
62 |
warning above) if recent updates caused them stability problems. On the |
63 |
other hand, more adventurous users might want to experiment with CFLAGS |
64 |
that didn't work properly with gcc-3.4.6... As always, the user is in |
65 |
control (and the gun pointed to their feet is in his/her hand). |
66 |
</p> |
67 |
|
68 |
<p>Final notes:</p> |
69 |
<ul> |
70 |
<li>The gcc man page contains warnings for some unsafe optimization |
71 |
options. You should read it carefully when you experiment with CFLAGS or |
72 |
upgrade GCC on a CFLAGS-customized Gentoo.</li> |
73 |
<li>Some options that are unsafe in the system-wide CFLAGS might be |
74 |
added automatically in some ebuilds if the developper deems them safe |
75 |
(by redefining CFLAGS or using append-flags of the flag-o-matic eclass). |
76 |
For example <c>-ffast-math</c> is added by the xmame/xmess ebuilds on |
77 |
most architectures even if you don't put it in your CFLAGS.</li> |
78 |
<li>You might get an idea of the stability issues of a specific |
79 |
optimization option by running: <c>find /usr/portage -name '*.ebuild'| |
80 |
xargs grep -- '-<your-risky-optimization-option>'</c>. It takes quite |
81 |
some time, but might be enlightening: look for the 'filter-flags'.</li> |
82 |
</ul> |
83 |
|
84 |
</body> |
85 |
</section> |
86 |
--- Draft END --- |
87 |
|
88 |
Lionel |
89 |
-- |
90 |
gentoo-dev@g.o mailing list |
91 |
|
92 |
|
93 |
-- |
94 |
gentoo-dev@g.o mailing list |