Miguel Ojeda, lead developer of Rust for Linux, announced several new features for kernel 6.14 in an email to Linus Torvalds. He calls the introduction of the macro for smart pointers with Rust 1.84: derive(CoercePointee) “an important milestone on the way to building a kernel that uses only static Rust functions.”
Advertisement
with this macro Kernel functions take advantage of Rust libraries like Arch in a static way that were previously only accessible insecurely. Ojeda cites as an example in email,
fn f(p: &Arc) {
pr_info!("{p}\n");
}
let a: Arc = Arc::new(42i32, GFP_KERNEL)?;
let b: Arc = Arc::new("hello there", GFP_KERNEL)?;
f(&a); // Prints "42".
f(&b); // Prints "hello there".
He lists the change to user-defined integer types in the foreign function interface (FFI) and the assignment of types as further innovations. long
To isize
And char
To u8
,
Looking at Android, the Rust team has environment variables PROCMACROLDFLAGS
Introduced which allows Rust Pro macros to use flags other than those specified when linking the host program. And for kernel builds on macOS, the team has adjusted naming conventions for dynamic libraries (for example so
instead of dylib
,
Further updates specifically affect modules of the kernel crate, for example receives types
An improved version of ForeignOwnable::borrow_mut
And alloc
implemented Display
For Box
And aligns the debug implementation accordingly.
read this also
(Who)