add support for linux_riscv64 and freestanding_riscv64 #4089
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for riscv64 through a Linux and freestanding target.
We require the float, doubles and integer multiplication extensions to be enabled. We default to the same features as clang with
-march=rv64gc
which stands for "general computing". Users can tweak extensions with -microarch and -target-features. These default features are:64bit,a,c,d,f,m,relax,zicsr,zifencei
you can find more info on them by compiling with-target-features:"help"
.You can either build with no libc through
odin build . -target:linux_riscv64 -no-crt -default-to-nil-allocator
and in my testing I needed-reloc-mode:static
or it would complain about thread local storage.Or, install the gnu toolchain
sudo apt install gcc-12-riscv64-linux-gnu libc6-dev-riscv64-cross
to get the cross-compilation toolchain and useodin build . -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12"
to use the riscv enabled linker.