1
Fork 0

Move Mach-O platform information to rustc_codegen_ssa:🔙:apple

To align with the general decision to have this sort of information
there instead.

Also use the visionOS values added in newer `object` release.
This commit is contained in:
Mads Marquart 2024-11-01 17:05:10 +01:00
parent e1233153ac
commit e75a7ddad3
4 changed files with 18 additions and 21 deletions

View file

@ -7,6 +7,22 @@ use rustc_target::spec::Target;
#[cfg(test)]
mod tests;
pub(super) fn macho_platform(target: &Target) -> u32 {
match (&*target.os, &*target.abi) {
("macos", _) => object::macho::PLATFORM_MACOS,
("ios", "macabi") => object::macho::PLATFORM_MACCATALYST,
("ios", "sim") => object::macho::PLATFORM_IOSSIMULATOR,
("ios", _) => object::macho::PLATFORM_IOS,
("watchos", "sim") => object::macho::PLATFORM_WATCHOSSIMULATOR,
("watchos", _) => object::macho::PLATFORM_WATCHOS,
("tvos", "sim") => object::macho::PLATFORM_TVOSSIMULATOR,
("tvos", _) => object::macho::PLATFORM_TVOS,
("visionos", "sim") => object::macho::PLATFORM_XROSSIMULATOR,
("visionos", _) => object::macho::PLATFORM_XROS,
_ => unreachable!("tried to get Mach-O platform for non-Apple target"),
}
}
/// Deployment target or SDK version.
///
/// The size of the numbers in here are limited by Mach-O's `LC_BUILD_VERSION`.

View file

@ -402,8 +402,7 @@ fn macho_object_build_version_for_target(sess: &Session) -> object::write::MachO
(major << 16) | (minor << 8) | patch
}
let platform =
rustc_target::spec::current_apple_platform(&sess.target).expect("unknown Apple target OS");
let platform = apple::macho_platform(&sess.target);
let min_os = apple::deployment_target(sess);
let mut build_version = object::write::MachOBuildVersion::default();