5 ms·
> The GCC backend for the Rust compiler (through `libgccjit`, although used for ahead-of-time compilation) was merged into upstream Rust: https://github.com
by vlovich123 5y ago
> The GCC backend for the Rust compiler (through `libgccjit`, although
used for ahead-of-time compilation) was merged into upstream Rust:
https://github.com/rust-lang/rustc_codegen_gcc https://github.com/rust-lang/rustc_codegen_gcc
If the backend keeps progressing, we hope to soon be able to start
experimenting with compiling the Rust side of the kernel with GCC!
This means that using it for the core parts may be feasible sooner rather than later, no? Developing those abstractions may not be a priority of course, but it might be allowable at least from a platform support perspective.
- kibwen 5y agoEven once Rust has first-class support for GCC as a backend, I suspect that supporting the long tail of more obscure platforms will be an ongoing process. And for exceptionally weird platforms (e.g. where a byte isn't 8 bits) Rust may never bother to contort itself enough to support those, although perhaps Linux also doesn't support such platforms?
- JoshTriplett 5y ago> Even once Rust has first-class support for GCC as a backend, I suspect that supporting the long tail of more obscure platforms will be an ongoing process. Linux's own support for the long tail of more obscure platforms is also an ongoing process. People aren't asking for Rust to do better than the Linux kernel in that regard, they're just asking for it to not immediately disqualify a range of platforms. One could reasonably argue about the value of supporting those platforms, but the Linux kernel, reasonably, doesn't want to make that decision on the sole basis of the availability of Rust support. > And for exceptionally weird platforms (e.g. where a byte isn't 8 bits) Rust may never bother to contort itself enough to support those, although perhaps Linux also doesn't support such platforms? Linux doesn't support such platforms, and I don't think Rust ever will either.
- account42 5y ago> Linux doesn't support such platforms, and I don't think Rust ever will either. Almost all software not written especially for such devices doesn't support non-8-platforms. Heck, POSIX mandates that char is 8 bits.
- xxpor 5y agoFWIW Linux does support s390 (n.b., not to be confused with s390x), which is a 31 bit arch. Rust does not support it (and I'd guess LLVM doesn't either). So Linux does support some "weird" arches still. This is partially what caused the shitstorm when the python Cryptography library took a hard dependency on rust to compile: https://github.com/pyca/cryptography/issues/5771 https://github.com/pyca/cryptography/issues/5771
- cesarb 5y agoAFAIK, s390 also has 8-bit bytes. The "31 bits" is the pointer size; IIRC, it's actually 32 bits, but with one bit reserved for compatibility with its even older predecessors.
- woodruffw 5y agoLinux has not had mainline support for s390 since Linux 4.1 (6 years ago). Only s390x is left. You can still run 31-bit s390 usermode binaries on an s390x kernel, but that's a different beast.
- xxpor 5y ago>You can still run 31-bit s390 usermode binaries on an s390x kernel Ah thanks, I didn't realize that was possible. I'm no where near rich and/or old enough to have ever encountered an s390 machine IRL :)
- lokedhs 5y agoYou can emulate it using Hercules. When searching I found plenty of guides showing how to set it up. I'm not linking to any in particular, because frankly I have never tried them so I don't know which one you should follow.
- dralley 5y agoLinux does not support running on s390, it only supports running s390 binaries in userspace. So using Rust in the kernel would be fine.
- quotemstr 5y ago> This means that using it for the core parts may be feasible sooner rather than later, no? More like much later. There are several performance-critical patterns used in the Linux kernel that are difficult to express in unsafe Rust and impossible to express in safe Rust. See https://paulmck.livejournal.com/62436.html https://paulmck.livejournal.com/62436.html and especially https://paulmck.livejournal.com/64209.html https://paulmck.livejournal.com/64209.html I think promoting the use of Rust for driver code is an excellent compromise. As an aside, I'd like to see Linux go further and move many of these drivers to user space. Now that we have io_uring, old performance-based arguments for keeping certain drivers in ring 0 hold less weight.
- noobermin 5y agoJust a guess, use of the gcc backend for rust will face hard opposition by the same people pushing for rust in the kernel specifically if it is chosen (as it should be) by the kernel as the default choice.