|
|
Log in / Subscribe / Register

Gccrs after libcore

By Jonathan Corbet
October 9, 2025

Cauldron
Despite its increasing popularity, the Rust programming language is still supported by a single compiler, the LLVM-based rustc. At the 2025 GNU Tools Cauldron, Pierre-Emmanuel Patry said that a lot of people are waiting for a GCC-based Rust compiler before jumping into the language. Patry, who is working on just that compiler (known as "gccrs"), provided an update on the status of that project and what is coming next.

There are a few reasons to want a GCC-based Rust compiler, he began. Many developers are working with GCC now, prefer it, and do not want to have to change to a different toolchain. Having multiple compilers helps to build confidence in the future of a language in general. There is also the list of architectures that GCC supports, but which LLVM does not.

There is an intermediate option in the form of rustc_codegen_gcc, a project that grafts the GCC code-generation layer onto rustc. But, Patry said, few people seem willing to use rustc_codegen_gcc; he was unsure why. And, in any case, that project does not fully address the problem of architecture support in the Rust standard library, which must be ported separately to each new architecture. So developers are still waiting for gccrs, which is progressing.

Recent work

A longstanding problem with gccrs has been name resolution; that is a complicated task in Rust, and gccrs was not able to handle all of the possible cases. Now, though, name resolution has been rewritten from scratch and imaginatively named "name resolution 2.0". This work is complete and enabled by default in gccrs, though there are still some details to work out.

[Pierre-Emmanuel Patry] The project's development methodology has changed somewhat in the last year, he said. The project's approach is, essentially, "find a random problem, fix it, repeat". Recently, that approach has been focused on being able to build libcore, the Rust core library that is needed by all programs. That focus has been good, helping the project to identify the highest-priority issues, but it has also been slowing down progress recently. Fixing the building of libcore is essentially a serial process at this point; one problem must be dealt with before the next can be identified. So now, to increase parallelism, the gccrs developers are starting to spread their focus again.

The plan for gccrs has long been to implement support for version 1.49 of the Rust language, which was released in 2020. Among other reasons, that version was chosen because it was the last before the addition of const generics to the language. But it turns out that libcore needs a lot of newer, not-yet-stabilized Rust features; the 1.49 version of libcore uses, among other things, const generics. The Rust developers often put pre-stabilization features into the compiler and use them internally, and that has happened here. For this reason, gccrs has ended up including a number of newer language features, even though 1.49 remains the target.

Work has also progressed on impl trait (also covered here), which enables the specification of generic types that implement a given trait. "Argument position impl trait" allows the type of a function parameter to be inferred at the call site; the actual type of a parameter is not visible to the called function, only the expected trait. More recently, work has been done on "return position impl trait", where functions can return an abstract type implementing a given trait.

There were a couple of Google Summer of Code students working on the project this year. The first worked on rest patterns — patterns in match statements that match the remainder of a structure. Progress was made, but some patterns remain unimplemented. The second student worked on moving the lint mechanism away from GCC's GIMPLE internal representation, which was unable to support generics, to the gccrs high-level representation, which is able to carry much more information about the source program.

One year ago, he said, the project was concerned about performance; it took the compiler 30 seconds to compile about 1,000 lines of macro-heavy code. Performance has been a relatively low priority for this project, which is still focused on just getting something working, but there was still some time to look for easy problems to fix. It turns out that the type-checking code was doing a bit more copying of data than was strictly necessary; working through five lines of code could result in over 65,000 extra copies. This problem has been addressed, and the compiler is much faster now.

Next steps

One of the next things to be worked on, Patry said, is the Drop trait, which functions as an object destructor. This feature is coming along, but is missing the necessary glue to recursively drop nested structures. There is also a need to implement the code that ensures that all references to an object are truly gone before invoking the trait. Fn traits, used by closures, are partially implemented in gccrs now. Handling of dyn traits, which support dynamic dispatching, is almost complete as well.

People often ask "when will gccrs be ready?", he said. It will be ready in one sense — building libcore, though perhaps not compiling it entirely correctly — by early 2026. Once that is done, the focus will shift to being able to build Rust for Linux; that will involve adding a number of newer features, the availability of which will be hidden behind a command-line option. Patry stressed that the project will not, initially, try to implement every feature added between 1.49 and the 1.78 version required by the kernel; only features actually used by the kernel will go in.

