diff mbox series

MIPS: Disable Loongson MMI instructions for kernel build

Message ID 20191010185324.2407578-1-paul.burton@mips.com (mailing list archive)
State Mainlined
Commit 2f2b4fd674cadd8c6b40eb629e140a14db4068fd
Delegated to: Paul Burton
Headers show
Series MIPS: Disable Loongson MMI instructions for kernel build | expand

Commit Message

Paul Burton Oct. 10, 2019, 6:54 p.m. UTC
GCC 9.x automatically enables support for Loongson MMI instructions when
using some -march= flags, and then errors out when -msoft-float is
specified with:

  cc1: error: ‘-mloongson-mmi’ must be used with ‘-mhard-float’

The kernel shouldn't be using these MMI instructions anyway, just as it
doesn't use floating point instructions. Explicitly disable them in
order to fix the build with GCC 9.x.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: 3702bba5eb4f ("MIPS: Loongson: Add GCC 4.4 support for Loongson2E")
Fixes: 6f7a251a259e ("MIPS: Loongson: Add basic Loongson 2F support")
Fixes: 5188129b8c9f ("MIPS: Loongson-3: Improve -march option and move it to Platform")
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: stable@vger.kernel.org # v2.6.32+
---

 arch/mips/loongson64/Platform | 4 ++++
 arch/mips/vdso/Makefile       | 1 +
 2 files changed, 5 insertions(+)

Comments

Paul Burton Oct. 10, 2019, 9:04 p.m. UTC | #1
Hello,

Paul Burton wrote:
> GCC 9.x automatically enables support for Loongson MMI instructions when
> using some -march= flags, and then errors out when -msoft-float is
> specified with:
> 
>   cc1: error: ‘-mloongson-mmi’ must be used with ‘-mhard-float’
> 
> The kernel shouldn't be using these MMI instructions anyway, just as it
> doesn't use floating point instructions. Explicitly disable them in
> order to fix the build with GCC 9.x.

Applied to mips-fixes.

> commit 2f2b4fd674ca
> https://git.kernel.org/mips/c/2f2b4fd674ca
> 
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Fixes: 3702bba5eb4f ("MIPS: Loongson: Add GCC 4.4 support for Loongson2E")
> Fixes: 6f7a251a259e ("MIPS: Loongson: Add basic Loongson 2F support")
> Fixes: 5188129b8c9f ("MIPS: Loongson-3: Improve -march option and move it to Platform")

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paul.burton@mips.com to report it. ]
diff mbox series

Patch

diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
index 28172500f95a..2855daf92fe8 100644
--- a/arch/mips/loongson64/Platform
+++ b/arch/mips/loongson64/Platform
@@ -66,6 +66,10 @@  else
       $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
 endif
 
+# Some -march= flags enable MMI instructions, and GCC complains about that
+# support being enabled alongside -msoft-float. Thus explicitly disable MMI.
+cflags-y += $(call cc-option,-mno-loongson-mmi)
+
 #
 # Loongson Machines' Support
 #
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index 807f0f782f75..996a934ece7d 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -15,6 +15,7 @@  ccflags-vdso := \
 	$(filter -mmicromips,$(KBUILD_CFLAGS)) \
 	$(filter -march=%,$(KBUILD_CFLAGS)) \
 	$(filter -m%-float,$(KBUILD_CFLAGS)) \
+	$(filter -mno-loongson-%,$(KBUILD_CFLAGS)) \
 	-D__VDSO__
 
 ifdef CONFIG_CC_IS_CLANG