1
Fork 0

Use target.abi instead of string matching llvm_target

This commit is contained in:
Keith Smiley 2023-08-21 13:32:14 -07:00
parent d37fdc95d4
commit f988cbb065
No known key found for this signature in database
GPG key ID: 33BA60D44C7167F8

View file

@ -193,31 +193,15 @@ pub fn sdk_version(platform: u32) -> Option<(u32, u32)> {
} }
pub fn platform(target: &Target) -> Option<u32> { pub fn platform(target: &Target) -> Option<u32> {
Some(match &*target.os { Some(match (&*target.os, &*target.abi) {
"macos" => object::macho::PLATFORM_MACOS, ("macos", _) => object::macho::PLATFORM_MACOS,
"ios" => { ("ios", "macabi") => object::macho::PLATFORM_MACCATALYST,
if target.llvm_target.ends_with("-macabi") { ("ios", "sim") => object::macho::PLATFORM_IOSSIMULATOR,
object::macho::PLATFORM_MACCATALYST ("ios", _) => object::macho::PLATFORM_IOS,
} else if target.llvm_target.ends_with("-simulator") { ("watchos", "sim") => object::macho::PLATFORM_WATCHOSSIMULATOR,
object::macho::PLATFORM_IOSSIMULATOR ("watchos", _) => object::macho::PLATFORM_WATCHOS,
} else { ("tvos", "sim") => object::macho::PLATFORM_TVOSSIMULATOR,
object::macho::PLATFORM_IOS ("tvos", _) => object::macho::PLATFORM_TVOS,
}
}
"watchos" => {
if target.llvm_target.ends_with("-simulator") {
object::macho::PLATFORM_WATCHOSSIMULATOR
} else {
object::macho::PLATFORM_WATCHOS
}
}
"tvos" => {
if target.llvm_target.ends_with("-simulator") {
object::macho::PLATFORM_TVOSSIMULATOR
} else {
object::macho::PLATFORM_TVOS
}
}
_ => return None, _ => return None,
}) })
} }
@ -229,7 +213,7 @@ pub fn deployment_target(target: &Target) -> Option<(u32, u32)> {
let arch = if target.arch == "x86" || target.arch == "x86_64" { X86_64 } else { Arm64 }; let arch = if target.arch == "x86" || target.arch == "x86_64" { X86_64 } else { Arm64 };
macos_deployment_target(arch) macos_deployment_target(arch)
} }
"ios" => match &*target.options.abi { "ios" => match &*target.abi {
"macabi" => mac_catalyst_deployment_target(), "macabi" => mac_catalyst_deployment_target(),
_ => ios_deployment_target(), _ => ios_deployment_target(),
}, },