Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 199334 - sys-libs/glibc-2.6.1 overrides -march with an invalid one
Summary: sys-libs/glibc-2.6.1 overrides -march with an invalid one
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 225237 250527 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-16 09:27 UTC by Xavier Neys (RETIRED)
Modified: 2015-05-30 03:58 UTC (History)
3 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 Xavier Neys (RETIRED) gentoo-dev 2007-11-16 09:27:58 UTC
-march=c3 gets clobbered with -march=i686 which will generate invalid code.

With 2.6.1 and 2.7:

 * Installing Hardened Gentoo SSP handler
>>> Source unpacked.
>>> Compiling source in /var/tmp/portage/sys-libs/glibc-2.7/work/glibc-2.7 ...

 *             ABI:   default
 *          CBUILD:   i686-pc-linux-gnu
 *           CHOST:   i686-pc-linux-gnu
 *         CTARGET:   i686-pc-linux-gnu
 *      CBUILD_OPT:   
 *     CTARGET_OPT:   
 *              CC:   
 *          CFLAGS:   -march=i686 -pipe -O2 -fno-strict-aliasing -fno-stack-protector

With 2.6, -march=i686 was prepended:
 * Installing Hardened Gentoo SSP handler
 * Using GNU config files from /usr/share/libtool
 *   Updating scripts/config.sub                                                    [ ok ]
 *   Updating scripts/config.guess                                                  [ ok ]
>>> Source unpacked.
>>> Compiling source in /var/tmp/portage/sys-libs/glibc-2.6/work/glibc-2.6 ...

 *             ABI:   default
 *          CBUILD:   i686-pc-linux-gnu
 *           CHOST:   i686-pc-linux-gnu
 *         CTARGET:   i686-pc-linux-gnu
 *      CBUILD_OPT:   
 *     CTARGET_OPT:   
 *              CC:   
 *          CFLAGS:   -march=i686 -march=c3 -pipe -O2 -fno-strict-aliasing -fno-stack-protector


Replacing -march=c3 with -mtune=c3 in my CFLAGS leads to
CFLAGS:   -march=i686 -mtune=c3 ...
Not sure what kind of binary I'd get


