Skip to content

Commit

Permalink
Add support for riscv64
Browse files Browse the repository at this point in the history
Co-authored-by: Alan Mock <alan@alanmock.com>
Co-authored-by: Patrick Elsen <pelsen@xfbs.net>
  • Loading branch information
3 people committed Aug 19, 2023
1 parent 4983338 commit 3bc2da6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/ring-core/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
#elif defined(__MIPSEL__) && defined(__LP64__)
#define OPENSSL_64_BIT
#define OPENSSL_MIPS64
#elif defined(__riscv) && __riscv_xlen == 64
#define OPENSSL_64_BIT
#define OPENSSL_RISCV64
#elif defined(__wasm__)
#define OPENSSL_32_BIT
#else
Expand Down
7 changes: 7 additions & 0 deletions mk/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rustflags_self_contained="-Clink-self-contained=yes -Clinker=rust-lld"
qemu_aarch64="qemu-aarch64 -L /usr/aarch64-linux-gnu"
qemu_arm="qemu-arm -L /usr/arm-linux-gnueabihf"
qemu_mipsel="qemu-mipsel -L /usr/mipsel-linux-gnu"
qemu_riscv64="qemu-riscv64 -L /usr/riscv64-linux-gnu"

# Avoid putting the Android tools in `$PATH` because there are tools in this
# directory like `clang` that would conflict with the same-named tools that may
Expand Down Expand Up @@ -99,6 +100,12 @@ case $target in
export CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc
export CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_RUNNER="$qemu_mipsel"
;;
riscv64gc-unknown-linux-gnu)
export CC_riscv64gc_unknown_linux_gnu=clang-$llvm_version
export AR_riscv64gc_unknown_linux_gnu=llvm-ar-$llvm_version
export CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER=clang-$llvm_version
export CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_RUNNER="$qemu_riscv64"
;;
x86_64-unknown-linux-musl)
export CC_x86_64_unknown_linux_musl=clang-$llvm_version
export AR_x86_64_unknown_linux_musl=llvm-ar-$llvm_version
Expand Down
7 changes: 7 additions & 0 deletions mk/install-build-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ case $target in
libc6-dev-mipsel-cross \
qemu-user
;;
--target=riscv64gc-unknown-linux-gnu)
use_clang=1
install_packages \
gcc-riscv64-linux-gnu \
libc6-dev-riscv64-cross \
qemu-user
;;
--target=wasm32-unknown-unknown)
cargo install wasm-bindgen-cli --bin wasm-bindgen-test-runner
use_clang=1
Expand Down

0 comments on commit 3bc2da6

Please sign in to comment.