Skip to content

Commit

Permalink
Add Linux mips64, mips architecture support
Browse files Browse the repository at this point in the history
  • Loading branch information
matoro committed Aug 2, 2023
1 parent 3c3555e commit e77c1ba
Show file tree
Hide file tree
Showing 2 changed files with 1,002 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ pub enum Arch {
Wasm32,
Riscv64,
Mips64el,
Mips64,
Mipsel,
Mips,
Sparc64,
LoongArch64,
}
Expand All @@ -91,7 +93,9 @@ impl fmt::Display for Arch {
Arch::Wasm32 => write!(f, "wasm32"),
Arch::Riscv64 => write!(f, "riscv64"),
Arch::Mips64el => write!(f, "mips64el"),
Arch::Mips64 => write!(f, "mips64"),
Arch::Mipsel => write!(f, "mipsel"),
Arch::Mips => write!(f, "mips"),
Arch::Sparc64 => write!(f, "sparc64"),
Arch::LoongArch64 => write!(f, "loongarch64"),
}
Expand All @@ -112,7 +116,7 @@ impl Arch {
Arch::X86 => "i386",
Arch::X86_64 => "amd64",
Arch::Riscv64 => "riscv",
Arch::Mips64el | Arch::Mipsel => "mips",
Arch::Mips64el | Arch::Mips64 | Arch::Mipsel | Arch::Mips => "mips",
// sparc64 is unsupported since FreeBSD 13.0
Arch::Sparc64 => "sparc64",
Arch::Wasm32 => "wasm32",
Expand All @@ -137,7 +141,9 @@ fn get_supported_architectures(os: &Os) -> Vec<Arch> {
Arch::X86_64,
Arch::Riscv64,
Arch::Mips64el,
Arch::Mips64,
Arch::Mipsel,
Arch::Mips,
Arch::Sparc64,
Arch::LoongArch64,
],
Expand Down Expand Up @@ -250,8 +256,16 @@ impl Target {
Architecture::S390x => Arch::S390X,
Architecture::Wasm32 => Arch::Wasm32,
Architecture::Riscv64(_) => Arch::Riscv64,
Architecture::Mips64(Mips64Architecture::Mips64el) => Arch::Mips64el,
Architecture::Mips32(Mips32Architecture::Mipsel) => Arch::Mipsel,
Architecture::Mips64(mips64_arch) => match mips64_arch {
Mips64Architecture::Mips64el => Arch::Mips64el,
Mips64Architecture::Mips64 => Arch::Mips64,
_ => bail!("The architecture {} is not supported", mips64_arch),
},
Architecture::Mips32(mips32_arch) => match mips32_arch {
Mips32Architecture::Mipsel => Arch::Mipsel,
Mips32Architecture::Mips => Arch::Mips,
_ => bail!("The architecture {} is not supported", mips32_arch),
},
Architecture::Sparc64 => Arch::Sparc64,
Architecture::LoongArch64 => Arch::LoongArch64,
unsupported => bail!("The architecture {} is not supported", unsupported),
Expand Down Expand Up @@ -331,8 +345,8 @@ impl Target {
Arch::Wasm32 => "wasm32",
Arch::Riscv64 => "riscv64",
// It's kinda surprising that Python doesn't include the `el` suffix
Arch::Mips64el => "mips64",
Arch::Mipsel => "mips",
Arch::Mips64el | Arch::Mips64 => "mips64",
Arch::Mipsel | Arch::Mips => "mips",
Arch::Sparc64 => "sparc64",
Arch::LoongArch64 => "loongarch64",
}
Expand Down Expand Up @@ -376,7 +390,9 @@ impl Target {
| Arch::Wasm32
| Arch::Riscv64
| Arch::Mips64el
| Arch::Mips64
| Arch::Mipsel
| Arch::Mips
| Arch::Powerpc
| Arch::Sparc64
| Arch::LoongArch64 => PlatformTag::Linux,
Expand All @@ -393,13 +409,15 @@ impl Target {
| Arch::S390X
| Arch::Riscv64
| Arch::Mips64el
| Arch::Mips64
| Arch::Sparc64
| Arch::LoongArch64 => 64,
Arch::Armv6L
| Arch::Armv7L
| Arch::X86
| Arch::Wasm32
| Arch::Mipsel
| Arch::Mips
| Arch::Powerpc => 32,
}
}
Expand Down

0 comments on commit e77c1ba

Please sign in to comment.