oreilly ~ # emerge --info
Portage 2.1.3.19 (hardened/x86/2.6, gcc-3.4.6, glibc-2.6-r0, 2.6.17-hardened-r1 i686)
=================================================================
System uname: 2.6.17-hardened-r1 i686 VIA Ezra
Timestamp of tree: Thu, 15 Nov 2007 17:46:01 +0000
app-shells/bash:     3.2_p17-r1
dev-lang/python:     2.4.4-r4, 2.5.1-r3
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.10-r4
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.23-r1
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=c3 -Os -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=c3 -Os -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical --nospinner"
FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://polly.a.la.maison/gentoo http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://polly/portage"
USE="apache2 bash-completion berkdb bzip2 cracklib crypt curl dpms glibc-omitfp hardened imap imlib maildir mailwrapper midi moznocompose moznoirc ncurses network nptl nptlonly pic python readline rtc ruby slang ssl symlink unicode urandom usb userlocales x86 xml2 xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 SpanKY gentoo-dev 2007-11-17 22:56:40 UTC
-march=c3 targets i486 which does not match your CHOST which will break things when building glibc
Comment 2 Xavier Neys (RETIRED) gentoo-dev 2007-11-17 23:26:48 UTC
(In reply to comment #1)
> -march=c3 targets i486 which does not match your CHOST which will break things
> when building glibc

Yeah right, say that to the boxes that have been running fine for years...
How difficult is it not to override user-defined settings?

Portage 2.1.3.19 (hardened/x86/2.6, gcc-3.4.6, glibc-2.6-r0, 2.6.17-hardened-r1
i686)
System uname: 2.6.17-hardened-r1 i686 VIA Ezra
CFLAGS="-march=c3 -Os -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"

echo '>sys-libs/glibc-2.6' >> /etc/portage/package.mask
will do the trick

Comment 3 SpanKY gentoo-dev 2007-11-18 03:03:08 UTC
neither of those statements have any relevance at all

user settings are not being ignored, they're purposefully being changed.  just because it used to work doesnt mean it will continue to work ... glibc changes code with every release
Comment 4 Xavier Neys (RETIRED) gentoo-dev 2007-11-19 14:39:10 UTC
(In reply to comment #3)
> user settings are not being ignored, they're purposefully being changed.  just
> because it used to work doesnt mean it will continue to work ... glibc changes
> code with every release

Not purposefully changed, purposefully broken.
The only reason it breaks is setup_flags() in /usr/portage/sys-libs/glibc/files/eblits/common.eblit replaces a -march that works with one that does not.

Portage 2.1.3.19 (hardened/x86/2.6, gcc-3.4.6, glibc-2.7-r0, 2.6.23-hardened-r1 i686)
=================================================================
System uname: 2.6.23-hardened-r1 i686 VIA Ezra
Timestamp of tree: Fri, 16 Nov 2007 08:46:01 +0000
app-shells/bash:     3.2_p17-r1
dev-lang/python:     2.4.4-r4, 2.5.1-r3
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.10-r5
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.23-r1
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=c3 -Os -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=c3 -Os -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical --nospinner"
FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://polly.a.la.maison/gentoo http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://polly/portage"
USE="apache2 bash-completion berkdb bzip2 cracklib crypt curl dpms glibc-omitfp hardened imap imlib maildir mailwrapper midi moznocompose moznoirc ncurses network nptl nptlonly pic python readline rtc ruby slang ssl symlink unicode urandom usb userlocales x86 xml2 xorg zlib" ELIBC="glibc" KERNEL="linux" USERLAND="GNU"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

# cat /proc/cpuinfo 
processor       : 0
vendor_id       : CentaurHauls
cpu family      : 6
model           : 7
model name      : VIA Ezra
stepping        : 8
cpu MHz         : 800.065
cache size      : 64 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu de tsc msr cx8 mtrr pge mmx 3dnow
bogomips        : 1602.02
clflush size    : 32

oreilly ~ # ls -l /lib/libc.so.6 
lrwxrwxrwx 1 root root 11 Nov 19 09:12 /lib/libc.so.6 -> libc-2.7.so
oreilly ~ # /lib/libc.so.6 
GNU C Library stable release version 2.7, by Roland McGrath et al.
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.4.6 (Gentoo Hardened 3.4.6-r2, ssp-3.4.6-1.0, pie-8.7.9).
Compiled on a Linux >>2.6.23-hardened-r1<< system on 2007-11-18.
Available extensions:
        C stubs add-on version 2.1.2
        crypt add-on version 2.1 by Michael Glad and others
        Gentoo patchset 1.2
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        Support for some architectures added on, not maintained in glibc core.
        BIND-8.2.3-T5B
Comment 5 Chris Gianelloni (RETIRED) gentoo-dev 2008-04-16 19:29:18 UTC
Why does -march=c3 target i486, anyway?  The VIA C3 CPU is i686-compatible (minus CMOV, I think)...
Comment 6 Mark Loeser (RETIRED) gentoo-dev 2008-04-16 20:03:36 UTC
(In reply to comment #5)
> Why does -march=c3 target i486, anyway?  The VIA C3 CPU is i686-compatible
> (minus CMOV, I think)...
> 

Not as far as what GCC will do when you specify -march=c3  (I'm assuming you are asking why the flags get changed)

      {"c3", PROCESSOR_I486, PTA_MMX | PTA_3DNOW},
      {"c3-2", PROCESSOR_PENTIUMPRO, PTA_MMX | PTA_SSE},
Comment 7 ziakjan79 2008-10-27 15:06:59 UTC
(In reply to comment #5)
> Why does -march=c3 target i486, anyway?  The VIA C3 CPU is i686-compatible
> (minus CMOV, I think)...
> 

There are multiple versions of the C3 processor. Read http://en.wikipedia.org/wiki/VIA_C3

If you are sure you have a C3 with support for CMOV, then use -march=c3-2 and CHOST="i686-pc-linux-gnu". Otherwise, you have to use -march=c3 and CHOST="i486-pc-linux-gnu".

I suggest to change resolution of this bug to INVALID.
Comment 8 Xavier Neys (RETIRED) gentoo-dev 2008-11-01 09:48:08 UTC
(In reply to comment #7)

> If you are sure you have a C3 with support for CMOV, then use -march=c3-2 and
> CHOST="i686-pc-linux-gnu". Otherwise, you have to use -march=c3 and
> CHOST="i486-pc-linux-gnu".

There are several things I'm sure of:
1. you did not read the comments above, no worries, I'll sum it up below
2. as shown above, my C3 does not have cmov
3. setting -march to any value for glibc atm is pointless since gentoo's current build clobbers it with the value taken from CHOST
4. -march=c3 is the right CFLAG
5. CHOST="i686-pc-linux-gnu" need not be a problem
6. replacing a -march that works with one that does not is what this bug is about
7. downgrading plenty of -march values to i686 is fine with me, I can understand it saves a lot of potential problems but upgrading -march from c3 to i686 is not OK.

I hope this sums it up in a clear and concise way.

I had upgraded to 2.7 by hacking out the x86 case in setup_flags() in
/usr/portage/sys-libs/glibc/files/eblits/common.eblit
No issue for months on a box that is up 24x7
Now running 2.8

# /lib/libc.so.6 
GNU C Library stable release version 2.8, by Roland McGrath et al.
....
Comment 9 Ryan Hill (RETIRED) gentoo-dev 2008-11-01 16:19:48 UTC
(In reply to comment #8)
> There are several things I'm sure of:
> 1. you did not read the comments above, no worries, I'll sum it up below
> 2. as shown above, my C3 does not have cmov
> 3. setting -march to any value for glibc atm is pointless since gentoo's
> current build clobbers it with the value taken from CHOST
> 4. -march=c3 is the right CFLAG
> 5. CHOST="i686-pc-linux-gnu" need not be a problem

Sure it is.  It causes bug #199334.

> 6. replacing a -march that works with one that does not is what this bug is
> about
> 7. downgrading plenty of -march values to i686 is fine with me, I can
> understand it saves a lot of potential problems but upgrading -march from c3 to
> i686 is not OK.

Then use a CHOST that reflects the architecture you're on.

http://www.gentoo.org/doc/en/change-chost.xml
Comment 10 Xavier Neys (RETIRED) gentoo-dev 2008-11-01 16:47:06 UTC
(In reply to comment #9)
> > 5. CHOST="i686-pc-linux-gnu" need not be a problem
> 
> Sure it is.  It causes bug #199334.

Which would be fixed as soon as you fix this very bug

> > 7. downgrading plenty of -march values to i686 is fine with me, I can
> > understand it saves a lot of potential problems but upgrading -march from c3 to
> > i686 is not OK.

> Then use a CHOST that reflects the architecture you're on.

I am and I am not changing my CHOST even though it would be faster than getting you guys understand.

Don't bother, removing Gentoo's defective code is easy enough to make it work whenever I need to upgrade glibc on this box.
Comment 11 SpanKY gentoo-dev 2008-12-10 18:51:40 UTC
*** Bug 250527 has been marked as a duplicate of this bug. ***
Comment 12 SpanKY gentoo-dev 2008-12-10 18:51:46 UTC
*** Bug 225237 has been marked as a duplicate of this bug. ***
Comment 13 SpanKY gentoo-dev 2008-12-10 18:52:35 UTC
too many arch<->chost crap combos out there
Comment 14 Mark Loeser (RETIRED) gentoo-dev 2009-05-01 01:13:15 UTC
Use a CHOST that makes sense and this isn't a problem.  This has gone no where, and I'm not going to leave it open to rot.
Comment 15 SpanKY gentoo-dev 2011-03-20 22:24:03 UTC
should be fixed by using a bit more specific test

http://sources.gentoo.org/sys-libs/glibc/files/eblits/common.eblit?r1=1.19&r2=1.20