Skip to contentSkip to conversation

arch/powerpc: Fix zImage wrapper with 64bit only toolchains

PATCH New Cyril Bur 1 participant 1 message Mar 16, 2017 PowerPC

lore
Share & tools
lore

Cyril Bur

author
#0 lore raw

PATCH 1/1 arch/powerpc: Fix zImage wrapper with 64bit only toolchains

Historically the zImage wrapper has needed to be compiled 32bit to run on 32bit only platforms. Today some platforms can have 64bit wrappers as they've always been 64bit compatible, notably little endian systems.

Problems arise when a kernel and zImage are cross compiled with a 64bit only toolchain. The Makefile will determine that the toolchain is not 32bit compatible and whilst attempting to fall back to CROSS32CC or CROSS32_COMPILE which are unlikely to be set, it falls back to using gcc, the host compiler.

On platforms that can have the wrapper compiled 64bit (and where the compiler is not 32bit capable), the Makefile should first fall back to the compiler it used for the rest of the kernel.

---
 arch/powerpc/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/powerpc/Makefile +10 -0
index 8b433334d5af..e7a90952ed36 100644
@@ -25,6 +25,16 @@ ifeq ($(CROSS32_COMPILE),)
 CROSS32CC	:= $(CC) -m32
 KBUILD_ARFLAGS	+= --target=elf32-powerpc
 endif
+else
+ifeq ($(CONFIG_PPC64_BOOT_WRAPPER),y)
+ifeq ($(CROSS32_COMPILE),)
+#The 64bit only toolchain is perfectly capable of building a 64bit
+#boot wrapper.
+#So use it
+CROSS32CC	:= $(CC)
+CROSS32AR	:= $(AR)
+endif
+endif
 endif
 
 export CROSS32CC CROSS32AR
Signature · 1 line
2.12.0