Closed archshift closed 2 years ago
+1 for general-purpose binary Linux distributions has been agreed use lp64d as the Hardware baseline and ABI choice.
https://wiki.debian.org/RISC-V#Hardware_baseline_and_ABI_choice
Now that #65953 is in, we can add new target specifications to close this issue.
We might want to add a d
or f
after the 32
or 64
in the target triple, like so:
riscv64dgc-unknown-none-elf
riscv32fgc-unknown-none-elf
The alternative is to append hf
to the end of the triple, although the fact that not every RV distribution has hard doubles might complicate this. But we might assume that any target has float widths corresponding to the pointer width.
That way, we can specify:
riscv64gc-unknown-none-elfhf
(lp64d)riscv32gc-unknown-none-elfhf
(ilp32f)Or even:
riscv64gc-unknown-linux-gnuhf
(lp64d)It is very unlikely that rustc is doing the correct ABI lowering of calls etc for the C psABI, especially when hard-floats are considered. Just switching on ilp32d
/ilp32f
/lp64d
/lp64f
will not be enough.
It has been on my list for a while to check the ABI lowering in rustc so that it matches the psABI, which will potentially require backwards-incompatible changes. I hope to get to this soon (there's other RISC-V LLVM work on my plate first).
Rustc should now be doing the correct ABI lowering of calls in the C psABI, including hard-float support (since #68452).
A target spec for rv64gc + lp64d (targetting linux) has been added in the form of riscv64gc-unknown-linux-gnu
which should be exactly what's needed for linux platform support.
I suppose this can be closed now?
riscv64gc-unknown-linux-gnu
target is hard-float with lp64d
ABI. Closing.
Currently Rust does not support compiling/linking with LLVM's
-target-abi=lp64d
option, which enables the hard-float ABI in riscv64.This feature is necessary for Rust interop with C code on hard-float targets.