After Rust for Linux, the plan is to build the entire 1.49 standard library. There still is no plan to increase the target version; the focus is still on getting things working. Most of the features needed by the standard library are also needed by libcore, so this phase should go relatively quickly.

Last year, the project added a dependency on rustc to compile the Rust code used by the compiler itself. Many people dislike this dependency and would like to see it go away. Once the standard-library support is complete, though, the compiler should be able to bootstrap itself, allowing the eventual removal of the rustc dependency.

The step after that is to move toward version 1.80 (or later) of the language. There aren't that many language changes after 1.49 that should pose problems, he said. But support for features like trait upcasting and use<...> will take some work.

For some time, the gccrs project has had the goal of pushing its work upstream into the GCC trunk every two weeks. Instead, code has been pushed upstream only three times (so far) in 2025. The process has improved and things will get better, he said, but he can't guarantee a two-week cycle anytime soon. Equally problematic has been keeping up with upstream GCC, which was a painful and manual process. That work has mostly been automated and is happening regularly now.

Patch review is a problem, though. Upstream GCC developers are generally unable to review Rust-specific patches, especially when they are sent in batches of 200 or so a few times a year. These batches need to be split into smaller, more frequent posts, but this work, he said, is not something the project wants to force its contributors to do. Gccrs, it seems, has a number of "very young" contributors who are not really able to work well with an email-based workflow; without care, those contributors will be lost.

The GCC project in general has been experimenting with Forgejo, using a bot to email patches upstream in response to pull requests. Gccrs has been playing with a similar scheme out of its GitHub repository; contributors can work entirely within GitHub and not have to interact with the mailing lists to submit patches. I asked what happens when people on the mailing lists have comments about the posted patches; at that point, it seems, the contributor will still have to deal with email.

The gccrs developers think that the Forgejo experiment is a good one that will widen the access to the project for contributors. It brings together a lot of resources onto a single page and matches what developers are using more widely; it is also free software, unlike GitHub, which is "proprietary and awful". But, he said, that experiment is still exactly that: an experiment that could be removed at any time. Moving the gccrs project from GitHub would likely lose some contributors, and would leave behind a lot of metadata that lives within the GitHub system. It would also complicate the task of maintaining cross-references with the Rust repositories. Beyond that, he said, GitHub functions as a sort of social network; leaving it would reduce the gccrs project's visibility.

Thus, he said, gccrs is not considering making a switch in the short or medium term, even though gccrs developers are enthusiastic about the experiment.

Patry concluded there. I asked how many developers are working on the project now; he answered that there are two engineers working on it full time, and roughly ten in a sort of core team who contribute regularly.

All told, gccrs seems to be making better progress than might have been expected a year or two ago. It was a bit discouraging, though, to see this talk placed at the end of the conference and sparsely attended; one gets the sense that interest from the wider GCC community in Rust is not all that high. Given the role that proper Rust support could play in keeping GCC relevant in the coming years, one might expect to see that community show a bit more interest.

