Skip to content

Commit 71f4548

Browse files
Support riscv64 as binary platform (#54011)
This patch adds support for `riscv64` as binary platform. Note: This only allows Julia to handle `riscv64` in `BinaryPlatforms` and `CPUID`. There is no support for either code generation or building Julia on RISC-V systems. This is only a necessary first step towards these goals. In particular, this is necessary to support building external libraries for RISC-V via BinaryBuilder as described in JuliaPackaging/BinaryBuilderBase.jl#374. --------- Co-authored-by: Oscar Smith <[email protected]>
1 parent 68da780 commit 71f4548

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

base/binaryplatforms.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ end
194194
function validate_tags(tags::Dict)
195195
throw_invalid_key(k) = throw(ArgumentError("Key \"$(k)\" cannot have value \"$(tags[k])\""))
196196
# Validate `arch`
197-
if tags["arch"] ("x86_64", "i686", "armv7l", "armv6l", "aarch64", "powerpc64le")
197+
if tags["arch"] ("x86_64", "i686", "armv7l", "armv6l", "aarch64", "powerpc64le", "riscv64")
198198
throw_invalid_key("arch")
199199
end
200200
# Validate `os`
@@ -597,6 +597,7 @@ const arch_mapping = Dict(
597597
"armv7l" => "arm(v7l)?", # if we just see `arm-linux-gnueabihf`, we assume it's `armv7l`
598598
"armv6l" => "armv6l",
599599
"powerpc64le" => "p(ower)?pc64le",
600+
"riscv64" => "riscv64",
600601
)
601602
# Keep this in sync with `CPUID.ISAs_by_family`
602603
# These are the CPUID side of the microarchitectures targeted by GCC flags in BinaryBuilder.jl
@@ -632,7 +633,10 @@ const arch_march_isa_mapping = let
632633
],
633634
"powerpc64le" => [
634635
"power8" => get_set("powerpc64le", "power8"),
635-
]
636+
],
637+
"riscv64" => [
638+
"riscv64" => get_set("riscv64", "riscv64"),
639+
],
636640
)
637641
end
638642
const os_mapping = Dict(

base/cpuid.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ const ISAs_by_family = Dict(
6464
"powerpc64le" => [
6565
# We have no way to test powerpc64le features yet, so we're only going to declare the lowest ISA:
6666
"power8" => ISA(Set{UInt32}()),
67-
]
67+
],
68+
"riscv64" => [
69+
# We have no way to test riscv64 features yet, so we're only going to declare the lowest ISA:
70+
"riscv64" => ISA(Set{UInt32}()),
71+
],
6872
)
6973

7074
# Test a CPU feature exists on the currently-running host

0 commit comments

Comments
 (0)