From: David Gow <davidgow@google.com>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Richard Weinberger" <richard@nod.at>,
"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
"Johannes Berg" <johannes@sipsolutions.net>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nick Desaulniers" <ndesaulniers@google.com>
Cc: David Gow <davidgow@google.com>,
rust-for-linux@vger.kernel.org, linux-um@lists.infradead.org,
llvm@lists.linux.dev, linux-doc@vger.kernel.org,
kunit-dev@googlegroups.com, x86@kernel.org,
linux-kernel@vger.kernel.org,
Wedson Almeida Filho <wedsonaf@gmail.com>,
Gary Guo <gary@garyguo.net>,
Brendan Higgins <brendan.higgins@linux.dev>,
Daniel Latypov <dlatypov@google.com>,
Jonathan Corbet <corbet@lwn.net>
Subject: [PATCH 2/3] rust: arch/um: Disable FP/SIMD instruction to match x86
Date: Sat, 17 Dec 2022 12:44:35 +0800 [thread overview]
Message-ID: <20221217044436.4138642-3-davidgow@google.com> (raw)
In-Reply-To: <20221217044436.4138642-1-davidgow@google.com>
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>
---
arch/x86/Makefile.um | 6 ++++++
1 file changed, 6 insertions(+)
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
--
2.39.0.314.g84b9a713c41-goog
next prev parent reply other threads:[~2022-12-17 4:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-17 4:44 [PATCH 0/3] rust: arch/um: Rust support for UML David Gow
2022-12-17 4:44 ` [PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML David Gow
2023-01-15 10:30 ` Thomas Meyer
2022-12-17 4:44 ` David Gow [this message]
2023-01-15 9:47 ` [PATCH 2/3] rust: arch/um: Disable FP/SIMD instruction to match x86 Sergio González Collado
2022-12-17 4:44 ` [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML David Gow
2023-01-15 9:49 ` Sergio González Collado
2023-01-15 9:51 ` Sergio González Collado
2023-01-15 21:42 ` Miguel Ojeda
2022-12-17 11:59 ` [PATCH 0/3] rust: arch/um: Rust support for UML Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221217044436.4138642-3-davidgow@google.com \
--to=davidgow@google.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=bjorn3_gh@protonmail.com \
--cc=brendan.higgins@linux.dev \
--cc=corbet@lwn.net \
--cc=dlatypov@google.com \
--cc=gary@garyguo.net \
--cc=johannes@sipsolutions.net \
--cc=kunit-dev@googlegroups.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=llvm@lists.linux.dev \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=ojeda@kernel.org \
--cc=richard@nod.at \
--cc=rust-for-linux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=wedsonaf@gmail.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).