The loongson 3A cores do not select a suitable -march option so the build system uses the default one from the toolchain. This may or may not be suitable for a loongson 3A build. In order to avoid that, we explicitly set a suitable -march option for that core. Moreover, we add an extra check in the Makefile to break the build if no -march or -mips was found. This will eliminate similar problems when support for future cores is added. Cc: Huacai Chen <chenhc@xxxxxxxxxx> Cc: Maciej W. Rozycki <macro@xxxxxxxxxxxxxx> Cc: Matthew Fortune <Matthew.Fortune@xxxxxxxxxx> Signed-off-by: Markos Chandras <markos.chandras@xxxxxxxxxx> --- arch/mips/Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 61818364221d..3a45c7de67e1 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -164,6 +164,16 @@ cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -Wa,-march=octeon endif cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1 cflags-$(CONFIG_CPU_BMIPS) += -march=mips32 -Wa,-mips32 -Wa,--trap +cflags-$(CONFIG_CPU_LOONGSON3) += $(call cc-option,-march=loongson3a,-march=mips64r2) -Wa,--trap + +# +# At this point, every CPU must have set a good -march or -mips option. +# If it doesn't, we rely on the default one passed by the toolchain which +# may or may not be good enough for our build so better stop now! +# +ifeq (,$(filter -march=% -mips%, $(cflags-y))) +$(error Configuration bug, no -march= option set for the CPU selected!) +endif cflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,) cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,) -- 2.2.2