-
Notifications
You must be signed in to change notification settings - Fork 80
Description
This is an issue tracking the work on cross-compiling the Rust compiler to DEC Alpha.
Here is a list of things that need to be done to facilitate compiling any Rust code for DEC Alpha:
- Add bare-bones support for DEC Alpha in the object crate. This crate is used by Rust to embed metadata in executables.
- Done, PR waiting for merge Add support for the alpha architecture in cc-rs
- Create an Alpha target file - I have created a target file myself, but I would prefer to double-check if that target is correct.
- Fix the libgccjit
!gdisp!0
error. For now, I workaround this issue by removing this erronious label from all assembled files. We should figure out why this is even generated. - Fix the instruction
jsr $23,($27),__%E3%j5
getting emited incompiler_builtins
. From asking about, it seems like%
can't be present in symbol names: it is a format specifier(like inprintf
). So, it seems like it just does not get expanded properly? This function should normally expand to a call to a division subroutine(DEC alpha lacks hardware division support).
Here is a list of compiler-side changes we will need to make to compile any code to Alpha. Those changes should be merged upstream.
- Add handling of the Alpha ABI to the Rust compiler, here.
- Add Alpha to the code inserting metadata into object files, here.
- Add Alpha as a recognized architecture to be used in
#[cfg(target_arch = "alpha")]
. This is not strictly needed for our work, but it is a required step before getting anything else upstream.
From some talks with the Rust folk, it seems like we can do those steps without the need for an official target. So, we will be able to just use our own target files, and add a tier 3 target once we have better support.
After those changes, we will be able to build code not depending on std
.
- (Optional) We should also add the config for the x86_64 -> Alpha cross compiler to our configs. This will just make cross-compilation slightly easier for other people(creating those config files is not hard, but having prepared configs would not hurt).
Next, I will list the changes needed to build on std
, and code depending on the standard library for Alpha
.
-
Add Alpha support to
libc
(a Rust library desciribing C types on the target). Doing so would require some work(tracking down the size / layout of all the libc types on Alpha). That work should get merged upstream. We may need to cordinate with thelibc
crate refactor project, to ensure our work does not collide. -
(Optional) Add Alpha unwinding support to
std
.
At this point, we should be able to build std
, and at least a chunk of crates depending on it. There might be some issues with crates which build C
dependencies, but we should be nontheless able to at least try cross-compling some Rust packages to Alpha. We would not be able to run the Rust compiler on Alpha yet, but we would be able to run a chunk of Rust code there.
I belive we should then cross-compile the Rust core
, std
and alloc
test suite to Alpha, to check if everything is working correctly.
I don't yet know what would be required to get the Rust compiler to run on Alpha - will update this once I figure this out.
@glaubitz I think this issue might be of interest to you.