1From a0919e3177295f4aaa9006915adcddc31788d809 Mon Sep 17 00:00:00 2001
2From: Ben Hutchings <ben@decadent.org.uk>
3Date: Wed, 26 Dec 2018 00:00:40 +0000
4Subject: [PATCH] powerpc: Fix -mcpu= options for SPE-only compiler
5
6GCC for Debian's "powerpcspe" architecture only supports 32-bit
7SPE targets, and using -mcpu=powerpc or -mcpu=powerpc64 is a fatal
8error.
9
10* Change the test for a biarch compiler to pass both the -m32 and -m64
11  options, so that it doesn't catch 32-bit-only compilers
12* Add an ifdef CONFIG_PPC64 around the 64-bit CPU option definitions
13
14Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
15[Romain: Patch from Debian repository:
16https://salsa.debian.org/kernel-team/linux/-/blob/buster/debian/patches/bugfix/powerpc/powerpc-fix-mcpu-options-for-spe-only-compiler.patch]
17Signed-off-by: Romain Naour <romain.naour@gmail.com>
18---
19 arch/powerpc/Makefile | 4 +++-
20 1 file changed, 3 insertions(+), 1 deletion(-)
21
22diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
23index 5c8c06215dd4..e3dbea6d7ae0 100644
24--- a/arch/powerpc/Makefile
25+++ b/arch/powerpc/Makefile
26@@ -12,7 +12,7 @@
27 # Rewritten by Cort Dougan and Paul Mackerras
28 #
29
30-HAS_BIARCH	:= $(call cc-option-yn, -m32)
31+HAS_BIARCH	:= $(call cc-option-yn, -m32 -m64)
32
33 # Set default 32 bits cross compilers for vdso and boot wrapper
34 CROSS32_COMPILE ?=
35@@ -164,6 +164,7 @@ CFLAGS-$(CONFIG_PPC32)	+= $(call cc-option, $(MULTIPLEWORD))
36
37 CFLAGS-$(CONFIG_PPC32)	+= $(call cc-option,-mno-readonly-in-sdata)
38
39+ifdef CONFIG_PPC64
40 ifdef CONFIG_PPC_BOOK3S_64
41 ifdef CONFIG_CPU_LITTLE_ENDIAN
42 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
43@@ -175,6 +176,7 @@ endif
44 else
45 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
46 endif
47+endif
48
49 ifdef CONFIG_FUNCTION_TRACER
50 CC_FLAGS_FTRACE := -pg
51--
522.17.1
53
54