By now, Rust supports the following RISC-V targets:
PS C:\Users\luojia65> rustc --print target-list | findstr riscv
riscv32gc-unknown-linux-gnu
riscv32i-unknown-none-elf
riscv32imac-unknown-none-elf
riscv32imc-unknown-none-elf
riscv64gc-unknown-linux-gnu
riscv64gc-unknown-none-elf
riscv64imac-unknown-none-elf
As is listed, it's not listed by RISC-V's base extensions. RISC-V defined three base extensions: RV32I
, RV32E
and RV64I
, and defined extension modules like M
, A
or C
etc. addition to it.
Here, current Rust gave us only limited combinations.
As RISC-V grows there could be more modules come out. We cannot make every combination for every modules (that's O(2^N)
of work!). What make issues more is that there are operating system targets. For every operating system we are required to implement Rust toolchain in all combinations. That's a lot of targets which make code complex.
So we may keep:
riscv32i-unknown-linux-gnu
riscv32i-unknown-none-elf
riscv64i-unknown-linux-gnu
riscv64i-unknown-none-elf
... this means <base isa>-<vendor>-<platform>
for target definition which can simplify software implementations in Rust and its ecosystem.
For example I have an operating system called HarmonyOS on RISC-V, we should implement only riscv64i-huawei-harmonyos
and riscv32i-huawei-harmonyos
etc., instead of somehow lots of target combinations.
When did these combinations of RISC-V Rust targets comes out and where was this idea come from? Can we make a modification to rustc to simplify modular ISA implementation like RISC-V on Rust?