After binutils is emerged with gcc 3.4 (gcc version 3.4.0 20040407 (prerelease)), several programs will no longer compile. I tracked this down and got snapshot builds of glibc and binutils as of yesterdays date to no avail. The main things that break are anything with a *.S file (glibc and kernels are some programs to note). I then snooped about on the gcc bugzilla and found some similar bugs that mentioned issues with heavy optimizations on binutils ... I was then able to confirm a solution and it's an easy fix. This should probably be put in the binutils ebuild anyway, as there's a chance of ot breaking with aggressive cflags. Simply, back off the CFLAGS to '-O2 -pipe -march=k8' and you should have no problems from then on out. Reproducible: Always Steps to Reproduce: 1. Install gcc 3.4 prelease. 2. change cflags in /etc/make.conf to '-O3 -pipe -msse -msse2 -ftracer -march=k8' 2. emerge binutils 3. emerge glibc (glibc will not compile) 4. change cflags in /etc/make.conf to '-O2 -pipe -march=k8' 5. emerge binutils 6. change cflags in /etc/make.conf to '-O3 -pipe -msse -msse2 -ftracer -march=k8' 7. emerge glibc (it now works) Actual Results: Much rejoicing. Expected Results: If the ebuild is modified so that all the other CFLAGS are stripped out, it should just work with gcc 3.4 with no issues. I have ebuilds for CVS snapshots of glibc and binutils (as of April 11, 2004) if anyone wants them. They're a real bastardization and I've chosen myself to stick with the portage builds ... but if there's anyone crazier than I am just give me an email.
as a side-note, i find it a bit scary that binutils doesnt strip-flags
Created attachment 29241 [details] This will strip the flags
With the ebuild attachment I simply added the lines: strip-flags export CFLAGS="${CFLAGS//-O?} -O2" export CXXFLAGS="${CFLAGS}" export LDFLAGS="${LDFLAGS//-Wl,--relax}"
I think: inherit flag-o-matic strip-flags replace-flags "-O3" "-O2" is a neater solution. This problem also occurs on x86, or at the very least on an Athlon XP. Personally, I think that binutils should use strip-flags and -O2 anyway by default, as it's a pretty scary one to allow people to overoptimise...
not amd64 specific
i've added a fix for this to a number of binutils ebuilds... if i somehow managed to miss one that's marked as the latest stable or testing on your arch, let me know. it might not be an optimal solution, but i've added 'has_version "=sys-devel/gcc-3.4*" && CFLAGS="-O2"'.
i changed the CFLAGS="-O2" to run strip-flags instead
SpanKY, I was under the impression that strip-flags didn't drop things down to -O2, but in fact kept "-O3 -march=<yourarch> -fprefetch-loop-arrays -pipe". Is there any chance you can change the line in question to: has_version "=sys-devel/gcc-3.4*" && strip-flags && replace-flags "-O3" "-O2" please?
-O3 is kept if you're using an unstable system stable system would trim the -O3 i've added the replace-flags as you've shown