rustc_codegen_gcc: Progress Report #29
What is rustc_codegen_gcc?
rustc_codegen_gcc is a GCC ahead-of-time codegen for rustc, meaning that it can be loaded by the existing rustc frontend, but benefits from GCC by having more architectures supported and having access to GCC’s optimizations. It is not to be confused with gccrs, which is a GCC frontend for Rust.
GCC patches status
This month, we prepared and sent the following patches to the mailing list:
-
[PATCH] libgccjit: Make is_int return false on vector types (merged)
-
[PATCH] libgccjit: Add missing builtins needed by optimizations (merged)
-
[PATCH] libgccjit: Allow sending a const pointer as argument
-
[PATCH] libgccjit: Add type checks in gcc_jit_block_add_assignment_op
-
[PATCH] libgccjit: Add support for setting the comment ident
As you can see, a few of those were already merged. We also got some reviews and addressed some of them already.
In addition, the following patch was merged:
-
[PATCH] Add support for function attributes and variable attributes (thanks to GuillaumeGomez!)
State of rustc_codegen_gcc
Here’s what has been done during the past month:
-
simd: implement missing intrinsics from simd/generic-arithmetic-pass.rs (thanks to sadlerap!)
-
Rustify test.sh (thanks to GuillaumeGomez!)
-
Rustify clean_all.sh (thanks to GuillaumeGomez!)
-
Remove unused rustup.sh script (thanks to GuillaumeGomez!)
-
If the rustc commit cannot be retrieve, just checkout the repository (thanks to GuillaumeGomez!)
-
Rustify cargo.sh (thanks to GuillaumeGomez!)
-
Fix typos (thanks to vuittont60!)
-
Switch from actions-rs to preinstalled rustup (thanks to tgross35!)
-
Honor
$RUSTUP_HOME
(thanks to NCGThompson!) -
Rename y.sh test --clean-ui-tests to y.sh clean ui-tests (thanks to rowan-sl)
Next month, I’ll continue to send patches to GCC and address the review of the patches that were already sent and hopefully merge most of them.
We’ll also continue towards our goal of distributing this project through rustup
, which should hopefully happens in a couple of months.
Here’s a rough summary of what has been implemented:
Feature | Last month completion | Completion | Delta |
---|---|---|---|
Unwinding. |
80% |
80% |
|
LTO. |
80% |
80% |
|
More function and variable attributes. |
20% |
20% |
|
Target features (to detect what is supported in an architecture, like SIMD). |
80% |
80% |
|
Thin LTO. |
0% |
||
Debug info. |
0% |
||
Rustup distribution. |
0% |
||
SIMD for other architectures than x86-64. |
0% |
||
Support for new architectures in libraries (libc, object, …) and rustc. |
0% |
||
Endianness support for non-native 128-bit integers. |
Done |
||
SIMD (x86-64). |
Done |
||
Basic and aggregate types. |
Done |
||
Operations, local and global variables, constants, functions, basic blocks. |
Done |
||
Atomics. |
Done |
||
Thread-local storage. |
Done |
||
Inline assembly. |
Done |
||
Many intrinsics. |
Done |
||
Metadata. |
Done |
||
Setting optimization level. |
Done |
||
Packed structures. |
Done |
||
Alignment, symbol visibility, attributes. |
Done |
||
128-bit integers. |
Done |
UI tests progress
Here are the results of running the UI tests in the CI:
-
https://github.com/rust-lang/rustc_codegen_gcc/actions/runs/7586008360/job/20663169889#step:12:4383
-
https://github.com/rust-lang/rustc_codegen_gcc/actions/runs/7586008360/job/20663169162#step:12:4378
-
https://github.com/rust-lang/rustc_codegen_gcc/actions/runs/7545599783#summary-20541597456 (failures)
Category | Last Month | This Month | Delta |
---|---|---|---|
Passed |
5586 |
5576 |
-10 |
Failed |
71 |
69 |
- 2 |
(I removed the LTO tests from the failed row because those tests pass in the CI job where LTO is enabled.)
How to contribute
rustc_codegen_gcc
If you want to help on the project itself, please do the following:
-
Run the tests locally.
-
Choose a test that fails.
-
Investigate why it fails.
-
Fix the problem.
Even if you can’t fix the problem, your investigation could help, so if you enjoy staring at assembly code, have fun!
Crates and rustc
If you would like to contribute on adding support for Rust on
currently unsupported platforms, you can help by adding the support
for those platforms in some crates like libc
and object
and also
in the rust compiler itself.
Test this project
Otherwise, you can test this project on new platforms and also compare the assembly with LLVM to see if some optimization is missing.
Good first issue
Finally, another good way to help is to look at good first issues. Those are issues that should be easier to start with.
Thanks for your support!
I wanted to personally thank all the people that sponsor this project: your support is very much appreciated.
A special thanks to the following sponsors:
-
Futurewei
-
saethlin
-
embark-studios
-
Shnatsel
-
Rust Foundation
A big thank you to bjorn3 for his help, contributions and reviews. And a big thank you to lqd and GuillaumeGomez for answering my questions about rustc’s internals. Another big thank you to Commeownist for his contributions.
Also, a big thank you to the rest of my sponsors:
-
kpp
-
0x7CFE
-
repi
-
oleid
-
acshi
-
joshtriplett
-
djc
-
sdroege
-
pcn
-
alanfalloon
-
davidlattimore
-
colelawrence
-
zmanian
-
alexkirsz
-
berkus
-
belzael
-
yvt
-
Shoeboxam
-
yerke
-
bes
-
srijs
-
kkysen
-
riking
-
Lemmih
-
memoryruins
-
senden9
-
robjtede
-
Jonas Platte
-
spike grobstein
-
Oliver Marshall
-
Sam Harrington
-
Jonas
-
Jeff Muizelaar
-
Eugene Bulkin
-
Chris Butler
-
sierrafiveseven
-
Joseph Garvin
-
MarcoFalke
-
athre0z
-
icewind
-
Tommy Thorn
-
Sebastian Zivota
-
Oskar Nehlin
-
Nicolas Barbier
-
Daniel
-
Thomas Colliers
-
Justin Ossevoort
-
Chris
-
Bálint Horváth
-
kiyoshigawa
-
Daniel Sheehan
-
Marvin Löbel
-
nacaclanga
-
Matthew Conolly
-
0x0177b11f
-
L.apz
-
JockeTF
-
davidcornu
-
stuhood
-
Myrik Lord
-
Mauve
-
icewind1991
-
T
-
nicholasbishop
-
Emily A. Bellows
-
David Vasak
-
Eric Driggers
-
Olaf Leidinger
-
UtherII
-
simonlindholm
-
lemmih
-
Eddddddd
-
rrbutani
-
Mateusz K
-
thk1
-
0xdeafbeef
-
teh
-
KirilMihaylov
-
Vladislav Sukhmel
and a few others who preferred to stay anonymous.
Former sponsors/patreons:
-
igrr
-
Traverse-Research
-
finfet
-
Alovchin91
-
wezm
-
mexus
-
raymanfx
-
ghost
-
gilescope
-
olanod
-
Denis Zaletaev
-
Chai T. Rex
-
Paul Ellenbogen
-
Dakota Brink
-
Botlabs
-
Cass
-
Oliver Marshall
-
pthariensflame
-
tedbyron
-
sstadick
-
Absolucy
-
rafaelcaricio
-
dandxy89
-
luizirber
-
regiontog
-
vincentdephily
-
zebp
-
Hofer-Julian
-
messense
-
fanquake
-
jam1garner
-
sbstp
-
evanrichter
-
Nehliin
-
nevi-me
-
TimNN
-
steven-joruk
-
seanpianka
-
robinmoussu