gccrs will be being integrated into GCC 13

gccrs

gccrs is a complete alternative implementation of the Rust language over GCC

It was recently revealed that the gccrs project, whose goal is to provide an interface for the Rust language to GCC (GNU Compiler Collection), is on its way to be integrated into GCC 13.  At the FOSDEM developer conference earlier this month, engineer Arthur Cohen gave a presentation on gccrs outlining the current state of the work.

For those who are unaware of the gccrs project, they should know that this is a complete alternative implementation of the Rust language on top of GCC with the goal of becoming fully the GNU toolchain.

The origin of this project is a community effort several years ago, when Rust was still at version 0.9; the language created by Mozilla was subject to so many changes that it became difficult for a community effort to catch up.

Now that the language is stable, it's time to create alternative compilers:

“Started in 2014 (and relaunched in 2019), the effort has been ongoing since 2020 and we've made a lot of effort and a lot of progress. We have uploaded the first version of gccrs inside GCC. So next time you install GCC 13, it will have gccrs inside.

You can use it and you can start hacking it, you can report the problems when it inevitably crashes and dies horribly. One big thing we are doing is working on making the rustc test suite work,” said Arthur Cohen during his presentation at the FOSDEM conference earlier this month.

The ability to successfully run the rustc compiler test suite also remains a goal. According to Cohen, Rust's GCC interface also points to older Rust libcore 1.49.

The gccrs project FAQ notes that all of the LLVM build technologies, which are used by Rust, "lack some GCC-compatible backends, so a gccrs implementation can fill in the gaps for use in embedded development«.

Note, however, that the Rust-GCC compiler (gccrs) is still in a very early stage and cannot yet be used to compile actual Rust programs.

The GCC team voted last July to approve the gccrs integration as a build suite. The importance of this project lies in its importance to the Linux kernel. In fact, the Linux kernel is usually built with GCC, but plans to allow the Rust language to be used alongside C for kernel code, for memory safety reasons, are steadily progressing.

The "Rust for Linux" project officially merged into the main Linux 6.1 Git tree last October, making Rust the second language dedicated to Linux development, after 31 years of exclusively C-based development.

“We want gccrs to be a true Rust compiler and not a toy project or something that compiles a language that looks like Rust but isn't Rust; we are really trying to make this test suite work,” he added. During the presentation, Cohen also said that while GCC 13's Rust interface is off to a good start, there is still a lot of work to be done. Borrowed verification code is conspicuously absent at the moment, support for built-in and intrinsic modules is still ongoing, and the important milestone of compiling Rust code for Linux has yet to be reached.

As a reminder, the project "Rust for Linux" aims to introduce a new system programming language into the Linux kernel. According to experts, the Rust language has a key property that makes it very interesting to consider as the second language of the Linux kernel: it ensures that no undefined behavior occurs (as long as the insecure code is sane).

This includes the absence of errors such as after-free use, double frees, data races, etc. Related debates revolve around the possibility of ditching C in favor of the Rust language. But Linus Torvalds, the creator of Linux, said that's not the stated goal of the Rust for Linux project.

Finally, It is worth mentioning that although the gccrs interface was merged for the next version of GCC 13, it is not yet in a state where most Rust developers can actually use it as an alternative to Rust's official LLVM compiler.

It shouldn't be until next year, at least with GCC 14 at least.

Source: https://fosdem.org/


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.