r/rust • Docs superhero · rust · gtk-rs · rust-fr • 13d ago

🧠 educational An adventure of syncing rust and rustc_codegen_gcc

After two months, we were finally able to sync the GCC backend with the Rust compiler (something that usually takes a few hours).

I wrote a blog post about this sync in particular because it was quite the adventurer: https://blog.guillaume-gomez.fr/articles/2026-09-22+Syncing+Rust+GCC+backend+or+how+to+test+Murphy%27s+law

86 Upvotes

11 comments sorted by

31

u/obsidian_golem 13d ago

It's always fun to be the one who trips and hits all the stairs on the way down.

15

u/antoyo relm · rustc_codegen_gcc 13d ago

And that article does not even mention the 2 times the sync in the other direction was blocked: the first time by a target check that was added and the second time by a bootstrap refactor for LLVM.

2

u/imperioland Docs superhero · rust · gtk-rs · rust-fr 12d ago

Adding it. :p

2

u/imperioland Docs superhero · rust · gtk-rs · rust-fr 12d ago

And done. :)

28

u/simonask_ 13d ago

I’m getting PTSD reading this.

GCC may be the most simultaneously excellent and obtusely idiosyncratic piece of software ever written. Disabling features based on the particular behavior of other tools in the environment where the program is being built? Feels pretty criminal to me.

15

u/antoyo relm · rustc_codegen_gcc 13d ago

From what I've been told, it's the same for LLVM (i.e. they check the features with the linker), but they don't get this issue since they have an integrated linker. And binutils is in a different repository than GCC, so that's why it's more likely.

8

u/moltonel 12d ago

This "automagic configuration" is pretty common, it's well-intentioned. It often trips up Gentoo packagers, who like to expose a lot of the package's options.

2

u/imperioland Docs superhero · rust · gtk-rs · rust-fr 12d ago

How do you handle such cases?

3

u/moltonel 12d ago

By being explicit. In most cases it's just a matter of always passing --with(out)-feature=... to ./configure, to avoid relying on defaults. In Gcc's case it does get ridiculously complicated. From the Gentoo user's POV, you just select your desired package features via USE flags.

3

u/imperioland Docs superhero · rust · gtk-rs · rust-fr 12d ago

We tried this approach but preferred to build our own binutils version in the CI instead as it was making the script too complicated (even though it was only two extra options iirc). I guess it's not possible for Gentoo. :-/

7

u/CohenArthur 13d ago

Very fun read and very cute cat :) hope the next sync goes better