Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Rust for Linux Progresses with New Abstractions and Infrastructure

Rust for Linux Progresses with New Abstractions and Infrastructure

This item in japanese

A new patch for Linux advances support for Rust as a second language for kernel development. Besides updating the infrastructure and providing new abstractions around kernel features, the new patch sets the base for more frequent submissions, writes Rust for Linux project lead Miguel Ojeda.

The new patch comes a few months after the initial contribution setting the stage for using Rust for drivers and modules and taking advantage of its superior memory safety model.

With the new submission, Rust for Linux moved to using the latest stable release of the Rust compiler, version 1.57.0. The objective here is not relying eventually on any unstable language features and being able to declare a minimum Rust version required for kernel development. The new infrastructure also includes a number of new diagnostics and clippy lints to ensure stricter checks.

We may need to disable some of them in the future if they prove too noisy or disruptive, but we think this is the best time to try them out. For instance, one of them checks that no unreachable public items are present.

The new patch additionally brings several new abstractions for sequence locks, power management callbacks, I/O memory (readX/writeX), and other low-level features.

According to Ojeda, the project is still at an experimental stage, but developers can already start working on new abstractions around kernel subsystems as well as write drivers and modules. Indeed, the patch includes a new driver for PL061 GPIO devices.

Another front of development of the Rust for Linux project is advancing Rust support in GCC. Currently, the rustc_codgen_gcc-based GCC backend for the Rust compiler has been merged into Rust upstream, which means rustc_codgen_gcc could replace rustc_codegen_llvm in the next future. The importance of using GCC lies with its broader range of supported architecture in comparison to LLVM.

While rustc_codegen_gcc provides a way for the Rust compiler frontend to use GCC just-in-time compilation and thus leverage both GCC architectures and optimizations, this is not the end of the Rust-GCC story. In fact, work is ongoing to bring Rust to GCC, but this will still require and estimated 1-2 years before becoming available.

Rate this Article