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

add support for linux_riscv64 and freestanding_riscv64 #4089

Merged
merged 3 commits into from
Aug 22, 2024

Conversation

laytan
Copy link
Sponsor Collaborator

@laytan laytan commented Aug 16, 2024

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 use odin build . -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12" to use the riscv enabled linker.

src/llvm_abi.cpp Outdated Show resolved Hide resolved
@laytan laytan force-pushed the riscv64 branch 2 times, most recently from 6d7b501 to fbf4d1a Compare August 20, 2024 12:07
core/sys/linux/types.odin Outdated Show resolved Hide resolved
@gingerBill gingerBill merged commit 70932dc into odin-lang:master Aug 22, 2024
7 checks passed
@laytan laytan deleted the riscv64 branch August 22, 2024 10:54
FourteenBrush added a commit to FourteenBrush/grumm that referenced this pull request Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants