[Top] [All Lists]

[PATCH 2/2] MIPS: Makefile: Pass -march option on Loongson3A cores

To: <>
Subject: [PATCH 2/2] MIPS: Makefile: Pass -march option on Loongson3A cores
From: Markos Chandras <>
Date: Mon, 2 Feb 2015 15:41:02 +0000
Cc: Markos Chandras <>, Huacai Chen <>, "Maciej W. Rozycki" <>, "Matthew Fortune" <>
In-reply-to: <>
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Original-recipient: rfc822;
References: <>
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 <>
Cc: Maciej W. Rozycki <>
Cc: Matthew Fortune <>
Signed-off-by: Markos Chandras <>
 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
 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!)
 cflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,)
 cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,)

<Prev in Thread] Current Thread [Next in Thread>