Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 265237 - sys-libs/glibc ignores user CFLAGS for x86 ABI build with amd64 multilib
Summary: sys-libs/glibc ignores user CFLAGS for x86 ABI build with amd64 multilib
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 327331 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-04-07 02:24 UTC by Nick Fortino
Modified: 2011-03-20 21:28 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Fortino 2009-04-07 02:24:04 UTC
When building =sys-libs/glibc-2.9_p20081201-r2, I get the following output from the build log:

[snip]
 * Building multilib glibc for ABIs: x86 amd64

 *             ABI:   x86
 *          CBUILD:   x86_64-pc-linux-gnu
 *           CHOST:   x86_64-pc-linux-gnu
 *         CTARGET:   x86_64-pc-linux-gnu
 *      CBUILD_OPT:   i686-pc-linux-gnu
 *     CTARGET_OPT:   i686-pc-linux-gnu
 *              CC:   
 *          CFLAGS:   -O2 -fno-strict-aliasing

[snip]
 *             ABI:   amd64
 *          CBUILD:   x86_64-pc-linux-gnu
 *           CHOST:   x86_64-pc-linux-gnu
 *         CTARGET:   x86_64-pc-linux-gnu
 *      CBUILD_OPT:   x86_64-pc-linux-gnu
 *     CTARGET_OPT:   x86_64-pc-linux-gnu
 *              CC:   x86_64-pc-linux-gnu-gcc
 *          CFLAGS:   -pipe -g -ggdb -O2 -fno-strict-aliasing

The relevant portion of emerge --info
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -g -ggdb"
CHOST="x86_64-pc-linux-gnu"
Comment 1 SpanKY gentoo-dev 2009-04-09 09:39:45 UTC
if you want custom x86 flags, then set CFLAGS_x86

the ABI situation is too mucky to make attempts at migrating CFLAGS to CFLAGS_$ABI safe and/or worth the hassle.  a real multilib implementation would resolve all of this anyways.
Comment 2 Nick Fortino 2009-04-10 22:31:29 UTC
I tried CFLAGS_x86 before filing the bug (and left that fact out in the original report like a moron). It has no effect, as I think it gets overwritten by setup_flags in common.eblit.

bnsf glibc # CFLAGS_x86='-pipe -O2 -g -ggdb' emerge -1 glibc

A snapshot of some of the top lines from the resulting environment file:
CBUILD=x86_64-pc-linux-gnu
CBUILD_OPT=x86_64-pc-linux-gnu
CDEFINE_amd64=__x86_64__
CDEFINE_default=__unix__
CDEFINE_x86=__i386__
CFLAGS='-pipe -g -ggdb -O2 -fno-strict-aliasing'
CFLAGS_BASE='-O2 -pipe -g -ggdb'
CFLAGS_default=
CFLAGS_x86='-m32 -march=x86_64'
CHOST=x86_64-pc-linux-gnu
CHOST_amd64=x86_64-pc-linux-gnu
CHOST_default=x86_64-pc-linux-gnu
CHOST_x86=i686-pc-linux-gnu
CPPFLAGS=-U_FORTIFY_SOURCE
CROSSCOMPILE_OPTS=
CTARGET=x86_64-pc-linux-gnu
CTARGET_OPT=x86_64-pc-linux-gnu
CTARGET_default=x86_64-pc-linux-gnu
CVS_RSH=ssh
CXXFLAGS='-pipe -g -ggdb -O2 -fno-strict-aliasing'
CXXFLAGS_BASE='-O2 -pipe -g -ggdb'

note that -march=x86_64 isn't actually a valid flag for gcc, which seems to cause strip-unsupported-flags to throw out all flags for the x86 ABI build. I'm not sure this is a problem, since SpanKY suggested CFLAGS are supposed to be ignored in this case anyhow, but that seems to be a relatively odd means to an end.
Comment 3 Nikos Chantziaras 2009-11-07 22:17:07 UTC
Same here. It removes "-mtune=core2" and replaces "-march=core2" with "-march=i686" for the 32-bit build even though I have:

CFLAGS_x86="${CFLAGS_x86} -march=core2"

in make.conf.  The 64-bit build works correctly though with:

CXXFLAGS_amd64="${CXXFLAGS_amd64} -march=core2"

It's just the 32-bit build. Nothing serious, since the majority of apps on my system are 64-bit, but still, it looks like a bug :)
Comment 4 Ryan Hill (RETIRED) gentoo-dev 2009-11-08 00:31:53 UTC
that's the correct behaviour.  why would you use core2 for x86?  it's a 64bit arch.
Comment 5 Nikos Chantziaras 2009-11-08 08:17:32 UTC
(In reply to comment #4)
> that's the correct behaviour.  why would you use core2 for x86?  it's a 64bit
> arch.

I think you're confused. core2 is a CPU, not an arch.

-march=core2 has absolutely nothing to do with x86 or 64-bit arches. It instructs the compiler to produce core2 specific code, *not* x86 or 64-bit specific one.

So it is not correct behavior.  "gcc -m32 -march=core2" is not only valid, but recommended.
Comment 6 Arne Babenhauserheide 2010-04-15 00:35:37 UTC
The same happens to me when updating my OLPC via chroot on my desktopmachine. It builds a generic glibc instead of a geode optimized one. 

Might it be necessary, so the code runs on a non-geode processor? 
Comment 7 Arne Babenhauserheide 2010-04-15 00:37:26 UTC
Note: I use GentooXO on a first generation OLPC, so building on my desktop is the only way to get stuff updated which needs more than 256MiB memory for compiling → http://www.gentooxo.org/
Comment 8 SpanKY gentoo-dev 2010-07-28 23:31:51 UTC
*** Bug 327331 has been marked as a duplicate of this bug. ***