Re: [PATCH v10 25/27] x86: enable initial Rust support
From: Wei Liu <wei.liu@kernel.org>
Date: 2022-09-28 14:32:08
Also in:
linux-fsdevel, linux-patches, lkml, rust-for-linux
On Tue, Sep 27, 2022 at 03:14:56PM +0200, Miguel Ojeda wrote:
quoted hunk ↗ jump to hunk
Note that only x86_64 is covered and not all features nor mitigations are handled, but it is enough as a starting point and showcases the basics needed to add Rust support for a new architecture. Reviewed-by: Kees Cook <redacted> Co-developed-by: Alex Gaynor <redacted> Signed-off-by: Alex Gaynor <redacted> Co-developed-by: Wedson Almeida Filho <redacted> Signed-off-by: Wedson Almeida Filho <redacted> Co-developed-by: David Gow <redacted> Signed-off-by: David Gow <redacted> Signed-off-by: Miguel Ojeda <ojeda@kernel.org> --- Documentation/rust/arch-support.rst | 1 + arch/x86/Kconfig | 1 + arch/x86/Makefile | 10 ++++++++++ scripts/generate_rust_target.rs | 15 +++++++++++++-- 4 files changed, 25 insertions(+), 2 deletions(-)diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst index 1152e0fbdad0..6982b63775da 100644 --- a/Documentation/rust/arch-support.rst +++ b/Documentation/rust/arch-support.rst@@ -15,4 +15,5 @@ support corresponds to ``S`` values in the ``MAINTAINERS`` file. ============ ================ ============================================== Architecture Level of support Constraints ============ ================ ============================================== +``x86`` Maintained ``x86_64`` only. ============ ================ ==============================================diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f9920f1341c8..3ca198742b10 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig@@ -257,6 +257,7 @@ config X86 select HAVE_STATIC_CALL_INLINE if HAVE_OBJTOOL select HAVE_PREEMPT_DYNAMIC_CALL select HAVE_RSEQ + select HAVE_RUST if X86_64 select HAVE_SYSCALL_TRACEPOINTS select HAVE_UACCESS_VALIDATION if HAVE_OBJTOOL select HAVE_UNSTABLE_SCHED_CLOCKdiff --git a/arch/x86/Makefile b/arch/x86/Makefile index bafbd905e6e7..2d7e640674c6 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile@@ -68,6 +68,7 @@ export BITS # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383 # 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
I do wonder how many more things you will need to list here. As far as I can tell there is also other avx512* flags for the x86_64 target. That said, if this works today ... Reviewed-by: Wei Liu <wei.liu@kernel.org>