Re: #define __linux__

Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
Sun, 23 Aug 1998 21:55:33 +0200 (CEST)


On Sun, 23 Aug 1998, Kenneth Johansson wrote:
> Alan Cox wrote:
> > > >Now where is __linux__ set?? I can not find a singe define for this and
> > > >yet when I compile with the normal compiler its set.
> > >
> > > The compiler ought to define it automatically. If your cross compiler doesn't
> > > then it's broken.
> >
> > That depends. If its a generic x86 cross compiler then its not broken. And
> > the fix is to either add -D__linux__ to the CFLAGS or to tweak the spec file
> > to define it.
> >
> > Alan
>
> It was compiled with --target=ppc-linux-elf. I guess that is should have included
> __linux__.
> As the makefile for ppc have hard coded the cross compiler to ppc-linux-elf even if
> one changed it in the top Makefile I guess they think it works.
>
> Anyway if I change the spec file and some minor things in the kernel source it at
> least compiles and builds a vmlinux object. Its probably a few weeks before I can
> say if it really works. Have to write some boot code first.

Last time I used my PPC cross compiler on the Pentium, I didn't have to add
anything special. The compiler is called ppc-linux-elf-gcc and works without
twiddling with any config files. Just don't forget to add `ARCH=ppc' to all
your make commands, e.g.

make ARCH=ppc zImage

What kernel version were you trying to compile? For Linux/PPC, the tree at
vger.rutgers.edu is your friend.

> One strange thing was that if I changes -O2 to -g it faild the final link but -O2
> -g works ??? well Iam using the latest snapshot of egcs so I guess I asked for it
> :)

That's because many functions are available as inline functions only. If you
compile without optimization, they won't be there.

Greetings,

Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium

- 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.altern.org/andrebalsa/doc/lkml-faq.html