[PATCH v2 1/2] sh: guard SH4 no-FPU compiler fallback
From: Artem Novak
Date: Fri Oct 02 2026 - 00:12:53 EST
The SH4 compiler flag selection falls back to -m4-nofpu when
-mno-implicit-fp is unavailable without checking whether the compiler
supports -m4-nofpu itself.
This breaks SH4A-only toolchains which support -m4a and -m4a-nofpu
but do not provide the plain SH4 -m4-nofpu option.
Use a nested cc-option so the fallback is emitted only when supported.
Signed-off-by: Artem Novak <artem122novak@xxxxxxxxx>
---
arch/sh/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 7b420424b6d7..238c701ab14b 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -36,7 +36,7 @@ cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \
$(call cc-option,-m4-nofpu,)
cflags-$(CONFIG_CPU_SH3) := $(call cc-option,-m3,)
cflags-$(CONFIG_CPU_SH4) := $(call cc-option,-m4,) \
- $(call cc-option,-mno-implicit-fp,-m4-nofpu)
+ $(call cc-option,-mno-implicit-fp,$(call cc-option,-m4-nofpu,))
cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a,) \
$(call cc-option,-m4a-nofpu,)
cflags-$(CONFIG_CPU_SH4AL_DSP) += $(call cc-option,-m4al,)
--
2.55.0