LLVM is not happy with using o32 ABI on 64 bit CPU, thus build 32 bit kernel is unsupported. Detect this in Kconfig to prevent user select 32 bit kernel with unsupported toolchain. Link: https://github.com/ClangBuiltLinux/linux/issues/884 Reported-by: Nathan Chancellor <nathan@xxxxxxxxxx> Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> --- arch/mips/Kconfig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0cd9cd01b7ab..2374f859e001 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2016,6 +2016,7 @@ choice config 32BIT bool "32-bit kernel" depends on CPU_SUPPORTS_32BIT_KERNEL && SYS_SUPPORTS_32BIT_KERNEL + depends on CC_HAS_O32_ABI select TRAD_SIGNALS help Select this option if you want to build a 32-bit kernel. @@ -3137,7 +3138,7 @@ config COMPAT config MIPS32_O32 bool "Kernel support for o32 binaries" - depends on 64BIT + depends on 64BIT && CC_HAS_O32_ABI select ARCH_WANT_OLD_COMPAT_IPC select COMPAT select MIPS32_COMPAT @@ -3185,6 +3186,10 @@ config CC_HAS_DADDI_WORKAROUNDS config CC_HAS_BROKEN_INLINE_COMPAT_BRANCH def_bool y if CC_IS_CLANG +config CC_HAS_O32_ABI + def_bool y + depends on !CPU_SUPPORTS_64BIT_KERNEL || $(cc-option,-march=mips3 -mabi=32) + config AS_HAS_MSA def_bool $(cc-option,-Wa$(comma)-mmsa) -- 2.39.2 (Apple Git-143)