summary refs log tree commit diff
path: root/arch/x86/Makefile.um
diff options
context:
space:
mode:
authorDavid Gow <davidgow@google.com>2022-12-17 12:44:35 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-22 13:33:53 +0100
commit20ca409886ce68e3ad6f1fea02be0c8743e75abf (patch)
tree348c79418aedae3dfaaf3a9c33afe4a72b1477b4 /arch/x86/Makefile.um
parent1cffdf91ca2b83abf2031c2eed0135d05fb1120d (diff)
downloadlinux-20ca409886ce68e3ad6f1fea02be0c8743e75abf.tar.gz
rust: arch/um: Disable FP/SIMD instruction to match x86
[ Upstream commit 8849818679478933dd1d9718741f4daa3f4e8b86 ]

The kernel disables all SSE and similar FP/SIMD instructions on
x86-based architectures (partly because we shouldn't be using floats in
the kernel, and partly to avoid the need for stack alignment, see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383 )

UML does not do the same thing, which isn't in itself a problem, but
does add to the list of differences between UML and "normal" x86 builds.

In addition, there was a crash bug with LLVM < 15 / rustc < 1.65 when
building with SSE, so disabling it fixes rust builds with earlier
compiler versions, see:
https://github.com/Rust-for-Linux/linux/pull/881

Signed-off-by: David Gow <davidgow@google.com>
Reviewed-by: Sergio González Collado <sergio.collado@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/x86/Makefile.um')
-rw-r--r--arch/x86/Makefile.um6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index b3c1ae084180..d2e95d1d4db7 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -1,6 +1,12 @@
 # SPDX-License-Identifier: GPL-2.0
 core-y += arch/x86/crypto/
 
+#
+# Disable SSE and other FP/SIMD instructions to match normal x86
+#
+KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
+KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
+
 ifeq ($(CONFIG_X86_32),y)
 START := 0x8048000