[Thanks to the Linux Foundation, LWN's travel sponsor, for supporting my travel to this event.]

Index entries for this article
ConferenceGNU Tools Cauldron/2025


to post comments

rustc_codegen_gcc

Posted Oct 9, 2025 17:21 UTC (Thu) by josh (subscriber, #17465) [Link] (5 responses)

> But, Patry said, few people seem willing to use rustc_codegen_gcc; he was unsure why.

One reason, and one reason only: because we haven't made it installable via rustup yet, so it requires extensive manual setup to use.

We're working on fixing that, so you can install it via rustup, and that can then lead eventually to *automatically* installing it when you install a target that needs it.

rustc_codegen_gcc

Posted Oct 9, 2025 19:42 UTC (Thu) by SLi (subscriber, #53131) [Link] (2 responses)

What would using it give that people don't get by default? More target architectures?

rustc_codegen_gcc

Posted Oct 9, 2025 19:57 UTC (Thu) by josh (subscriber, #17465) [Link] (1 responses)

More target architectures, cross-language LTO if you're compiling your C code with GCC, a competing backend that might generate faster or smaller code for some use cases.

rustc_codegen_gcc

Posted Oct 10, 2025 20:08 UTC (Fri) by koverstreet (✭ supporter ✭, #4296) [Link]

How has codegen been looking, have there been comparisons yet?

rustc_codegen_gcc

Posted Oct 14, 2025 19:14 UTC (Tue) by rywang014 (subscriber, #167182) [Link] (1 responses)

Could you share what's the technical difficulty behind rustc_codegen_gcc being not easily installable via rustup?

rustc_codegen_gcc

Posted Oct 14, 2025 20:00 UTC (Tue) by josh (subscriber, #17465) [Link]

My understanding is that it is a large number of smaller things. You can keep up with the progress on https://blog.antoyo.xyz/ , where the lead developer posts regular status updates, including work towards testing the backend in Rust CI and work towards distributing it. There's also a dedicated Zulip channel where all that work gets coordinated.

Forgejo vs GitHub vs gitlab

Posted Oct 9, 2025 19:44 UTC (Thu) by SLi (subscriber, #53131) [Link] (9 responses)

> The gccrs developers think that the Forgejo experiment is a good one that will widen the access to the project for contributors. It brings together a lot of resources onto a single page and matches what developers are using more widely; it is also free software, unlike GitHub, which is ""proprietary and awful"".

How does forgejo compare to e.g. gitlab?

I've interacted with some projects hosted on gitlab. I can see some ways in which GitHub is less than ideal even besides it being proprietary. But I find it really awful to not have a code search, which apparntly gitlab does not have.

Forgejo vs GitHub vs gitlab

Posted Oct 9, 2025 19:57 UTC (Thu) by jzb (editor, #7867) [Link]

If you want to get a feel for Forgejo, you could peruse some of the projects on Codeberg, which uses Forgejo under the hood.

Looking at, say, the Shepherd repository, it seems that Forgejo/Codeberg do have code search. Whether it compares well with GitHub I can't say for sure, I haven't used it extensively...

Forgejo vs GitHub vs gitlab

Posted Oct 9, 2025 22:48 UTC (Thu) by ebassi (subscriber, #54855) [Link] (4 responses)

> [code search] which apparntly gitlab does not have

Gitlab has code search, but you need to set up a whole elasticsearch cluster for it; not every project self-hosting Gitlab wants to do that.

Forgejo vs GitHub vs gitlab

Posted Oct 10, 2025 18:54 UTC (Fri) by SLi (subscriber, #53131) [Link] (3 responses)

Interesting. Perhaps then it's just the freedesktop gitlab instance where they haven't set up code search? Or (wouldn't be the first time) I just haven't figured out how to use gitlab—at times I find it quite unintuitive.

Looking at e.g. https://gitlab.freedesktop.org/wlroots/wlroots/ , I see only a "search by filename" (even when signed in, if that makes a difference), which is... not what I mean by code search.

Forgejo vs GitHub vs gitlab

Posted Oct 11, 2025 11:48 UTC (Sat) by ebassi (subscriber, #54855) [Link] (2 responses)

> Perhaps then it's just the freedesktop gitlab instance where they haven't set up code search?

GNOME, too, has not set up a search cluster. Again: it's not something people self-hosting GitLab necessarily want to spend time babysitting in their infrastructure.

Forgejo vs GitHub vs gitlab

Posted Oct 11, 2025 12:43 UTC (Sat) by SLi (subscriber, #53131) [Link] (1 responses)

I can see that. It's just that as far as git web UIs go, I'm baffled because to me this is *the* central feature of a git web UI. I could imagine migrating a project from GitHub to a gitlab instance without search for ideological reasons, but I couldn't pretend it's it's not la downgrade like going from git to CVS.

Probably this is exacerbated by how I work on systems, not any single repository. A really common use case for me is to search a repository for a specific error message or function name. Having a project hosted on a searchless instance basically forces me to either rely on unofficial GitHub copies or to check out the repository locally, which is just a major hassle if the only thing you want is to understand the immediate condition that triggers some error message.

Forgejo vs GitHub vs gitlab

Posted Oct 12, 2025 1:17 UTC (Sun) by lanodan (subscriber, #169017) [Link]

When a local grep doesn't works I've been using https://codesearch.debian.net/ quite few times even though I barely use Debian myself.
And one of the things I really love about it is the ability to use a regex.

Forgejo vs GitHub vs gitlab

Posted Oct 10, 2025 2:27 UTC (Fri) by mathstuf (subscriber, #69389) [Link]

I've used Github a bunch. We use our own GitLab instance at $DAYJOB (I help maintain the CI configurations and machines backing it). I've also been contributing on Codeberg projects lately.

Forgejo feels like Github in terminology, UI, and such. GitLab definitely has its own separate feel from either. I don't like that Forgejo continued Github's conflation of the issue and PR ID domains[1]. GitLab's review workflow is far better than Github (discussions, resolutions, etc.), so it is unfortunate that Forgejo copied Github instead.

However, GitLab is a monster. We have a "wait 60 seconds for things to settle" in an end-to-end test script just because it can take that long for the services behind the scenes to actually be ready. Forgejo is a Golang binary and is said to be ready in seconds. GitLab is also open core and the company does seem quite…distracted by shinies compared to useful feature considerations. They've accepted my patches (and we need very few these days). Take that as you will.

[1] One can migrate to GitLab while preserving issue/PR IDs, but cannot go the other way as !1 != #1 on GitLab which cannot be represented on the other forges.

Forgejo vs GitHub vs gitlab

Posted Oct 10, 2025 9:19 UTC (Fri) by vasvir (subscriber, #92389) [Link]

I am using gitea. forgejo is a fork of gitea. So I am expecting similar issues and performance.

gitea feels snappy and has a code search.

I think is relatively safe to extrapolate the above statement to forgejo.

Forgejo vs GitHub vs gitlab

Posted Oct 16, 2025 15:26 UTC (Thu) by tbodt (subscriber, #120821) [Link]

Forgejo is written in Go, GitLab in Ruby. You can feel the difference in page navigation speed.

Video

Posted Oct 10, 2025 16:14 UTC (Fri) by corbet (editor, #1) [Link]

The video of this talk is now available on YouTube.

Age before beauty

Posted Oct 12, 2025 7:45 UTC (Sun) by marcH (subscriber, #57642) [Link]

> Gccrs, it seems, has a number of "very young" contributors who are not really able to work well with an email-based workflow; without care, those contributors will be lost.

... whereas ... anyone old enough knows better?

:-D

cargo and rustc dependency

Posted Oct 16, 2025 10:42 UTC (Thu) by glaubitz (subscriber, #96452) [Link]

> Last year, the project added a dependency on rustc to compile the Rust code used by the compiler itself. Many people dislike this dependency and would like to see it go away. Once the standard-library support is complete, though, the compiler should be able to bootstrap itself, allowing the eventual removal of the rustc dependency.

From what I remember, it was not a dependency on rustc that was introduced but on cargo but my information can be wrong or outdated.

Could someone clarify to me what dependencies on the Rust toolchain currently exists and what the longterm perspective is?

I'm particularly interested to learn whether it will be possible to bootstrap gccrs on an architecture which is not supported by LLVM and hence rustc such as PA-RISA (hppa) or SuperH (sh4).

PS: Please no discussions about the point on supporting old or obscure architectures.

Sources of platform support differences

Posted Oct 17, 2025 10:23 UTC (Fri) by moltonel (subscriber, #45207) [Link]

> [rustc_codegen_gcc] does not fully address the problem of architecture support in the Rust standard library, which must be ported separately to each new architecture. So developers are still waiting for gccrs, which is progressing.

Slight misunderstanding here ? Gccrs uses the same standard library as rustc, so that aspect of architecture support is the same on both compilers. If anything, rustc is likely to always have more up to date stdlib platform support.

I don't know if platform definition files are part of the stdlib, maybe that's one area where platform support will differ between the compilers ? I expect any difference here to be short-lived. Beyond that, it'll just be a question of bugs and QA ?


Copyright © 2025, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds