Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile uarch with other toolchain #63

Open
edubart opened this issue May 30, 2023 · 0 comments
Open

Compile uarch with other toolchain #63

edubart opened this issue May 30, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@edubart
Copy link
Contributor

edubart commented May 30, 2023

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 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.

@edubart edubart added the enhancement New feature or request label May 30, 2023
@mpernambuco mpernambuco linked a pull request Jul 18, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

2 participants