Re: [masahiroy:fixes 6/6] arch/mips/kernel/branch.c:712:20: error: instruction requires a CPU feature not currently enabled

From: Nick Desaulniers
Date: Sun Sep 11 2022 - 01:56:35 EST


On Sat, Sep 10, 2022 at 12:24 PM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git fixes
> head: 97f72ed7a6b5a6bbac628f1f6e91cf06d1ea2cb5
> commit: 97f72ed7a6b5a6bbac628f1f6e91cf06d1ea2cb5 [6/6] Makefile.compiler: Use KBUILD_AFLAGS for as-option
> config: mips-loongson2k_defconfig (https://download.01.org/0day-ci/archive/20220910/202209101939.bvk64Fok-lkp@xxxxxxxxx/config)

This is likely:
arch/mips/loongson2ef/Platform
28:cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call
as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
arch/mips/Makefile
155:cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)

probably both need to use cc-option similar to
https://lore.kernel.org/llvm/20220907045907.484043-2-ndesaulniers@xxxxxxxxxx/

Masahiro, I'm at Linux Plumbers Conf; not sure when I can get to a
formal patch. Want to drop my 2 patches and I'll send a v4 at some
point?

---
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 4d2a3e73fc45..6d27e302f6d1 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -152,7 +152,7 @@ cflags-y += -fno-stack-check
#
# Avoid this by explicitly disabling that assembler behaviour.
#
-cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
+cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)

#
# CPU-dependent compiler/assembler options for optimization.
diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
index eebabf9df6ac..c6f7a4b95997 100644
--- a/arch/mips/loongson2ef/Platform
+++ b/arch/mips/loongson2ef/Platform
@@ -25,7 +25,7 @@ cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f
# binutils does not merge support for the flag then we can revisit & remove
# this later - for now it ensures vendor toolchains don't cause problems.
#
-cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call
as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
+cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call
cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)

# Enable the workarounds for Loongson2f
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
--
Thanks,
~Nick Desaulniers