allow kernel compile with native ppc64 compiler
PATCH 1/1 allow kernel compile with native ppc64 compiler
The zImage is a 32bit binary, but a native powerpc64-linux gcc will produce 64bit objects in arch/ppc64/boot.
This patch fixes it.
arch/ppc64/boot/Makefile +4 -4
@@ -23,14 +23,14 @@ CROSS32_COMPILE ?= #CROSS32_COMPILE = /usr/local/ppc/bin/powerpc-linux- -BOOTCC := $(CROSS32_COMPILE)gcc +BOOTCC := $(CROSS32_COMPILE)gcc -m32 HOSTCC := gcc BOOTCFLAGS := $(HOSTCFLAGS) $(LINUXINCLUDE) -fno-builtin -BOOTAS := $(CROSS32_COMPILE)as +BOOTAS := $(CROSS32_COMPILE)as -a32 BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -BOOTLD := $(CROSS32_COMPILE)ld +BOOTLD := $(CROSS32_COMPILE)ld -m elf32ppc BOOTLFLAGS := -Ttext 0x00400000 -e _start -T $(srctree)/$(src)/zImage.lds -BOOTOBJCOPY := $(CROSS32_COMPILE)objcopy +BOOTOBJCOPY := $(CROSS32_COMPILE)objcopy --target elf32-powerpc OBJCOPYFLAGS := contents,alloc,load,readonly,data src-boot := crt0.S string.S prom.c main.c zlib.c imagesize.c div64.S
arch/ppc64/boot/zImage.lds +1 -1
@@ -1,4 +1,4 @@ -OUTPUT_ARCH(powerpc) +OUTPUT_ARCH(powerpc:common) SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); /* Do we need any of these for elf? __DYNAMIC = 0; */
Signature · 3 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG
Quoted 3 lines · Olaf Hering
The zImage is a 32bit binary, but a native powerpc64-linux gcc will produce 64bit objects in
arch/ppc64/boot.
This patch fixes it.
... and breaks the compile on older toolchains that don't understand -m32. We need to make the -m32 conditional on HAS_BIARCH as defined in arch/ppc64/Makefile.
Paul.
Quoted 9 lines · Paul Mackerras
Quoted 3 lines · Olaf Hering
The zImage is a 32bit binary, but a native powerpc64-linux gcc will produce 64bit objects in
arch/ppc64/boot.
This patch fixes it.... and breaks the compile on older toolchains that don't understand -m32. We need to make the -m32 conditional on
HAS_BIARCHas defined inarch/ppc64/Makefile.
how old?
Signature · 3 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG
Quoted 5 lines · Olaf Hering
Quoted 3 lines
... and breaks the compile on older toolchains that don't understand -m32. We need to make the -m32 conditional on
HAS_BIARCHas defined inarch/ppc64/Makefile.how old?
The gcc that comes with debian sid doesn't understand -m32. That's a 32-bit gcc, which means that I set CROSS_COMPILE when doing a ppc64 kernel compile. With your patch I have to set CROSS32_COMPILE as well, which seems silly when I'm compiling on a ppc32 box already.
Ben H suggested making the default BOOTCC be $(CC) -m32, which makes sense to me.
Paul.
Quoted 6 lines · Paul Mackerras
Quoted 4 lines · Olaf Hering
Quoted 3 lines
... and breaks the compile on older toolchains that don't understand -m32. We need to make the -m32 conditional on
HAS_BIARCHas defined inarch/ppc64/Makefile.
Quoted 6 lines
Quoted 1 line
how old?
The gcc that comes with debian sid doesn't understand -m32. That's a 32-bit gcc, which means that I set
CROSS_COMPILEwhen doing a ppc64 kernel compile. With your patch I have to setCROSS32_COMPILEas well, which seems silly when I'm compiling on a ppc32 box already.
Makes sense, I confused a native powerpc64-linux gcc from last century with a native/cross powerpc-linux gcc from last century.
Quoted 2 lines
Ben H suggested making the default BOOTCC be $(CC) -m32, which makes sense to me.
That may break cross compile. I will provide a new patch.
Signature · 3 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG
Quoted 3 lines · Olaf Hering
Quoted 3 lines
Ben H suggested making the default BOOTCC be $(CC) -m32, which makes sense to me.
How so ? The idea is to add -m32 to whatever compiler you are using for the rest of the kernel (assuming bi-arch) which is a lot more sane than using whatever _local_ compiler you are using _and_ assuming bi-arch...
Of course, that would only be the "defaul", with the ability of explicitly passing CROSS32_COMPILE to make...
Ben.