Live data from Hacker News

Supporting Linux kernel development in Rust

lwn.net

361–365 of 365 posts

Re: Supporting Linux kernel development in Rust

#361
post #356

Earlier quoted context omitted.

The WinRT ABI does implement some new features, yes - but they’re all still implementable with nothing more than standard C# code with no special support from WinRT itself (in fact, the WinRT ABI integration is being stripped out of the runtime and cswinrt is the way forward). C++/CLI ultimately still uses the same features the runtime uses for p/invoke calls, though it uses slightly different IL to transition to nat…

All of that doesn't change the fact that there is tooling in place, and language features (e.g. dynamic for COM, upcoming C#9 improved native FFI) to ease interoperability between managed and some level of C++. Something that no UNIX does, and we only find similar ideas in Swift/Objective-C++, IBM language environments, and the old OS/2 SOM (Smalltalk/C++). While everyone else just writes glue code with C like interf…

Purists may hate it, but as a toy project I’ve been working on making a stripped-down version of the WinRT concepts that runs on Linux (well, anything with a c++17 compiler and a dlopen function provided by a linker). The guy behind cppwinrt started work on the Xlang project in a similar vein, but it’s currently not being worked on so I figured I’d give it a shot.

I agree that C as the lowest common denominator sucks.

Re: Supporting Linux kernel development in Rust

#362
post #342

Earlier quoted context omitted.

If crates.io was down tomorrow there would be a major disruption to you if you were using Rust for development. That is their point, as well as potentially exploring other reasons. As someone who uses a source-based distro I hate language package managers. They always end up inferior to a distro package manager and create extra work for everyone, including the language developers, who tolerate it because it is in the…

It would only be an issue if I wanted to use crates that weren’t in my local cache already. And that’s gonna be true of any build system. It would also be true of any distro package manager.

Most other software is more dispersed and has plenty of mirrors, e.g. the Debian project. The same criticism of crates.io is typically levied against GitHub.

Re: Supporting Linux kernel development in Rust

#363

Earlier quoted context omitted.

Originally, we thought that Linux maintainers were asking us to only support kernels compiled with Clang, because they didn't want to support code built with two different compilers. However, in the session, Greg Kroah-Hartman specifically said that if it works to build Rust code with the LLVM-based rustc and C code with GCC and link the two together, and there aren't any problems in practice, then that's perfectly f…

> unless you want to use cross-language LTO (which we'll eventually want to do, but it won't be a hard requirement for a working kernel). Does Linux even work with LTO right now? It seems to do a lot of weird-linking-magic things that I wouldn't expect to work well with LTO.

ICYMI, Microsoft is putting a lot of eggs into the LTO/PGO basket to try to improve Linux performance: https://www.phoronix.com/scan.php?page=news_item&px=Microsof...

Re: Supporting Linux kernel development in Rust

#364
post #356

Earlier quoted context omitted.

All of that doesn't change the fact that there is tooling in place, and language features (e.g. dynamic for COM, upcoming C#9 improved native FFI) to ease interoperability between managed and some level of C++. Something that no UNIX does, and we only find similar ideas in Swift/Objective-C++, IBM language environments, and the old OS/2 SOM (Smalltalk/C++). While everyone else just writes glue code with C like interf…

Purists may hate it, but as a toy project I’ve been working on making a stripped-down version of the WinRT concepts that runs on Linux (well, anything with a c++17 compiler and a dlopen function provided by a linker). The guy behind cppwinrt started work on the Xlang project in a similar vein, but it’s currently not being worked on so I figured I’d give it a shot. I agree that C as the lowest common denominator sucks…

Good luck with it.

Project Reunion seems to have rebooted everything, which is most likely the reason for it to have stalled.

Re: Supporting Linux kernel development in Rust

#365
post #22

Earlier quoted context omitted.

There is no doubt a lot of work here, but C Rust interoperability is a lot cleaner than C++ Rust. And for what it's worth, for almost all langauges C X interoperability is a lot cleaner than C++ X. Since almost all languages (including rust) "speak C", both in terms of compiler support and and being able to map every important C concept to a concept in their language. The same isn't true with C++. One thing to worry…

> One thing to worry about with adding any language (including rust) to the kernel, is that the next good looking language will probably interoperate well with C and not interoperate well with Rust. So there is a much higher cost the second time you try to add a language. This is something that Rust is acutely aware of. There have been many discussions about the idea of a higher-level "safe ABI", such that languages…

Is there any work currently happening on this. I think this would be huge for many languages so we can finally graduate past the era of C ABI.
Post reply on HN