zlacker

Rust in the NetBSD Kernel, and other odd decisions

submitted by jaypat+(OP) on 2026-02-03 03:21:48 | 36 points 33 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
1. nextac+kw[view] [source] 2026-02-03 08:11:41
>>jaypat+(OP)
> In general, the bootstrap relies on a binary package of the previous version. This is unacceptable for an otherwise source-only, self-contained distribution like the NetBSD sources.

This does not paint the full picture. Rust can be bootstrapped with mrustc, which is written in C++

https://github.com/thepowersgang/mrustc

Now, mrustc supports only Rust 1.74. To build Rust 1.92, you need almost 20 builds. But this can be done from source

Guix has written about bootstrapping Rust from source (they care a lot about this). Here is how it looked like in 2018

https://guix.gnu.org/nb-NO/blog/2018/bootstrapping-rust/

◧◩
10. pjmlp+z21[view] [source] [discussion] 2026-02-03 12:16:57
>>akagus+bQ
It has a partial spec.

https://ferrous-systems.com/blog/ferrocene-25-11-0/

Lets not forget not having a formal spec apparently wasn't an issue for C, which only got standardized in 1989, and even K&R C only specified a subset of its behaviours, which is a reason why there is so much UB, and implementation specific behaviours with YOLO C, as the Fil-C author likes to call it.

◧◩◪◨⬒
12. anthk+Mc1[view] [source] [discussion] 2026-02-03 13:25:10
>>Borg3+R71
There are some Go backports to XP.

https://github.com/BieHDC/go-backports

◧◩◪◨⬒
27. LeFant+vb4[view] [source] [discussion] 2026-02-04 06:15:53
>>pornel+wl3
> the Rust for Linux project wants to use the newly prototyped features right away > they depend on not-yet-released features from unstable nightly versions of Rust

This is not true. Since kernel 6.11 they have specified a minimum version that is already stable. The strategy for the Rust kernel is to use the version of Rust that ships with Debian Stable. That is very far from using "the newly prototyped features right away".

https://rust-for-linux.com/rust-version-policy

Of course, the kernel continues to inform Rust evolution. But you do not need an unstable version of Rust to compile Linux.

28. LeFant+ad4[view] [source] 2026-02-04 06:30:48
>>jaypat+(OP)
> There are many architectures that NetBSD supports where Rust is not available

Are there many architectures that NetBSD supports where GCC is not available?

The rustc_codegen_gcc project allows using the rustc compiler to target any architecture that GCC supports. I think it is pretty far along.

https://github.com/rust-lang/rustc_codegen_gcc

> getting a Rust compiler running in the first place is hard

> bootstrap relies on a binary package

> the compiler would also have to be part of the base system

The gccrs project aims to make Rust a fully supported language in GCC. It is fully self-hosting and can be built from source. Once accepted, it will be one of the languages you get when you build GCC.

https://github.com/Rust-GCC/gccrs

When gccrs is ready, it will address all the above objections.

Linux faces the same issues. Today, Rust is optional in Linux and can be skipped on any platform not supported in LLVM and rustc. For Rust to become mandatory in Linux, gccrs is going to be required (for some platforms).

> the release cycles of Rust are not compatible with the NetBSD ones

I do not fully grasp the objection here. Obviously NetBSD would not be forced to use any Rust features they cannot compile. And using gccrs for the NetBSD kernel would not prevent them from bundling LLVM and rustc as well if they want.

Anyway, I am not advocating the use of Rust in NetBSD. I am merely pointing out that solutions to the issues raised are being worked on.

◧◩◪◨⬒
29. LeFant+Nd4[view] [source] [discussion] 2026-02-04 06:37:21
>>Borg3+R71
https://github.com/felixmaker/thunk
◧◩
31. LeFant+yk4[view] [source] [discussion] 2026-02-04 07:39:06
>>LeFant+ad4
I just noticed that rustc_codegen_gcc has been accepted into the mainline Rust compiler, or at least the nightly builds.

https://github.com/rust-lang/rust/pull/151156

This means that you will be able to use either GCC or LLVM to build your Rust code with rustc (the main Rust compiler). That means you can compile your Rust for any platform that GCC supports.

This only addresses the first point in the blog post (architecture support) but it is an interesting development.

[go to top]