Skip to contentSkip to conversation

biarch gcc support for ppc32

PATCH In review Olaf Hering 2 participants 2 messages Jul 4, 2004 – Jul 5, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 biarch gcc support for ppc32

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

arch/ppc/Makefile +7 -0
diff -purNX /tmp/kernel_exclude.txt linux-2.6.7.orig/arch/ppc/Makefile linux-2.6.7/arch/ppc/Makefile
@@ -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)
arch/ppc/kernel/vmlinux.lds.S +1 -1
diff -purNX /tmp/kernel_exclude.txt linux-2.6.7.orig/arch/ppc/kernel/vmlinux.lds.S linux-2.6.7/arch/ppc/kernel/vmlinux.lds.S
@@ -1,6 +1,6 @@
 #include <asm-generic/vmlinux.lds.h>
 
-OUTPUT_ARCH(powerpc)
+OUTPUT_ARCH(powerpc:common)
 jiffies = jiffies_64 + 4;
 SECTIONS
 {
Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#1 lore raw
Quoted 4 lines · Olaf Hering

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:

Have all of these changes been tested with a ppc32 compiler as well? If so, this looks fine.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/