How To Use Code or a Compiler Compiled for a 486 on a 386

How To Use Code or a Compiler Compiled for a 486 on a 386

Yes, unless it's the kernel.

The -m486 option to GCC, which is used to compile binaries for x486
machines, merely changes certain optimizations. This makes for
slightly larger binaries that run somewhat faster on a 486. They still
work fine on a 386, though, with a small performance hit.

However, from version 1.3.35 the kernel uses 486 or Pentium-specific
instructions if configured for a 486 or Pentium, thus making it
unusable on a 386.

GCC can be configured for a 386 or 486; the only difference is that
configuring it for a 386 makes -m386 the default and configuring for a
486 makes -m486 the default. In either case, these can be overridden
on a per-compilation basis or by editing /usr/lib/gcc-lib/i*-linux/
n.n.n/specs.

There is an alpha version of GCC that knows how to do optimization
well for the 586, but it is quite unreliable, especially at high
optimization settings. The Pentium GCC can be found on
ftp://tsx-11.mit.edu/pub/linux/ALPHA/pentium-gcc/. The ordinary 486
GCC supposedly produces better code for the Pentium using the -m386,
or at least slightly smaller.



Home
FAQ