* [PATCH v2 1/2] MIPS: Allow R6 compact branch policy to be left unspecified
@ 2016-05-17 14:55 Paul Burton
2016-05-17 14:55 ` [PATCH v2 2/2] MIPS: Error out if unsupported compact branch policy is set Paul Burton
0 siblings, 1 reply; 2+ messages in thread
From: Paul Burton @ 2016-05-17 14:55 UTC (permalink / raw)
To: linux-mips, Ralf Baechle
Cc: Maciej W . Rozycki, Paul Burton, stable # v4 . 4+, linux-kernel
It turns out that some toolchains which support MIPS R6 don't support
the -mcompact-branches flag to specify compact branch behaviour. Default
to not providing the -mcompact-branch option to the compiler such that
we can build with such toolchains.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: c1a0e9bc885d ("MIPS: Allow compact branch policy to be changed")
Cc: stable <stable@vger.kernel.org> # v4.4+
---
Changes in v2:
- Hide the options behind CONFIG_DEBUG_KERNEL.
arch/mips/Kconfig.debug | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index f0e314c..ee3dc9b 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -117,7 +117,16 @@ if CPU_MIPSR6
choice
prompt "Compact branch policy"
- default MIPS_COMPACT_BRANCHES_OPTIMAL
+ depends on DEBUG_KERNEL
+ default MIPS_COMPACT_BRANCHES_DEFAULT
+
+config MIPS_COMPACT_BRANCHES_DEFAULT
+ bool "Toolchain Default (don't specify)"
+ help
+ Don't pass the -mcompact-branches flag to the compiler, allowing it
+ to use its default (generally "optimal"). This is particularly
+ useful for early R6-supporting toolchains which don't support the
+ -mcompact-branches flag.
config MIPS_COMPACT_BRANCHES_NEVER
bool "Never (force delay slot branches)"
--
2.8.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2 2/2] MIPS: Error out if unsupported compact branch policy is set
2016-05-17 14:55 [PATCH v2 1/2] MIPS: Allow R6 compact branch policy to be left unspecified Paul Burton
@ 2016-05-17 14:55 ` Paul Burton
0 siblings, 0 replies; 2+ messages in thread
From: Paul Burton @ 2016-05-17 14:55 UTC (permalink / raw)
To: linux-mips, Ralf Baechle
Cc: Maciej W . Rozycki, Paul Burton, stable # v4 . 4+, linux-kernel
If an explicit compact branch policy is requested by the user via the
debug options in Kconfig, and the toolchain does not support specifying
an explicit compact branch policy, then error out with an understandable
error message to make it clearer what's happened.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Fixes: c1a0e9bc885d ("MIPS: Allow compact branch policy to be changed")
Cc: stable <stable@vger.kernel.org> # v4.4+
---
Changes in v2:
- New patch.
arch/mips/Makefile | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index e78d60d..1ac4612 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -194,9 +194,13 @@ toolchain-msa := $(call cc-option-yn,$(mips-cflags) -mhard-float -mfp64 -Wa$(
cflags-$(toolchain-msa) += -DTOOLCHAIN_SUPPORTS_MSA
endif
-cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_NEVER) += -mcompact-branches=never
-cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_OPTIMAL) += -mcompact-branches=optimal
-cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_ALWAYS) += -mcompact-branches=always
+ifeq ($(call cc-option-yn,-mcompact-branches=optimal), y)
+ cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_NEVER) += -mcompact-branches=never
+ cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_OPTIMAL) += -mcompact-branches=optimal
+ cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_ALWAYS) += -mcompact-branches=always
+else ifneq ($(CONFIG_MIPS_COMPACT_BRANCHES_DEFAULT),y)
+ $(error Compact branch policy specified, but lacking toolchain support)
+endif
#
# Firmware support
--
2.8.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-17 14:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-17 14:55 [PATCH v2 1/2] MIPS: Allow R6 compact branch policy to be left unspecified Paul Burton
2016-05-17 14:55 ` [PATCH v2 2/2] MIPS: Error out if unsupported compact branch policy is set Paul Burton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®