Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 24379 - 'Illegal Instruction' and the AMD K6 CPUs
Summary: 'Illegal Instruction' and the AMD K6 CPUs
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High blocker (vote)
Assignee: Nicholas Jones (RETIRED)
: 24396 30482 73621 (view as bug list)
Depends on:
Reported: 2003-07-13 04:09 UTC by Jordi Ferrer Plana
Modified: 2006-03-29 05:45 UTC (History)
5 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Jordi Ferrer Plana 2003-07-13 04:09:12 UTC
During the bootstrap process I get an 'Illegal Instruction':

cdimage portage # tail -20 nohup.out                                        
CPP='gcc -E -x c-header'  
/var/tmp/portage/glibc-2.3.1-r4/work/glibc-2.3.1/buildhere/sunrpc/rpcgen -Y 
../scripts -c rpcsvc/bootparam_prot.x -o 
make[2]: *** 
Illegal instruction
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory 
make[1]: *** [sunrpc/others] Error 2
make[1]: Leaving directory 
make: *** [all] Error 2

!!! ERROR: sys-libs/glibc-2.3.1-r4 failed.
!!! Function src_compile, Line 221, Exitcode 2
!!! (no error message)

I have tryied (modifying make.conf) with -march=k6-2, -march=k6 and 
-mcpu=k6-2 combining with the "mmx 3dnow" USE flags and without any flag. 
It crashes always.

I have the following CPU:

cdimage proc # cat cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 5
model           : 8
model name      : AMD-K6(tm) 3D processor
stepping        : 12
cpu MHz         : 400.928
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 vme de pse tsc msr mce cx8 pge mmx syscall 3dnow 
bogomips        : 799.53

Reproducible: Always
Steps to Reproduce:
1.Follow the Gentoo Install Guide normaly
2.Execute the script

Actual Results:  
Illegal Instruccion Crash

Expected Results:  
Complete the bootstrap process

I have the nohup.out file for the complete bootstrap process before it crash 
but I can't attach here.
Comment 1 SpanKY gentoo-dev 2003-07-13 23:09:35 UTC
*** Bug 24396 has been marked as a duplicate of this bug. ***
Comment 2 SpanKY gentoo-dev 2003-07-13 23:12:26 UTC
ok, the issues are stemming from the fact that -march=k6-2 was in use ... 
changing over to -mcpu=k6-2 fixed the problems ... 
i'd suggest adding to make.conf warnings like we have for the p4 and athlon-4 
archs ... that is, 'please do not use the k6* archs as they tend to cause compile 
errors' ... i'm sure az can come up with a more correct error message 
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-07-13 23:42:51 UTC
The problem here relates solely to AMD's marketing.

There are _6_ different cores (that is based on the 'flags' field in /proc/cpuinfo):
[all also have 'fpu vme de pse tsc msr mce cx8']
mmx 3dnow syscall k6_mtrr 
mmx 3dnow pge syscall mtrr   
mmx 3dnow pge sep mtrr <-K6-2
mmx 3dnow pge syscall 3dnowext k6_mtrr <-K6-3

There are only 4 unique values for the 'model name' field:
AMD-K6(tm) 3D processor
AMD-K6(tm) 3D+ Processor
AMD-K6(tm)-III Processor
AMD-K6tm w/ multimedia extensions

In AMD's marketing, it is _very_ difficult to determine which chip you actually have.

GCC is a lot stricter in what it expects from each of it's K6-N settings, but this isn't documented much at all.

The user in this case has a K6 chip, not a K6-2 chip, which is why the -mcpu=K6-2 worked as opposed to -march=k6-2.

Nevertheless, I still think a warning to this effect would not hurt at all.

I personally have two chips, one labelled (etched/ingraved into the metal of the core) as 'AMD-K6(tm)-III' (400mhz chip) and the other as 'AMD-K6(tm)-3' (500mhz chip). The '-III' chip only works with -march=k6-2 and not -march=k6-3. The '-3' chip works fine with -march=k6-3.
Comment 4 Lisa Seelye (RETIRED) gentoo-dev 2003-07-14 12:55:57 UTC
IIRC you're not supposed to use -march with a k6, use -mcpu=k6-2 and it will work.

I ran into this problem long ago and found some docs somewhere (On Gentoo site?) that instructed me not to use -march with a k6-2.
Comment 5 Nicholas Jones (RETIRED) gentoo-dev 2003-07-16 02:07:37 UTC
Noted in make.conf for >=2.0.49_pre9
Comment 6 yak 2003-07-30 06:59:38 UTC
Is this bug about compile errors or correctly matching -march and cpu type? I have a K6-3 and a K6-3+ and both work perfectly fine with -march=k6-3. The model names displayed by /proc/cpuinfo are misleading though. The K6-3 is shown as AMD-K6(tm) 3D+ Processor, and the K6-3+ is shown as AMD-K6(tm)-III Processor, I would say neither are right. Can the model names be fixed, or is that info straight from the bios or cpu? 
Comment 7 Bjarke Freund-Hansen 2003-08-19 05:22:54 UTC
I have a K6-2 CPU (reported by the kernel as AMD-K6(tm) 3D processor), and I'm using "-march=k6-2 -O3 -pipe -fomit-frame-pointer" CFLAGS. I used to the Illigal Instruction a lot, especialy on larger compiles. But I then modded my CPU fan to run on 12V and not 7V. I haven't got a single Illigal Instruction since.

I encourge you (who use K6-n and get Illigal Instruction with -march=k6-n) to find an eksternal cooler/fan and point it towards your CPU, in addition to your usual fan. And try compile something big (fx mozilla or the linux kernel), and report your results here.

I have done bootstrapping on another K6, where I didn't have any problems using -march=k6 at all. But I wasen't mine, so I didn't get to emerge any ebuilds.
Comment 8 Heinrich Wendel (RETIRED) gentoo-dev 2003-10-07 07:33:40 UTC
*** Bug 30482 has been marked as a duplicate of this bug. ***
Comment 9 John Robinson 2003-10-23 10:17:22 UTC
I have a K6-2 500MHz chip, which has the same flags in /proc/cpuinfo as the
original reporter's does (apart from the speed reading of course). Everything
on my box is compiled with -march=k6-2 and I have not had any crashes.

I have USE="mmx 3dnow" but it never appears in my gcc command line; I was
expecting that -march=k6-2 would turn them on anyway but perhaps I'll try
a big compile...

In any case, while running bootstrap you're running plain i386 binaries without
any CPU-specific extensions; the point of running all those compiles from
the bootstrap is to generate code optimised for your CPU model! I think this
is a problem with cooling or somesuch akin to the good old sig-11 problem.
As such I think the remarks in the new /etc/make.conf ought to be removed
as they are incorrect.

Agreed there are many K6 CPUs (at the very least K6, K6-2, K6-2 3D, K6-III,
K6-2+, K6-III+) that aren't totally differentiated but Intel have a lot more
revisions and steppings of their CPUs that we don't bother to differentiate.
The only odd one I'm aware of is that actually a K6-2+ is a K6-III with less
L2 cache (other K6 and K6-2 have no L2 cache) and is derived from K6-III
so should be optimised -march=k6-3.
Comment 10 Myles Goodwin 2004-12-07 20:26:02 UTC
*** Bug 73621 has been marked as a duplicate of this bug. ***