
From: Olaf Hering <olh@suse.de>

A native powerpc64-linux gcc can not compile a ppc32 kernel properly.  This
patch fixes it.  It was copied from ppc64.  The change to vmlinux.lds.S
fixes this error:

ld: warning: powerpc:common architecture of input file `init/built-in.o' is
incompatible with powerpc:common64 output

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/ppc/Makefile             |    7 +++++++
 25-akpm/arch/ppc/kernel/vmlinux.lds.S |    2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff -puN arch/ppc/kernel/vmlinux.lds.S~ppc32-biarch-gcc-support arch/ppc/kernel/vmlinux.lds.S
--- 25/arch/ppc/kernel/vmlinux.lds.S~ppc32-biarch-gcc-support	2004-07-04 21:31:54.048421416 -0700
+++ 25-akpm/arch/ppc/kernel/vmlinux.lds.S	2004-07-04 21:31:54.053420656 -0700
@@ -1,6 +1,6 @@
 #include <asm-generic/vmlinux.lds.h>
 
-OUTPUT_ARCH(powerpc)
+OUTPUT_ARCH(powerpc:common)
 jiffies = jiffies_64 + 4;
 SECTIONS
 {
diff -puN arch/ppc/Makefile~ppc32-biarch-gcc-support arch/ppc/Makefile
--- 25/arch/ppc/Makefile~ppc32-biarch-gcc-support	2004-07-04 21:31:54.049421264 -0700
+++ 25-akpm/arch/ppc/Makefile	2004-07-04 21:31:54.053420656 -0700
@@ -13,6 +13,13 @@
 # This must match PAGE_OFFSET in include/asm-ppc/page.h.
 KERNELLOAD	:= $(CONFIG_KERNEL_START)
 
+HAS_BIARCH	:= $(shell if $(CC) -m32 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi;)
+ifeq ($(HAS_BIARCH),y)
+AS		:= $(AS) -a32
+LD		:= $(LD) -m elf32ppc
+CC		:= $(CC) -m32
+endif
+
 LDFLAGS_vmlinux	:= -Ttext $(KERNELLOAD) -Bstatic
 CPPFLAGS	+= -Iarch/$(ARCH)
 AFLAGS		+= -Iarch/$(ARCH)
_
