Add Windows x86-32 emulation support to interpreter architecture checks

This commit is contained in:
Zanie Blue 2025-05-30 13:04:30 -05:00
parent 483b4c82e8
commit 916c27e5bd

View file

@ -142,14 +142,30 @@ impl Arch {
// TODO: Implement `variant` support checks
// Windows ARM64 runs emulated x86_64 binaries transparently
// Similarly, macOS aarch64 runs emulated x86_64 binaries transparently if you have Rosetta
// installed. We don't try to be clever and check if that's the case here, we just assume
// that if x86_64 distributions are available, they're usable.
if (cfg!(windows) || cfg!(target_os = "macos"))
&& matches!(self.family, target_lexicon::Architecture::Aarch64(_))
{
return other.family == target_lexicon::Architecture::X86_64;
if cfg!(windows) {
match (self.family, other.family) {
// Windows aarch64 runs emulated x86_64 binaries transparently
(
target_lexicon::Architecture::Aarch64(_),
target_lexicon::Architecture::X86_64,
)
// Windows x86_64 runs emulated x86_32 binaries transparently
| (target_lexicon::Architecture::X86_64, target_lexicon::Architecture::X86_32(_)) => {
return true
}
_ => {}
}
} else if cfg!(target_os = "macos") {
match (self.family, other.family) {
// macOS aarch64 runs emulated x86_64 binaries transparently if you have Rosetta
// installed. We don't try to be clever and check if that's the case here, we just assume
// that if x86_64 distributions are available, they're usable.
(
target_lexicon::Architecture::Aarch64(_),
target_lexicon::Architecture::X86_64,
) => return true,
_ => {}
}
}
false