Re: [PATCH] MIPS: generic: Do not select CPUs that are unsupported in clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> 2023年4月6日 21:09,Nathan Chancellor <nathan@xxxxxxxxxx> 写道:
> 
> When building allnoconfig with clang after commit de34007751aa ("MIPS:
> generic: Enable all CPUs supported by virt board in Kconfig"), the
> following error occurs:
> 
>  error: unknown target CPU 'r4600'
>  note: valid target CPU values are: mips1, mips2, mips3, mips4, mips5, mips32, mips32r2, mips32r3, mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5, mips64r6, octeon, octeon+, p5600
> 
> Working around that, there are similar errors for 'loongson2e' and
> 'loongson2f'.
> 
> These CPUs are not supported in clang/LLVM, so do not select support for
> them in MIPS_GENERIC_KERNEL when building with clang.
> 
> Fixes: de34007751aa ("MIPS: generic: Enable all CPUs supported by virt board in Kconfig")
> Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>

Thanks for the patch.

Actually there is no need for any special support for those CPUs.
We should be able to build those kernels with -march=mips3.

I think something like:

--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -150,7 +150,7 @@ cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
 #
 cflags-$(CONFIG_CPU_R3000)     += -march=r3000
 cflags-$(CONFIG_CPU_R4300)     += -march=r4300 -Wa,--trap
-cflags-$(CONFIG_CPU_R4X00)     += -march=r4600 -Wa,--trap
+cflags-$(CONFIG_CPU_R4X00)     += $(call cc-option,-march=r4600,-march=mips3) -Wa,--trap
 cflags-$(CONFIG_CPU_TX49XX)    += -march=r4600 -Wa,--trap
 cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
 cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap
@@ -181,8 +181,8 @@ endif
 cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1
 cflags-$(CONFIG_CPU_BMIPS)     += -march=mips32 -Wa,-mips32 -Wa,--trap
 
-cflags-$(CONFIG_CPU_LOONGSON2E) += -march=loongson2e -Wa,--trap
-cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f -Wa,--trap
+cflags-$(CONFIG_CPU_LOONGSON2E) += $(call cc-option,-march=loongson2e,-march=mips3) -Wa,--trap
+cflags-$(CONFIG_CPU_LOONGSON2F) += $(call cc-option,-march=loongson2f,-march=mips3) -Wa,--trap
 # Some -march= flags enable MMI instructions, and GCC complains about that
 # support being enabled alongside -msoft-float. Thus explicitly disable MMI.
 cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-mno-loongson-mmi)

Will make them build.

Thanks
- Jiaxun



[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux