Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 122697 - dev-libs/gmp-4.1.4-r3 provides "Illegal instruction" on AMD-K6
Summary: dev-libs/gmp-4.1.4-r3 provides "Illegal instruction" on AMD-K6
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 123823 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-02-13 08:40 UTC by Whit Blauvelt
Modified: 2015-04-08 07:01 UTC (History)
11 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 Whit Blauvelt 2006-02-13 08:40:08 UTC
Running the current clamav (clamd/clamscan - both the current ebuild and also the development version from clamav) against gmp-4.1.4-r3 consistently produces:

(gdb) run
Starting program: /usr/local/bin/clamscan 
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 8313)]

Program received signal SIGILL, Illegal instruction.
[Switching to Thread 16384 (LWP 8313)]
0xb7f2a965 in __gmpz_mul_2exp () from /usr/lib/libgmp.so.3

It makes no difference whether gmp is built with no switches, just the processor type set, or more. (This same library/program combination works just fine on an Athlon with moderately-agressive compile switches.)

# emerge --info
Portage 2.0.54 (default-linux/x86/2005.0, gcc-3.3.6, glibc-2.3.5-r2, 2.6.15-gentoo-r1Y i586)
=================================================================
System uname: 2.6.15-gentoo-r1Y i586 AMD-K6(tm) 3D processor
Gentoo Base System version 1.6.14
dev-lang/python:     2.2.3-r5, 2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.4.19-r1, 2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i586-pc-linux-gnu"
CFLAGS="-march=k6-2"
CHOST="i586-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=k6-2"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X alsa apm arts audiofile avi berkdb bitmap-fonts bzip2 crypt cups curl eds emboss encode esd expat fam flac foomaticdb fortran gd gdbm gif glut gmp gpm gstreamer gtk gtk2 imlib ipv6 jpeg kde lcms libg++ libwww mad mbox mhash mikmod mng motif mp3 mpeg mysql ncurses nls ogg oggvorbis opengl oss pam pcre pdflib perl png python qt quicktime readline sdl slang spell ssl svga tcltk tcpd tiff truetype truetype-fonts type1-fonts udev vorbis xine xml2 xmms xv xvid zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTDIR_OVERLAY
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-02-13 08:43:48 UTC
OK, try to recompile both w/ gcc-3.4.4-r1 first. If that doesn't help, try with -march=i586 and report back.
Comment 2 Whit Blauvelt 2006-02-13 09:40:45 UTC
Didn't I? 

# emerge -p gcc

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] sys-devel/gcc-3.4.4-r1

But -

/usr/bin/gcc -v
...
gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)

WTF? I'll emerge gcc again, but how has portage's notion of which gcc is installed gotten off-track? Is gcc slotted now? I'm not finding any other gcc binary on the system....
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2006-02-13 10:13:04 UTC
(In reply to comment #2)

Uhm, maybe reading the upgrading guide would help (hint: gcc-config) :)

http://www.gentoo.org/doc/en/gcc-upgrading.xml
Comment 4 Whit Blauvelt 2006-02-13 10:32:37 UTC
Well, I'll be darned. It's still actually 3.3.6 on the Athlon, too - although it's not having the Illegal instruction problem. That's what I get for running periodic emerge -u system sessions and not sitting there staring at every message that goes by, I guess. Back in my day, there weren't all these safety measures. Life was more fun.
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2006-02-13 10:38:20 UTC
(In reply to comment #4)

Heh... 

Well, this is 99% -march=k6-2 issue. Maybe gcc-3.4.4 handles it better, maybe not, and maybe you don't have K6-2 at all (K6 optimizations are really deceptive and it's hard to tell which K6 flavor your CPU exactly is, so best to avoid using it for -march completely).
Comment 6 Whit Blauvelt 2006-02-13 11:21:07 UTC
Two notes:

1 - I tried compiling gmp without march set at all (as I said) - same difference.

