Skip to content

Commit

Permalink
cross-compile: riscv: look through whitelist of compilers
Browse files Browse the repository at this point in the history
riscv currently has several competing compiler toolchain prefixes. If a
toolchain supports multilib, then an "incorrect" target triple may be
used.

For example, many distributions ship multilib toolchains with a
`riscv64` prefix, so a riscv32imac-unknown-none-elf target can
successfully use a toolchain with a triple of `riscv64-unknown-none`.

Signed-off-by: Sean Cross <sean@xobs.io>
  • Loading branch information
xobs committed Jun 26, 2020
1 parent 777f0f4 commit e578fba
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2291,11 +2291,31 @@ 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"),
"riscv32i-unknown-none-elf" => self.find_working_gnu_prefix(&[
"riscv32-unknown-elf",
"riscv64-unknown-elf",
"riscv-none-embed",
]),
"riscv32imac-unknown-none-elf" => self.find_working_gnu_prefix(&[
"riscv32-unknown-elf",
"riscv64-unknown-elf",
"riscv-none-embed",
]),
"riscv32imc-unknown-none-elf" => self.find_working_gnu_prefix(&[
"riscv32-unknown-elf",
"riscv64-unknown-elf",
"riscv-none-embed",
]),
"riscv64gc-unknown-none-elf" => self.find_working_gnu_prefix(&[
"riscv64-unknown-elf",
"riscv32-unknown-elf",
"riscv-none-embed",
]),
"riscv64imac-unknown-none-elf" => self.find_working_gnu_prefix(&[
"riscv64-unknown-elf",
"riscv32-unknown-elf",
"riscv-none-embed",
]),
"riscv64gc-unknown-linux-gnu" => Some("riscv64-linux-gnu"),
"s390x-unknown-linux-gnu" => Some("s390x-linux-gnu"),
"sparc-unknown-linux-gnu" => Some("sparc-linux-gnu"),
Expand Down

0 comments on commit e578fba

Please sign in to comment.