As of 4.5.0 -march is always added to COLLECT_GCC_OPTIONS if gcc is not called with that option. $> echo '' | gcc -v -E - 2>&1 | grep -E '^(COLLECT_GCC_OPTIONS|gcc)' gcc version 4.5.0 20100406 (prerelease) (CRUX) (GCC) COLLECT_GCC_OPTIONS='-v' '-E' '-mtune=generic' '-march=pentiumpro' the same with gcc 4.4.3: $> echo '' | gcc -v -E - 2>&1 | grep -E '^(gcc|COLLECT_GCC_OPTIONS)' gcc version 4.4.3 (CRUX) (GCC) COLLECT_GCC_OPTIONS='-v' '-E' '-mtune=generic' I run into that because I'm not able to compile glibc on i686 without explicit setting CC to something like "gcc -march=i586". The reason is the well known _i686 problem, see [1] for a exact description of my error and [2] for a very old but recently reopen glibc bug. [1] http://www.eglibc.org/archives/patches/msg00073.html [2] http://sources.redhat.com/bugzilla/show_bug.cgi?id=411
Subject: Re: New: -march unconditionally added to COLLECT_GCC_OPTIONS Sent from my iPhone On Apr 14, 2010, at 1:56 AM, "jue at jue dot li" <gcc-bugzilla@gcc.gnu.org > wrote: > As of 4.5.0 -march is always added to COLLECT_GCC_OPTIONS if gcc is > not called > with that option. Well this was on purpose as before configuring for i686-linux-gnu was really for i386 arch. Now it is correctly i686. If you don't want __i686 defined, configure gcc for i586-linux-gnu instead which defaults to i586. > > $> echo '' | gcc -v -E - 2>&1 | grep -E '^(COLLECT_GCC_OPTIONS|gcc)' > gcc version 4.5.0 20100406 (prerelease) (CRUX) (GCC) > COLLECT_GCC_OPTIONS='-v' '-E' '-mtune=generic' '-march=pentiumpro' > > the same with gcc 4.4.3: > > $> echo '' | gcc -v -E - 2>&1 | grep -E '^(gcc|COLLECT_GCC_OPTIONS)' > gcc version 4.4.3 (CRUX) (GCC) > COLLECT_GCC_OPTIONS='-v' '-E' '-mtune=generic' > > I run into that because I'm not able to compile glibc on i686 > without explicit > setting CC to something like "gcc -march=i586". > The reason is the well known _i686 problem, see [1] for a exact > description of > my error and [2] for a very old but recently reopen glibc bug. > > > [1] http://www.eglibc.org/archives/patches/msg00073.html > [2] http://sources.redhat.com/bugzilla/show_bug.cgi?id=411 > > > -- > Summary: -march unconditionally added to COLLECT_GCC_OPTIONS > Product: gcc > Version: 4.5.0 > Status: UNCONFIRMED > Severity: normal > Priority: P3 > Component: debug > AssignedTo: unassigned at gcc dot gnu dot org > ReportedBy: jue at jue dot li > GCC build triplet: i686-pc-linux > GCC host triplet: i686-pc-linux > GCC target triplet: i686-pc-linux > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43750 >
Actually I want a i686 configured gcc and gcc should be able to compile glibc without setting -march to something different, that's how it works with any older gcc 4.x. As you can see in my supplied examples, gcc 4.5.0 sets -march to pentiumpro whereas gcc 4.4.3 doesn't set -march at all, which is IMO the preferable behaviour. Adding optimization options should be the task of the calling application via CFLAGS.
This is a bug in glibc, __i686 is in the implementation namespace. And this change was done on purpose to correct how GCC was not really configuring for a i686 compiler.
Ok, thanks, I feared that you would say that. Will try to move the issue to glibc. But for now we have the unpleasant situation, that current gcc fails to compile current glibc if host is set to i686.
Reopened the bug, because I'm still not convinced that the new behaviour of gcc 4.5 is correct. With gcc 4.4 you have to explicit set arch optimization, usually done via CFLAGS. If not set there's no optimization. That's the reason why you can build glibc without problems, because glibc calls gcc without setting CFLAGS if appropriate. With gcc 4.5 arch is always set to the host arch and the caller has no possibility to unset arch, only to change it to something different. To build glibc it's therefor not sufficient to set CFLAGS to something like -march=i585 but you have to do a 'make CC="gcc -march=i586"'. That's ugly and not what you want at all on a i686 host.
Uros, what do you think of this bug, as i386 arch maintainer?
Fixed in glibc a long time ago.