2 - I'm real sure this is a K6-2. Built the system myself, back when that was the lastest and greatest CPU. 

Anyway, probably won't be until tomorrow that I know if the gcc upgrade does it, since that requires recompiling half the system.
Comment 7 Whit Blauvelt 2006-02-15 05:47:12 UTC
Okay guys, I did the full gcc upgrade, and now the system is broken for more critical applications:

Cannot load /usr/lib/apache/modules/libphp4.so into server: /usr/X11R6/lib/libgmp.so.3: undefined symbol: __gmpn_com_n

I just rebuilt gmp with no flags set at all (no -march), and it stays broken. This is primarily a webserver, so ... not good! It did end up building with -mcpu=i686 (this on a i586) but that shouldn't have broken it (although gcc says mcpu is depricated in favor of mtune...).

So: What do I do? I need to get this server back up ASAP. It appears there's a serious bug in the gmp-4.1.4-r3 ebuild when run on the AMD k6-2. Should I revert to an earlier gmp? Should I build again with -mcpu=i586? (although with -march=i586 it also fails)? 

the current system:
# emerge --info
Portage 2.0.54 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r2, 2.6.15-gentoo-r1Y i586)
=================================================================
System uname: 2.6.15-gentoo-r1Y i586 AMD-K6(tm) 3D processor
Gentoo Base System version 1.6.14
dev-lang/python:     2.2.3-r6, 2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.4.19-r1, 2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i586-pc-linux-gnu"
CFLAGS="-O2 -mcpu=i686 -pipe"
CHOST="i586-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS=""
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X alsa apm arts audiofile avi berkdb bitmap-fonts bzip2 crypt cups curl eds emboss encode esd expat fam foomaticdb fortran gd gdbm gif glut gmp gpm gstreamer gtk gtk2 imlib ipv6 jpeg kde lcms libg++ libwww mad mbox mhash mikmod mng motif mp3 mpeg mysql ncurses nls ogg oggvorbis opengl oss pam pcre pdflib perl png python qt quicktime readline sdl slang spell ssl svga tcltk tcpd tiff truetype truetype-fonts type1-fonts udev vorbis xine xml2 xmms xv xvid zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTDIR_OVERLAY
Comment 8 Whit Blauvelt 2006-02-15 06:32:59 UTC
Re-emerging at present (straight 4.1.4 with -mcpu=k6-2)

At the top of the process it complains about aclocal.m4 being out of date - suggests running a command to update it that doesn't happen to work - so I've gone on with the emerge. Could this be the crux?

Hard to find clear documentation on aclocal. I'm looking at http://dev.gentoo.org/~plasmaroo/devmanual/general-concepts/autotools/ at present, but of course that's not advice at the user's level. What's the effective way to update it?
Comment 9 Whit Blauvelt 2006-02-15 06:39:54 UTC
Straight 4.1.4 with -mcpu=k6-2 works!

Known not to work:
4.1.4-r3 with -march=k6-2
4.1.4-r3 with implicit -mcpu=i686
Comment 10 Whit Blauvelt 2006-02-15 09:57:34 UTC
Comfirmed clamav now works too.
Comment 11 Alex Holden 2006-02-16 01:46:46 UTC
I just encountered the same problem on a P3. After upgrading to gmp-4.1.4-r3, Clamav died with an illegal instruction exception inside __gmpz_mul_2exp(). Downgrading to gmp-4.1.4 has worked around it for now.

# gcc -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnu/3.3.6/specs
Configured with: /var/tmp/portage/gcc-3.3.6/work/gcc-3.3.6/configure --prefix=/usr --bindir=/usr/i586-pc-linux-gnu/gcc-bin/3.3.6 --includedir=/usr/lib/gcc-lib/i586-pc-linux-gnu/3.3.6/include --datadir=/usr/share/gcc-data/i586-pc-linux-gnu/3.3.6 --mandir=/usr/share/gcc-data/i586-pc-linux-gnu/3.3.6/man --infodir=/usr/share/gcc-data/i586-pc-linux-gnu/3.3.6/info --with-gxx-include-dir=/usr/lib/gcc-lib/i586-pc-linux-gnu/3.3.6/include/g++-v3 --host=i586-pc-linux-gnu --build=i586-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --disable-multilib --disable-libgcj --enable-languages=c,c++,f77 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)

