Re: Possible GCC contamination of Linux

Richard B. Johnson (root@chaos.analogic.com)
Mon, 20 Sep 1999 14:43:07 -0400 (EDT)


On Mon, 20 Sep 1999, Artur Frysiak wrote:

> On Mon, 20 Sep 1999, Richard B. Johnson wrote:
>
> >
> > Hello,
> > I spent the weekend trying to track down the reason why Linux (any
> > recent version), complied for a 486-SX (no FPU), will not boot.
> > It crashes during startup, about the time it looks for a PCI bus.
> >
> > The C Compiler (version 2.8.1) was compiled on a i686 machine. If I
> > recompile on a '486, it will generate a Linux image that boots okay.
> >
> > So it looks as though the C Compiler, compiled on a 686, generates 686
> > machine-code instructions. I don't think this is the correct behavior
> > because the gcc command-line contains -m486.
> >
> > So, is there the possibility that something from the gcc library gets
> > linked into the kernel? If so, how would I prevent it from happening?
>
> Probably bug in gcc. Please add -mcpu=i486 and recompile Linux kernel on
> i686.
> If works add this as workaround for i386 arch.
>
> On gcc 2.95.1 on i586 -m486 is equivalent to -m486 -mcpu=i486
>
> Wiget

I compiled with -fno-builtins, in addition to what you advise, and found
that abs() was an indefined symbol. I added an abs() macro to
../linux/include/stddef.h, i.e.,

#define abs(a) (((a)>=0)?(a):-(a))

And included this header in ../linux/arch/i386/kernel/timer.c, and
../linux/fs/open.c, where it was being used.

The result is that I can now boot the '486 from a kernel built on
my 686.

I do not know what header should really contain this macro so I did
not make a patch. I note that other macros like min() and max() are
defined for specific devices (wanpipe.h) and probably should be
moved to a common header file.

Cheers,
Dick Johnson
**** FILE SYSTEM WAS MODIFIED ****
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/