Skip to content

Commit f6f6c81

Browse files
authored
Merge pull request #428 from laanwj/2019_08_riscv
Add RISC-V support
2 parents 85bc5b9 + 4981b3c commit f6f6c81

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,17 @@ impl Build {
14281428
cmd.args.push("-mfloat-abi=soft".into());
14291429
}
14301430
}
1431+
if target.starts_with("riscv32") || target.starts_with("riscv64") {
1432+
// get the 32i/32imac/32imc/64gc/64imac/... part
1433+
let mut parts = target.split('-');
1434+
if let Some(arch) = parts.next() {
1435+
let arch = &arch[5..];
1436+
cmd.args.push(("-march=rv".to_owned() + arch).into());
1437+
// ABI is always soft-float right now, update this when this is no longer the
1438+
// case:
1439+
cmd.args.push("-mabi=lp64".into());
1440+
}
1441+
}
14311442
}
14321443
}
14331444

@@ -1809,6 +1820,11 @@ impl Build {
18091820
"powerpc-unknown-netbsd" => Some("powerpc--netbsd"),
18101821
"powerpc64-unknown-linux-gnu" => Some("powerpc-linux-gnu"),
18111822
"powerpc64le-unknown-linux-gnu" => Some("powerpc64le-linux-gnu"),
1823+
"riscv32i-unknown-none-elf" => Some("riscv32-unknown-elf"),
1824+
"riscv32imac-unknown-none-elf" => Some("riscv32-unknown-elf"),
1825+
"riscv32imc-unknown-none-elf" => Some("riscv32-unknown-elf"),
1826+
"riscv64gc-unknown-none-elf" => Some("riscv64-unknown-elf"),
1827+
"riscv64imac-unknown-none-elf" => Some("riscv64-unknown-elf"),
18121828
"s390x-unknown-linux-gnu" => Some("s390x-linux-gnu"),
18131829
"sparc-unknown-linux-gnu" => Some("sparc-linux-gnu"),
18141830
"sparc64-unknown-linux-gnu" => Some("sparc64-linux-gnu"),

0 commit comments

Comments
 (0)