rustc_codegen_gcc: Progress Report #35
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
We implemented new patches that are yet to be sent to the mailing list:
-
Remove wrong void type for sized floating-point types in tree_type_to_jit_type
-
jit: Fix volatile loads and stores (thanks to YakoYakoYokuYoku!)
We also had our patch to reorganize the CPU feature detection code to remove duplication between gccrs
and rustc_codegen_gcc
merged:
I hope this is the first of many contributions we’ll have between the two projects and that we can continue to collaborate with and help each other.
We also got reviews of some patches that were sent in the past.
State of rustc_codegen_gcc
Here’s what has been done during the past months:
-
stabilize lang_tests_common config parsing logic (thanks to onur-ozkan!)
-
Use casts instead of bitcast between pointers and integers to fix issues when using the lld linker
-
fix typo (thanks to klensy!)
-
Remove obsolete codegen_gcc_lto_not_supported message in messages.flt (thanks to Sudhanshu069!)
-
Add grep check for LTO Test (thanks to Anon258!)
-
Remove extra whitespace at the end of some line strings (thanks to GuillaumeGomez!)
-
Add
--gcc-path
option (thanks to GuillaumeGomez!) -
Fix
--use-system-gcc
option handling (thanks to GuillaumeGomez!) -
Update repositories URL for repositories moved to
rust-lang
organization (thanks to GuillaumeGomez!) -
Make globals always have 2+ chars as suffix (thanks to fluxchief!)
-
Add M68000 entry to arch_to_gcc (thanks to fluxchief!)
-
Add CI success job (thanks to Kobzol!)
-
Remove duplicated CI triggers (thanks to Kobzol!)
-
fix backslashes in path used for
asm_tests
(thanks to folkertdev!) -
remove some intrinsics (thanks to c8ef!)
-
handle NaN in unordered comparisons (thanks to folkertdev!)
-
fix clobbered or lateout registers overlapping with input registers (thanks to folkertdev!)
-
support reg_byte registers (thanks to folkertdev!)
-
Cleaned up tests by bringing objects under mini_core into scope (thanks to madhav-madhusoodanan!)
Apart from that, there was a lot of progress towards having rustup
distribution thanks to Kobzol:
Let’s hope that we can get rustup
distribution soon in order to make it easier for people to try this project.
I still struggle with the current sync: this time, I’m blocked by a regression in libm
.
Hopefully, these PRs will be merged soon in order to unblock me:
Next month, I’ll finish this sync, I’ll continue adding support for other non-default ABIs and improve the documentation for new contributors.
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. |
22% |
22% |
|
Target features (to detect what is supported in an architecture, like SIMD). |
82% |
82% |
|
Debug info. |
20% |
||
Thin LTO. |
5% |
5% |
|
Rustup distribution. |
0% |
30% |
+30% |
SIMD for other architectures than x86-64. |
0% |
||
Support for new architectures in libraries (libc, object, …) and rustc. |
0% |
||
Refactor to rustc_codegen_ssa to make it easier for the GCC codegen |
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/13737777061/job/38423511361#step:14:4278
-
https://github.com/rust-lang/rustc_codegen_gcc/actions/runs/13737777061/job/38423511483#step:14:4320
-
https://github.com/rust-lang/rustc_codegen_gcc/actions/runs/13737042944#summary-38421976671 (failures)
Category | Last Month | This Month | Delta |
---|---|---|---|
Passed |
6125 |
6156 |
+31 |
Failed |
129 |
48 |
-81 |
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.
To do so, follow these instructions to build the project and run a program via the cargo
command of our script.
If you find a bug, please open an issue.
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
-
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 and to Kobzol and GuillaumeGomez for their contributions. Another big thank you to Commeownist for his contributions.
Also, a big thank you to the rest of my sponsors:
-
kpp
-
0x7CFE
-
oleid
-
acshi
-
joshtriplett
-
djc
-
sdroege
-
pcn
-
alanfalloon
-
davidlattimore
-
colelawrence
-
zmanian
-
berkus
-
belzael
-
yvt
-
Shoeboxam
-
yerke
-
srijs
-
kkysen
-
riking
-
Lemmih
-
memoryruins
-
senden9
-
robjtede
-
Jonas Platte
-
Sam Harrington
-
Jonas
-
Eugene Bulkin
-
Joseph Garvin
-
MarcoFalke
-
athre0z
-
Sebastian Zivota
-
Oskar Nehlin
-
Nicolas Barbier
-
Daniel
-
Justin Ossevoort
-
kiyoshigawa
-
Daniel Sheehan
-
Marvin Löbel
-
nacaclanga
-
0x0177b11f
-
L.apz
-
JockeTF
-
davidcornu
-
stuhood
-
Mauve
-
icewind1991
-
nicholasbishop
-
David Vasak
-
Eric Driggers
-
Olaf Leidinger
-
UtherII
-
simonlindholm
-
lemmih
-
Eddddddd
-
rrbutani
-
Mateusz K
-
thk1
-
teh
-
KirilMihaylov
-
Vladislav Sukhmel
-
ximou
-
Kate Kiesel
-
jplatte
-
VasanthakumarV
-
thesamesam
-
sbstp
-
g4titanx
-
teohhanhui
-
Laine Taffin Altman
and a few others who preferred to stay anonymous.
Former sponsors/patreons:
-
igrr
-
embark-studios
-
saethlin
-
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
-
evanrichter
-
Nehliin
-
nevi-me
-
TimNN
-
steven-joruk
-
seanpianka
-
spike grobstein
-
Jeff Muizelaar
-
robinmoussu
-
Chris Butler
-
sierrafiveseven
-
icewind
-
Thomas Colliers
-
Tommy Thorn
-
Bálint Horváth
-
Matthew Conolly
-
Lapz
-
Myrik Lord
-
T
-
Emily A. Bellows
-
Chris
-
repi
-
opensrcsec
-
NobodyXu
-
alexkirsz
-
0xdeafbeef
-
l-const
-
CohenArthur
-
bes