From 73e6bef26116e0e7f87cf72230d88e4b6e434b96 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 1 Jul 2024 12:19:59 -0700 Subject: [PATCH] Fix arch_zkasm. --- src/triple.rs | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/triple.rs b/src/triple.rs index e5d2158..7a4ab22 100644 --- a/src/triple.rs +++ b/src/triple.rs @@ -260,17 +260,7 @@ impl fmt::Display for Triple { } } - if self.binary_format != implied_binary_format - || (self.binary_format != BinaryFormat::Unknown - && self.environment != Environment::Eabi - && self.environment != Environment::Eabihf - && self.environment != Environment::Sgx - && self.architecture != Architecture::Avr - && self.architecture != Architecture::Wasm32 - && self.architecture != Architecture::Wasm64 - && (self.operating_system == OperatingSystem::None_ - || self.operating_system == OperatingSystem::Unknown)) - { + if self.binary_format != implied_binary_format || show_binary_format_with_no_os(self) { // As a special case, omit a non-default binary format for some // targets which happen to exclude it. write!(f, "-{}", self.binary_format)?; @@ -279,6 +269,26 @@ impl fmt::Display for Triple { } } +fn show_binary_format_with_no_os(triple: &Triple) -> bool { + if triple.binary_format == BinaryFormat::Unknown { + return false; + } + + #[cfg(feature = "arch_zkasm")] + if triple.architecture == Architecture::ZkAsm { + return false; + } + + triple.environment != Environment::Eabi + && triple.environment != Environment::Eabihf + && triple.environment != Environment::Sgx + && triple.architecture != Architecture::Avr + && triple.architecture != Architecture::Wasm32 + && triple.architecture != Architecture::Wasm64 + && (triple.operating_system == OperatingSystem::None_ + || triple.operating_system == OperatingSystem::Unknown) +} + impl FromStr for Triple { type Err = ParseError;