stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: Disable Loongson MMI instructions for kernel build
@ 2019-10-10 18:54 Paul Burton
  2019-10-10 21:04 ` Paul Burton
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Burton @ 2019-10-10 18:54 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Burton, Huacai Chen, Jiaxun Yang, stable

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(+)

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
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: Disable Loongson MMI instructions for kernel build
  2019-10-10 18:54 [PATCH] MIPS: Disable Loongson MMI instructions for kernel build Paul Burton
@ 2019-10-10 21:04 ` Paul Burton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Burton @ 2019-10-10 21:04 UTC (permalink / raw)
  To: Paul Burton
  Cc: linux-mips, Paul Burton, Huacai Chen, Jiaxun Yang, stable, linux-mips

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. ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-10 21:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 18:54 [PATCH] MIPS: Disable Loongson MMI instructions for kernel build Paul Burton
2019-10-10 21:04 ` Paul Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).