Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 47581 - binutils breaks after being compiled with gcc 3.4 (solved)
Summary: binutils breaks after being compiled with gcc 3.4 (solved)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Please assign to toolchain
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-11 23:50 UTC by Tamran Lengyel
Modified: 2004-04-27 21:34 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
This will strip the flags (binutils-2.14.90.0.8-r2.ebuild,4.63 KB, text/plain)
2004-04-13 19:32 UTC, Tamran Lengyel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tamran Lengyel 2004-04-11 23:50:24 UTC
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.
Comment 1 Travis Tilley (RETIRED) gentoo-dev 2004-04-12 01:40:02 UTC
as a side-note, i find it a bit scary that binutils doesnt strip-flags
Comment 2 Tamran Lengyel 2004-04-13 19:32:50 UTC
Created attachment 29241 [details]
This will strip the flags
Comment 3 Tamran Lengyel 2004-04-13 19:34:39 UTC
With the ebuild attachment I simply added the lines:

strip-flags

export CFLAGS="${CFLAGS//-O?} -O2"
export CXXFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS//-Wl,--relax}"
Comment 4 Robert Moss (RETIRED) gentoo-dev 2004-04-22 12:11:31 UTC
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...
Comment 5 Travis Tilley (RETIRED) gentoo-dev 2004-04-22 18:26:59 UTC
not amd64 specific
Comment 6 Travis Tilley (RETIRED) gentoo-dev 2004-04-24 07:00:36 UTC
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"'.
Comment 7 SpanKY gentoo-dev 2004-04-24 20:07:24 UTC
i changed the CFLAGS="-O2" to run strip-flags instead
Comment 8 Robert Moss (RETIRED) gentoo-dev 2004-04-27 21:19:18 UTC
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?
Comment 9 SpanKY gentoo-dev 2004-04-27 21:34:28 UTC
-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