CHOST is set to "i586-pc-linux-gnu" and CFLAGS is not set.
Comment 12 SpanKY gentoo-dev 2006-02-23 17:20:39 UTC
*** Bug 123823 has been marked as a duplicate of this bug. ***
Comment 13 Juergen Nagel 2006-02-24 14:13:27 UTC
I had the same problem, too (also on a K6-2).
Playing around with CFLAGS as Whit did didn't help.

But I got 4.1.4-r3 to work when I uncommented the line
"epatch "${FILESDIR}"/${P}-noexecstack.patch".
BTW, as a side-effect the linker warnings about the GNU-stack-notes disappeared.
Comment 14 Peter Rofner 2006-03-02 05:47:02 UTC
I have the same issues with 4.1.4-r3 on a Via Samuel procesor. mtune=c3 (my current default) or mcpu=i586 fails to run clamav with an Illegal Instruction. Reverting to 4.1.4 as a fix which seems to work.(In reply to comment #0)
Comment 15 Christian Gnägi 2006-03-02 14:19:12 UTC
I have the exact same problems here on Via C3.
Maybe change the title of the bug, processor type does
not seem to be an issue.
Using gcc-3.4.4-r1, I manually 
(ebuild fetch, ebuild unpack, ebuild compile)
compiled gmp-4.1.4 and gmp-4.1.4-r3; then as is recommended 
on the GMP-Library website: http://www.swox.com/gmp/
i did "make check" on both versions.
gmp-4.1.4 passed first 53, then 68 tests without error;
finishing ok.
gmp-4.1.4-r3 aborted after failing the first three tests
with illegal instruction.
The GMP-Library website strongly discourages using GMP without
first running "make check", citing numerous cases of miscompilation
with various compilers or versions of GCC.

I suggest integrating "make check" into the ebuild or merge process
and I would try it, but I have no idea about how to do it. Pointers
to examples or information would be welcome.

Will now upgrade gcc to 3.4.5 and try again. Will post results.
Comment 16 Christian Gnägi 2006-03-03 02:58:03 UTC
Now I tried the same thing using gcc 3.4.5.
The results are exactly the same.

For information:

root gr{~} gcc -v
Reading specs from /usr/lib/gcc/i586-pc-linux-gnu/3.4.5/specs
Configured with: /tmp/portage/gcc-3.4.5/work/gcc-3.4.5/configure --prefix=/usr --bindir=/usr/i586-pc-linux-gnu/gcc-bin/3.4.5 --includedir=/usr/lib/gcc/i586-pc-linux-gnu/3.4.5/include --datadir=/usr/share/gcc-data/i586-pc-linux-gnu/3.4.5 --mandir=/usr/share/gcc-data/i586-pc-linux-gnu/3.4.5/man --infodir=/usr/share/gcc-data/i586-pc-linux-gnu/3.4.5/info --with-gxx-include-dir=/usr/lib/gcc/i586-pc-linux-gnu/3.4.5/include/g++-v3 --host=i586-pc-linux-gnu --build=i586-pc-linux-gnu --disable-altivec --disable-nls --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --disable-multilib --disable-libgcj --enable-languages=c,c++,f77 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.5 (Gentoo 3.4.5, ssp-3.4.5-1.0, pie-8.7.9)

root gr{~} emerge --info
Portage 2.0.54 (default-linux/x86/2005.0, gcc-3.4.5, glibc-2.3.5-r2, 2.6.8.1-epia1 i686)
=================================================================
System uname: 2.6.8.1-epia1 i686 VIA Samuel 2
Gentoo Base System version 1.6.14
ccache version 2.3 [enabled]
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i586-pc-linux-gnu"
CFLAGS="-march=i586 -m3dnow -mmmx -Os -pipe"
CHOST="i586-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=i586 -m3dnow -mmmx -Os -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distcc distlocks sandbox sfperms strict"
GENTOO_MIRRORS="ftp://mirror.switch.ch/mirror/gentoo/ http://mirror.switch.ch/mirror/gentoo/ http://ftp.easynet.nl/mirror/gentoo/"
MAKEOPTS="-j7"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 apache apache2 audiofile berkdb bzip2 cdr crypt curl eds emboss expat fortran gd gdbm geoip gmp gstreamer idn imlib jpeg ldap libg++ libwww mhash mp3 mysql ncurses nptl ogg pam pcre perl php png python samba slang spell ssh ssl tcpd tiff truetype-fonts type1-fonts udev vorbis xml2 zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS



Comment 17 bob5972 2006-03-04 18:28:10 UTC
I get the same problem on my pentium-mmx system, using -march=pentium-mmx .

I found this page on the Redhat bugzilla that seems to be a similar problem.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=118518

Gentoo doesn't seem to have an /usr/lib/sse2, so I'm not sure how to relate the two problems.

In my case I solved it by masking gmp-4.1.4-r3 and going back to gmp-4.1.4
Comment 18 Grant Slater 2006-07-10 05:06:32 UTC
This bug now seems to be resolved on my machine... using dev-libs/gmp-4.1.4-r3

Must have been a compiler issue? Please can someone confirm and close this bug.


Portage 2.1-r1 (default-linux/x86/2006.0, gcc-3.4.6, glibc-2.3.6-r4, 2.6.10-cobalt i586)
=================================================================
System uname: 2.6.10-cobalt i586 AMD-K6(tm) 3D processor
Gentoo Base System version 1.6.15
app-admin/eselect-compiler: [Not Present]
dev-lang/python:     2.3.5-r2, 2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.13-r3
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i586-pc-linux-gnu"
CFLAGS="-Os -mtune=k6 -march=k6 -mmmx -m3dnow -pipe -fomit-frame-pointer"
CHOST="i586-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/bind /var/service"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-Os -mtune=k6 -march=k6 -mmmx -m3dnow -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks maketest metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://mir.zyrianes.net/gentoo/ http://ftp.du.se/pub/os/gentoo http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://gentoo.blueyonder.co.uk http://gentoo.ITDNet.net/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'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="x86 3dnow apache2 apm avi berkdb bitmap-fonts bzip2 bzlib cjk cli crypt curl dlloader dri eds emboss encode esd exif fam ffmpeg flash foomaticdb freetype ftp gd gdbm geoip gif gmp graphviz gstreamer iconv idn imagemagick imap imlib innodb isdnlog java javascript jbig jpeg libg++ libwww mad maildir mailwrapper mcal mhash mikmod mime ming mmap mmx mng mp3 mpeg mpm-worker mysql ncurses nptl ogg oggvorbis opengl oss pam pcre pdflib perl php pic plotutils png pppd python qt3 qt4 quicktime readline recode reflection rrdtool sasl session sharedmem snmp speex spell spl sqlite ssl tcpd tetex theora tidy tiff truetype truetype-fonts type1-fonts udev unicode urandom vhosts vorbis wmf xml xml2 xmlrpc xorg xv zlib elibc_glibc input_devices_keyboard input_devices_mouse input_devices_evdev kernel_linux userland_GNU"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 19 Jakub Moc (RETIRED) gentoo-dev 2007-04-08 19:26:02 UTC
Still even remotely relevant w/ gpm-4.2.1-r1?
Comment 20 Christian Gnägi 2007-04-08 19:57:01 UTC
I am using 4.2.1 right now. The issue seems to have gone.