[PATCH 0/3] rust: arch/um: Rust support for UML
From: David Gow
Date: Fri Dec 16 2022 - 23:44:54 EST
This series adds support for building and running code in the Rust
programming language under x86_64 UML kernels.
It is based on two Pull Requests from the Rust-for-Linux GitHub page:
- https://github.com/Rust-for-Linux/linux/pull/766
- https://github.com/Rust-for-Linux/linux/pull/881
The series consists of three patches: the first two set up various
compiler options to match both the UML and the X86 CFLAGS.
Rust support can be enabled by setting CONFIG_RUST=y, when the suitable
Rust compiler and bindgen versions are available (run make rustavaiable
to check). LLVM=1 is also required at present with all Rust builds.
The whole thing can be built and tested with kunit.py:
./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_RUST=y --make_options LLVM=1
(Note that there are no Rust-based KUnit tests upstream yet. The "rust"
branch of the Rust-for-Linux GitHub repository does use KUnit for its
"doctests", and all of those tests pass under UML with these patches.)
This series is currently based on the uml/next branch: I'm happy to
rebase it next year once we're past the 6.2 merge window (though it
applies cleanly to torvalds/master at the moment). Equally, it
should be possible to take these changes in via the rust tree instead,
but since it's mostly UML Makefile changes, it probably makes more sense
for it to go in via the uml tree.
Also note that this series marks UML as a "maintained" architecture for
Rust support. It's definitely my intention to keep this working, but if
anyone has serious concerns, we can downgrade that.
Cheers,
-- David
David Gow (3):
rust: arch/um: Use 'pie' relocation mode under UML
rust: arch/um: Disable FP/SIMD instruction to match x86
rust: arch/um: Add support for CONFIG_RUST under x86_64 UML
Documentation/rust/arch-support.rst | 2 ++
arch/um/Kconfig | 1 +
arch/um/Makefile | 2 ++
arch/x86/Makefile.um | 6 ++++++
4 files changed, 11 insertions(+)
--
2.39.0.314.g84b9a713c41-goog