Skip to content

Commit d050a0d

Browse files
committed
Added RISCV target support to LLVM 9+
Fixes rust-lang#191
1 parent fdf8957 commit d050a0d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ target-sparc = []
4242
target-bpf = []
4343
target-lanai = []
4444
target-webassembly = []
45+
target-riscv = []
4546
target-all = [
4647
"target-x86",
4748
"target-arm",
@@ -57,7 +58,8 @@ target-all = [
5758
"target-sparc",
5859
"target-bpf",
5960
"target-lanai",
60-
"target-webassembly"
61+
"target-webassembly",
62+
"target-riscv"
6163
]
6264
experimental = ["static-alloc"]
6365

src/targets.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -743,14 +743,13 @@ impl Target {
743743
}
744744
}
745745

746-
// REVIEW: As it turns out; RISCV was accidentally built by default in 4.0 since
747-
// it was meant to be marked experimental and so it was later removed from default
748-
// builds in 5.0+. Since llvm-sys doesn't officially support any experimental targets
749-
// we're going to make this 4.0 only for now so that it doesn't break test builds.
750-
// We can revisit this issue if someone wants RISCV support in inkwell, or if
751-
// llvm-sys starts supporting experimental llvm targets. See
752-
// https://lists.llvm.org/pipermail/llvm-dev/2017-August/116347.html for more info
753-
#[llvm_versions(4.0)]
746+
// RISCV was accidentally built by default in 4.0 since it was meant to be marked
747+
// experimental and so it was later removed from default builds in 5.0 until it was
748+
// officially released in 9.0 Since llvm-sys doesn't officially support any experimental
749+
// targets we're going to make this 9.0+ only. See
750+
// https://lists.llvm.org/pipermail/llvm-dev/2017-August/116347.html for more info.
751+
#[cfg(feature = "target-riscv")]
752+
#[llvm_versions(9.0..=latest)]
754753
pub fn initialize_riscv(config: &InitializationConfig) {
755754
use llvm_sys::target::{
756755
LLVMInitializeRISCVTarget, LLVMInitializeRISCVTargetInfo, LLVMInitializeRISCVTargetMC,

0 commit comments

Comments
 (0)