You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we are compiling uarch with the old cartesi toolchain v0.11.0, because it's compiled without floating-point support. We should switch to a new toolchain to compile uarch, instead of relying on an old container image.
Possible solutions
Ideally we want to reuse some existing toolchain, so we don't have to maintain one ourselves.
One solution is to reuse the standard RISC-V toolchain provided by a host distribution, however most RISC-V toolchains are compiled with floating-point support with lp64d ABI and is impossible to switch to lp64 ABI without recompiling the whole toolchain. Yet I made a small experiment compiling uarch with the same toolchain as the kernel by changing -march=rv64i -mabi=lp64 to -march=rv64ifd -mabi=lp64d, and things just worked. I made a full disassemble of the final uarch-ram.elf, and no floating-pointing instruction was generated, also all uarch tests passed. So we could use the standard toolchain to compile uarch with some extra care. This is a little fragile, but could work, we could make this less fragile by disassembling all instructions used in the final uarch ELF file with objdump, then checking with a tool that we support all of them. A drawback of this solution is that it does not allow us to link any external library, because they may use unsupported extensions (such as RISC-V MFD).
A second solution is to use a tool to compile toolchain, such as crosstool-NG, musl-cross-make, riscv-gnu-toolchain, or even repackage some distribution toolchain. Then we would maintain a Docker image only with the uarch-toolchain, this is similar to what we have been doing, however with a toolchain specialized for uarch that we would maintain. By having a dedicated toolchain for uarch it would allow us to compile and link external libraries in case we need them in uarch.
The text was updated successfully, but these errors were encountered:
Context
Currently we are compiling uarch with the old cartesi toolchain v0.11.0, because it's compiled without floating-point support. We should switch to a new toolchain to compile uarch, instead of relying on an old container image.
Possible solutions
Ideally we want to reuse some existing toolchain, so we don't have to maintain one ourselves.
One solution is to reuse the standard RISC-V toolchain provided by a host distribution, however most RISC-V toolchains are compiled with floating-point support with
lp64d
ABI and is impossible to switch tolp64
ABI without recompiling the whole toolchain. Yet I made a small experiment compiling uarch with the same toolchain as the kernel by changing-march=rv64i -mabi=lp64
to-march=rv64ifd -mabi=lp64d
, and things just worked. I made a full disassemble of the finaluarch-ram.elf
, and no floating-pointing instruction was generated, also all uarch tests passed. So we could use the standard toolchain to compile uarch with some extra care. This is a little fragile, but could work, we could make this less fragile by disassembling all instructions used in the final uarch ELF file with objdump, then checking with a tool that we support all of them. A drawback of this solution is that it does not allow us to link any external library, because they may use unsupported extensions (such as RISC-V MFD).A second solution is to use a tool to compile toolchain, such as crosstool-NG, musl-cross-make, riscv-gnu-toolchain, or even repackage some distribution toolchain. Then we would maintain a Docker image only with the uarch-toolchain, this is similar to what we have been doing, however with a toolchain specialized for uarch that we would maintain. By having a dedicated toolchain for uarch it would allow us to compile and link external libraries in case we need them in uarch.
The text was updated successfully, but these errors were encountered: