diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2017-07-26 09:19:04 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-07-28 05:35:46 -0400 |
commit | 65c5ec11c25eff6ba6e9b1cbfff014875fddd1e0 (patch) | |
tree | 5d5c6d3882e07258fcca4453ace80daa797f679c | |
parent | 7b7622bb95eb587cbaa79608e47b832a82a262b1 (diff) |
powerpc/boot: Fix 64-bit boot wrapper build with non-biarch compiler
Historically the boot wrapper was always built 32-bit big endian, even
for 64-bit kernels. That was because old firmwares didn't necessarily
support booting a 64-bit image. Because of that arch/powerpc/boot/Makefile
uses CROSS32CC for compilation.
However when we added 64-bit little endian support, we also added
support for building the boot wrapper 64-bit. However we kept using
CROSS32CC, because in most cases it is just CC and everything works.
However if the user doesn't specify CROSS32_COMPILE (which no one ever
does AFAIK), and CC is *not* biarch (32/64-bit capable), then CROSS32CC
becomes just "gcc". On native systems that is probably OK, but if we're
cross building it definitely isn't, leading to eg:
gcc ... -m64 -mlittle-endian -mabi=elfv2 ... arch/powerpc/boot/cpm-serial.c
gcc: error: unrecognized argument in option ‘-mabi=elfv2’
gcc: error: unrecognized command line option ‘-mlittle-endian’
make: *** [zImage] Error 2
To fix it, stop using CROSS32CC, because we may or may not be building
32-bit. Instead setup a BOOTCC, which defaults to CC, and only use
CROSS32_COMPILE if it's set and we're building for 32-bit.
Fixes: 147c05168fc8 ("powerpc/boot: Add support for 64bit little endian wrapper")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
-rw-r--r-- | arch/powerpc/boot/Makefile | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index a7814a7b1523..6f952fe1f084 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -25,12 +25,20 @@ compress-$(CONFIG_KERNEL_XZ) := CONFIG_KERNEL_XZ | |||
25 | BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 25 | BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
26 | -fno-strict-aliasing -Os -msoft-float -pipe \ | 26 | -fno-strict-aliasing -Os -msoft-float -pipe \ |
27 | -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ | 27 | -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ |
28 | -isystem $(shell $(CROSS32CC) -print-file-name=include) \ | ||
29 | -D$(compress-y) | 28 | -D$(compress-y) |
30 | 29 | ||
30 | BOOTCC := $(CC) | ||
31 | ifdef CONFIG_PPC64_BOOT_WRAPPER | 31 | ifdef CONFIG_PPC64_BOOT_WRAPPER |
32 | BOOTCFLAGS += -m64 | 32 | BOOTCFLAGS += -m64 |
33 | else | ||
34 | BOOTCFLAGS += -m32 | ||
35 | ifdef CROSS32_COMPILE | ||
36 | BOOTCC := $(CROSS32_COMPILE)gcc | ||
37 | endif | ||
33 | endif | 38 | endif |
39 | |||
40 | BOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) | ||
41 | |||
34 | ifdef CONFIG_CPU_BIG_ENDIAN | 42 | ifdef CONFIG_CPU_BIG_ENDIAN |
35 | BOOTCFLAGS += -mbig-endian | 43 | BOOTCFLAGS += -mbig-endian |
36 | else | 44 | else |
@@ -183,10 +191,10 @@ clean-files := $(zlib-) $(zlibheader-) $(zliblinuxheader-) \ | |||
183 | empty.c zImage.coff.lds zImage.ps3.lds zImage.lds | 191 | empty.c zImage.coff.lds zImage.ps3.lds zImage.lds |
184 | 192 | ||
185 | quiet_cmd_bootcc = BOOTCC $@ | 193 | quiet_cmd_bootcc = BOOTCC $@ |
186 | cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< | 194 | cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< |
187 | 195 | ||
188 | quiet_cmd_bootas = BOOTAS $@ | 196 | quiet_cmd_bootas = BOOTAS $@ |
189 | cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< | 197 | cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< |
190 | 198 | ||
191 | quiet_cmd_bootar = BOOTAR $@ | 199 | quiet_cmd_bootar = BOOTAR $@ |
192 | cmd_bootar = $(CROSS32AR) -cr$(KBUILD_ARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ | 200 | cmd_bootar = $(CROSS32AR) -cr$(KBUILD_ARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ |