1 |
Beso <givemesugarr@×××××.com> posted |
2 |
d257c3560802060159q3a5b0334gd40b5d8b25aa348f@××××××××××.com, excerpted |
3 |
below, on Wed, 06 Feb 2008 09:59:29 +0000: |
4 |
|
5 |
>> CFLAGS="-march=athlon64 -O2 -pipe" |
6 |
> |
7 |
> |
8 |
> i suggest this flags instead of yours usually they're a little more |
9 |
> processor based and are not experimental ones as usually they say about |
10 |
> them: |
11 |
> CFLAGS="-Os -march=k8 -mno-tls-direct-seg-refs -mmmx -msse3 -pipe |
12 |
> -fomit-frame-pointer" |
13 |
|
14 |
-fomit-frame-pointer is the default for -O and above on amd64/x86_64, as |
15 |
it doesn't interfere with debugging here as it does on 32-bit x86, so |
16 |
omitting it saves on complexity without changing the compiled result. Of |
17 |
course, it's still useful for 32-bit, but there's only a very few |
18 |
programs that portage compiles as 32-bit on amd64 anyway (and even there, |
19 |
CFLAGS aren't really used except for sandbox, because gcc does its own |
20 |
bootstrapping and glibc is considered critical enough it basically sets |
21 |
its own very strict CFLAGS in the ebuild). |
22 |
|
23 |
-Os I used to use, for reasons explained in detail in a post to the list |
24 |
some time ago but briefly, cache size restrictions tend to matter more |
25 |
than pure cycle optimization on modern processors, so -Os generally made |
26 |
more sense to me than -O2. However, with gcc-4.2, several optmizations |
27 |
that used to be in -Os only, made it into -O2, and -O2 now includes a |
28 |
couple of cache optimizers that raw size optimization misses, so it's not |
29 |
as critical, now. Given that -O2 tends to be the recommended for Gentoo |
30 |
and more widely tested than -Os, I've therefore switched back to it. |
31 |
|
32 |
-mmmx is included in the default for -march=k8, so that should be |
33 |
superfluous. However, -msse3 is NOT included, as the original amd chips |
34 |
didn't have it. Newer amd CPUs DO include sse3 (look for pni in the |
35 |
flags line(s) of /proc/cpuinfo), so unlike -mmmx it's worth specifying |
36 |
-msse3 if your CPU has it. |
37 |
|
38 |
What about -mno-tls-direct-seg-refs? Why do you use that? The gcc |
39 |
manpage doesn't have enough info to convince me it's useful, and in fact, |
40 |
implies the reverse, since it defaults glibc folks to using it, which |
41 |
implies a reason for that default. I'd therefore love to see a |
42 |
discussion of the flag with enough information to justify a better |
43 |
informed decision, as yours presumably is given your depth of knowledge |
44 |
and activity on this list. |
45 |
|
46 |
FWIW, here's my CFLAGS. CXXFLAGS are similar, minus -combine (mentioned |
47 |
below) and -freorder-blocks-and-partition (for similar reasons). |
48 |
-combine and -ftree-vectorize still cause occasional problems, which I |
49 |
avoid on a case by case basis as I encounter them, with an appropriate |
50 |
entry in /etc/portage/env/<cat>/<pkg>, but in general, these flags have |
51 |
worked well for me for some time. I can explain why I use each one if |
52 |
anyone wants to know. |
53 |
|
54 |
CFLAGS="-march=k8 -msse3 -O2 -pipe -frename-registers -fweb -ftree- |
55 |
vectorize -freorder-blocks-and-partition -combine -fgcse-sm -fgcse-las - |
56 |
fgcse-after-reload -fmerge-all-constants" |
57 |
|
58 |
>> CXXFLAGS="-march=athlon64 -O2 -pipe" |
59 |
> |
60 |
> this is the same and is faster to write and to have it updated. |
61 |
> CXXFLAGS="${CFLAGS}" |
62 |
|
63 |
The exception would be if your CFLAGS include things like -combine, which |
64 |
doesn't work so well on C++ so shouldn't be in CXXFLAGS. (For -combine |
65 |
specifically, gcc ignores it in such cases, but spits a warning, which |
66 |
various configure scripts interpret as a problem causing them to screwup, |
67 |
so it's best to leave it out of CXXFLAGS entirely.) |
68 |
|
69 |
> also add: |
70 |
> LDFLAGS="-Wl,--as-needed,-O1 -Wl,--enable-new-dtags -Wl,--sort-common |
71 |
> -s" |
72 |
|
73 |
Could you point me to documentation on LDFLAGS in general, or at least |
74 |
--enable-new-dtags and --sort-common? I use --as-needed already |
75 |
( documentation at http://www.gentoo.org/proj/en/qa/asneeded.xml ), as |
76 |
well as -z,now (security thing as mentioned in portage's QA warnings if |
77 |
you have them enabled for setuid/setgid applications, but I find it |
78 |
useful in general, and no, it doesn't simply counteract --as-needed), but |
79 |
have yet to find a resource even close to as helpful for LDFLAGS in |
80 |
general as "man gcc" is for CFLAGS, so I'm left asking about them one at |
81 |
a time as I see them, and I've not seen those yet. Again, a discussion |
82 |
with enough info to make an informed decision would be invaluable! I |
83 |
don't even know what the options are at this point, and that's |
84 |
frustrating! |
85 |
|
86 |
>> FEATURES="ccache distlocks fixpackages metadata-transfer parallel-fetch |
87 |
>> sandbox sfperms strict unmerge-orphans userfetch" |
88 |
> |
89 |
> if you experience collision problems add collision-protect to the |
90 |
> features. you should have some better protection between packages and |
91 |
> should avoid packages from writing files owned by other packages. this |
92 |
> could provoke some more emerge errors than before because there are |
93 |
> quite some packages that overwrite files |
94 |
|
95 |
Agreed. It's worth mentioning COLLISION_IGNORE, which you can set in |
96 |
make.conf to avoid specific known collisions, especially if they are |
97 |
known to be "safe", that is, something like icons or the like (using an |
98 |
example from the recent KDE4-svn overlay work, upstream was changing them |
99 |
fast enough to make it not worth filing bugs with Gentoo over), that it |
100 |
really doesn't matter if a couple of packages are fighting over. |
101 |
Differing config files, OTOH, you probably want to know about! |
102 |
|
103 |
>> MAKEOPTS="-j3" |
104 |
> |
105 |
> |
106 |
> set MAKEOPTS="-j3" to MAKEOPTS="-j5 -s ". if you experience compile |
107 |
> problem decrease the j number to 1. |
108 |
|
109 |
Note that there are occasional parallel make issues with -jX, where X>1 |
110 |
or not existent (-j by itself indicates unlimited jobs). These don't |
111 |
occur frequently at -j2 as it's so heavily used by Gentooers everywhere |
112 |
so those occurring there tend to have been eliminated already. However, |
113 |
as the number of jobs increase, so does the likelihood of running into |
114 |
parallel make issues. make errors indicating file or directory not found |
115 |
are the classic example, so any time you see one of those, try |
116 |
MAKEOPTS=-j1 emerge <whatever> and you'll likely find it gone. If so, |
117 |
file a bug with [parallel make] as well as the package name in the |
118 |
subject line (assuming there's not yet one filed), and help get it fixed! |
119 |
=8^) |
120 |
|
121 |
FWIW, I run MAKEOPTS="-j20 -l12" (up to 20 jobs, but don't start any more |
122 |
if the load is above 12) here. Dual-dual-core Opteron 290s, 8 gig RAM, |
123 |
PORTAGE_TMPDIR pointing at a tmpfs so all those temp files don't hit |
124 |
disk. With PORTAGE_NICENESS=19, and with kernel 2.6.24's new per-user |
125 |
scheduling turned on (and with Hz=300, voluntary preemption, so it's not |
126 |
a special real-time kernel or anything by any stretch), I can still |
127 |
listen to streaming audio and even run a moderately sized visualization |
128 |
window (amarok with the scrolling voice-print analyzer going in its own |
129 |
window) without audio pause or undue jerkiness (there's a bit, but under |
130 |
a load of 3 per core and no real-time preemption, one might expect that) |
131 |
of the visualization. If I'm feeling adventurous and don't have |
132 |
anything else critical going on, I'll occasionally try -j by itself, just |
133 |
to see how high I can run the load average. A 400-500 load average is |
134 |
doable with kernel compiles, for instance, and nicely entertaining! =8^) |
135 |
It still amazes me how well the system copes with even that, and it was |
136 |
even more amazing back with dual-single-cores (242s)! |
137 |
|
138 |
-- |
139 |
Duncan - List replies preferred. No HTML msgs. |
140 |
"Every nonfree program has a lord, a master -- |
141 |
and if you use the program, he is your master." Richard Stallman |
142 |
|
143 |
-- |
144 |
gentoo-amd64@l.g.o mailing list |