Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

cranelift-object: emit PLATFORM_MACOS for Darwin triples on macOS hosts (#13481)

Damilare Darmie Akinlaja6fce8d22ff41
diff --git a/cranelift/object/src/backend.rs b/cranelift/object/src/backend.rs
index 33ec3b4bbf..4d6789a7ad 100644
--- a/cranelift/object/src/backend.rs
+++ b/cranelift/object/src/backend.rs
@@ -190,7 +190,9 @@ fn macho_build_version(triple: &Triple) -> Option<object::write::MachOBuildVersi
// TODO(madsmtm): Properly support simulator after
// https://github.com/bytecodealliance/target-lexicon/pull/130
let platform = match (triple.operating_system, triple.environment) {
- (Darwin(_), _) => 0, // PLATFORM_UNKNOWN
+ // Sometimes the target is macOS but the environment is Darwin,
+ // and sometimes it's the other way around. Support both.
+ (Darwin(_), _) => PLATFORM_MACOS,
(MacOSX(_), _) => PLATFORM_MACOS,
(_, Macabi) => PLATFORM_MACCATALYST,
(IOS(_), Sim) => PLATFORM_IOSSIMULATOR,