[PATCH 2/2] MIPS: Explicitly check KBUILD_SYM32=n

From: WangYuli
Date: Tue Feb 11 2025 - 09:09:06 EST


During make module_install, the need_compiler variable becomes 0,
so Makefile.compiler isn't included.

This results in call cc-option-yn returning nothing.

Add a check for KBUILD_SYM32=n to avoid the
"CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32" error
when KBUILD_SYM32 is unset (meaning it's not 'y' or 'n').

Fixes: 805b2e1d427a ("kbuild: include Makefile.compiler only when compiler is needed")
Fixes: 18ca63a2e23c ("MIPS: Probe toolchain support of -msym32")
Reported-by: Maciej W. Rozycki <macro@xxxxxxxxxxx>
Closes: https://lore.kernel.org/all/alpine.DEB.2.21.2501030535080.49841@xxxxxxxxxxxxxxxxx/
Co-developed-by: Chen Linxuan <chenlinxuan@xxxxxxxxxxxxx>
Signed-off-by: Chen Linxuan <chenlinxuan@xxxxxxxxxxxxx>
Signed-off-by: WangYuli <wangyuli@xxxxxxxxxxxxx>
---
arch/mips/Makefile | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 962eb749ed23..2a0bf69c842b 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -304,8 +304,13 @@ ifdef CONFIG_64BIT
ifeq ($(KBUILD_SYM32), y)
cflags-y += -msym32 -DKBUILD_64BIT_SYM32
else
- ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)
- $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32)
+# During make module_install, the need_compiler variable
+# becomes 0, so Makefile.compiler isn't included.
+# This results in call cc-option-yn returning nothing.
+ ifeq ($(KBUILD_SYM32), n)
+ ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)
+ $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32)
+ endif
endif
endif
endif
--
2.47.2