I ran into this problem when booting 32bit Ubuntu GNU/Linux on an old Athlon XP. A few programs died with SIGILL (illegal instruction).
I assume Ubuntu compiles even 32bit code with -mfpmath=sse
, and the programs that crashed were using double-precision floating point (i.e. SSE2). Athlon XP doesn't support SSE2. AMD64 k8 CPUs were the first AMD CPUs to support it.
Look for movsd
/ addsd
/ comisd
in the disassembly. (s = scalar, d = double. There could also be movapd
/ movupd
/ addpd
/ etc. (p = packed). grep
(or search in less
) for [sp]d .*%xmm
, and that should probably find any SSE2 instructions. packed 32bit int instructions also tend to end with d (e.g. pshufd
), but those are SSE2 or higher as well.
As @nrz correctly points out, not every instruction in a program will run. Also, some parts of the .text
segment may actually be data, not code. Still, look for the CPUID
instruction in disassembly output to see if the program checks what kind of CPU it's running on.
I do like @Michael's idea of disassembling to a temp file, adding a CPU limitation, and then checking for errors when you assemble.