1 From b04fd686298fdb90d617a9bb07d3c8dd3d0962f8 Mon Sep 17 00:00:00 2001
2 From: Andreas Larsson <andreas@gaisler.com>
3 Date: Thu, 5 Jan 2023 16:57:29 +0100
4 Subject: [PATCH 28/32] sparc32,leon: Make what -mcpu to be used configurable,
7 Signed-off-by: Andreas Larsson <andreas@gaisler.com>
9 arch/sparc/Kconfig | 32 ++++++++++++++++++++++++++++++++
10 arch/sparc/Makefile | 13 +++++++++----
11 2 files changed, 41 insertions(+), 4 deletions(-)
13 diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
14 index a9d618c6f6c1..8188cae9786f 100644
15 --- a/arch/sparc/Kconfig
16 +++ b/arch/sparc/Kconfig
17 @@ -395,6 +395,38 @@ config SPARC_LEON
18 toolchain at www.gaisler.com.
23 + prompt "LEON CPU architecture"
24 + default SPARC_LEON_MCPU_DEFAULT
26 + This chooses if and what architecture shall be used if any
27 + to build the kernel.
29 +config SPARC_LEON_MCPU_DEFAULT
32 + Build the kernel with no -mcpu option, getting the default
33 + for the toolchain that is being used.
35 +config SPARC_LEON_MCPU_LEON3
38 + Build the kernel with -mcpu=leon3.
40 +config SPARC_LEON_MCPU_LEON5
43 + Build the kernel with -mcpu=leon5.
47 +config SPARC_LEON_MCPU
49 + default "" if SPARC_LEON_MCPU_DEFAULT
50 + default "leon3" if SPARC_LEON_MCPU_LEON3
51 + default "leon5" if SPARC_LEON_MCPU_LEON5
53 config SPARC_LEON_FIX_UT700
54 bool "UT700 errata fixes"
55 select SPARC_LEON_FIX_TN0018
56 diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
57 index aa9d12c54e4b..63894edc86c6 100644
58 --- a/arch/sparc/Makefile
59 +++ b/arch/sparc/Makefile
60 @@ -26,19 +26,24 @@ export BITS := 32
63 ifeq ($(CONFIG_SPARC_LEON),y)
65 +leon_mcpu := $(strip $(shell echo $(CONFIG_SPARC_LEON_MCPU)))
70 +SPARC_MCPU=-mcpu=$(leon_mcpu)
76 # We are adding -Wa,-Av8 to KBUILD_CFLAGS to deal with a specs bug in some
77 # versions of gcc. Some gcc versions won't pass -Av8 to binutils when you
78 # give -mcpu=v8. This silently worked with older bintutils versions but
80 -KBUILD_CFLAGS += -m32 -mcpu=$(SPARC_MCPU) -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
81 +KBUILD_CFLAGS += -m32 $(SPARC_MCPU) -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
82 KBUILD_CFLAGS += -Wa,-Av8
84 -KBUILD_AFLAGS += -m32 -mcpu=$(SPARC_MCPU) -Wa,-Av8
85 +KBUILD_AFLAGS += -m32 $(SPARC_MCPU) -Wa,-Av8
87 ifeq ($(CONFIG_SPARC_LEON_FIX_UT700),y)
88 KBUILD_CFLAGS += -mfix-ut700 -fno-jump-tables