# openssh produces 'Illegal instruction'

## dickbn

im going to set up an old i386 based machine as a router, using gentoo 1.4 (i use this machine as a router since about 3 years with suse 6.3 installed). i compiled from stage1 without accepting any masked packages on an athlon-xp, relevant settings in /etc/make.conf are:

```

USE="-apm -arts -avi -berkdb -crypt cups -encode -foomaticdb -gdbm -gif -gnome -gpm -gtk -imlib -java -jpeg -kde -libg++ -libwww -mad mbox -mikmod -mmx -motif -mpeg -nls -oggvorbis -opengl -oss -pam pdflib -png -python -qt -quicktime -sdl -spell ssl -svga -tcpd truetype -X -xml2 -xmms -xv"

CHOST="i386-pc-linux-gnu"

CFLAGS="-march=i386 -O3 -pipe -funroll-loops"

CXXFLAGS="${CFLAGS}"

```

the systems works well irrespective man an ssh. when ssh'ing localhost output is 'connection closed' after about 30 secs without the possibility to log in. when ssh'ing a foreign host ssh breaks with an 'Illegal instruction'. The tail of strace-output for this is:

```

close(4)                                = 0

munmap(0x40013000, 4096)                = 0

brk(0)                                  = 0x809a000

brk(0x809b000)                          = 0x809b000

brk(0)                                  = 0x809b000

brk(0x809c000)                          = 0x809c000

brk(0)                                  = 0x809c000

brk(0x809d000)                          = 0x809d000

--- SIGILL (Illegal instruction) @ 0 (0) ---

+++ killed by SIGILL +++

```

groff also produces an 'Illegal instruction' for a few manpages when used by man.

when ssh'ing an unreachable host ssh breaks without an 'Illegal instruction', so i think the problem has something to do with formating the text after the ssh-connection has been established.

emerging openssh 3.5 / 3.6 instead of 3.7 didn't solve the problem. because ssh as well as man depends on groff i tried to install prior versions of groff (i also installed the groff-rpm i used within the above mentioned suse-system) but ssh still produces this 'Illegal instruction'.

has anybody an idea?

----------

## mike4148

Try putting a "-sse" in your USE flags.

----------

## pjp

Moved from Installing Gentoo.

----------

## dickbn

thank you, i'm going to try this but i think it won't be successfull because it works fine on an athlon-xp without sse being enabled by bios or kernel (by default).

----------

## dickbn

in fact adding -sse to the use-flags didn't solve the problem. the 'iillegal instruction' seems to be an instruction added in the development from i386 to i486, because everything works fine on an i486 cpu. is it possible that the problem has something to do with the math-coprocessor (i387) on the i386-based machine?

----------

## mike4148

Well, if you don't have one, you'll want to enable Math Coprocessor Emulation in your kernel config 

(CONFIG_MATH_EMULATION).

----------

## dickbn

i'm sure i have a math-coprocessor on the i386 (bios shows it  :Wink:  ),

however i'm not shure i have one on the i486.

i'll check the kernel-configuration.

is it possible, that i have to explicitly set the flag indicating usage of the (physical) math-coprocessor?

----------

## mike4148

If you're talking about GCC, no.

If you're talking about the kernel, you have to set CONFIG_MATH_EMULATION to run any binaries with fp

instructions on a machine that does not have a coprocessor. On a machine that has one, you don't have to do a thing. In fact, if

you did enable it on a machine with an FPU, the FPU would be used instead of the emulation.

Finally, if all else fails, just compile ssh and groff on the i386 itself; there might be something that's detecting CPU features

on the Athlon-XP and using them in its code. If that doesn't work, try doing the same with OpenSSL.

----------

