Skip to content

Commit

Permalink
Merge pull request #428 from laanwj/2019_08_riscv
Browse files Browse the repository at this point in the history
Add RISC-V support
  • Loading branch information
alexcrichton authored Aug 7, 2019
2 parents 85bc5b9 + 4981b3c commit f6f6c81
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,17 @@ impl Build {
cmd.args.push("-mfloat-abi=soft".into());
}
}
if target.starts_with("riscv32") || target.starts_with("riscv64") {
// get the 32i/32imac/32imc/64gc/64imac/... part
let mut parts = target.split('-');
if let Some(arch) = parts.next() {
let arch = &arch[5..];
cmd.args.push(("-march=rv".to_owned() + arch).into());
// ABI is always soft-float right now, update this when this is no longer the
// case:
cmd.args.push("-mabi=lp64".into());
}
}
}
}

Expand Down Expand Up @@ -1809,6 +1820,11 @@ impl Build {
"powerpc-unknown-netbsd" => Some("powerpc--netbsd"),
"powerpc64-unknown-linux-gnu" => Some("powerpc-linux-gnu"),
"powerpc64le-unknown-linux-gnu" => Some("powerpc64le-linux-gnu"),
"riscv32i-unknown-none-elf" => Some("riscv32-unknown-elf"),
"riscv32imac-unknown-none-elf" => Some("riscv32-unknown-elf"),
"riscv32imc-unknown-none-elf" => Some("riscv32-unknown-elf"),
"riscv64gc-unknown-none-elf" => Some("riscv64-unknown-elf"),
"riscv64imac-unknown-none-elf" => Some("riscv64-unknown-elf"),
"s390x-unknown-linux-gnu" => Some("s390x-linux-gnu"),
"sparc-unknown-linux-gnu" => Some("sparc-linux-gnu"),
"sparc64-unknown-linux-gnu" => Some("sparc64-linux-gnu"),
Expand Down

0 comments on commit f6f6c81

Please sign in to comment.