Skip to content

Commit 94ddbb6

Browse files
committed
Remove MACOSX_DEPLOYMENT_TARGET env var when linking Mac Catalyst
Mac Catalyst uses IPHONEOS_DEPLOYMENT_TARGET to specify the deployment target, so it makes no sense to remove that variable.
1 parent bea5beb commit 94ddbb6

File tree

1 file changed

+4
-10
lines changed
  • compiler/rustc_target/src/spec/base/apple

1 file changed

+4
-10
lines changed

compiler/rustc_target/src/spec/base/apple/mod.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
131131
abi: abi.into(),
132132
os: os.into(),
133133
cpu: arch.target_cpu().into(),
134-
link_env_remove: link_env_remove(arch, os),
134+
link_env_remove: link_env_remove(os),
135135
vendor: "apple".into(),
136136
linker_flavor: LinkerFlavor::Darwin(Cc::Yes, Lld::No),
137137
// macOS has -dead_strip, which doesn't rely on function_sections
@@ -270,7 +270,7 @@ pub fn macos_llvm_target(arch: Arch) -> String {
270270
format!("{}-apple-macosx{}.{}.0", arch.target_name(), major, minor)
271271
}
272272

273-
fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]> {
273+
fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
274274
// Apple platforms only officially support macOS as a host for any compilation.
275275
//
276276
// If building for macOS, we go ahead and remove any erroneous environment state
@@ -298,15 +298,9 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
298298
env_remove.push("TVOS_DEPLOYMENT_TARGET".into());
299299
env_remove.into()
300300
} else {
301-
// Otherwise if cross-compiling for a different OS/SDK, remove any part
301+
// Otherwise if cross-compiling for a different OS/SDK (including Mac Catalyst), remove any part
302302
// of the linking environment that's wrong and reversed.
303-
match arch {
304-
Armv7k | Armv7s | Arm64 | Arm64e | Arm64_32 | I386 | I386_sim | I686 | X86_64
305-
| X86_64_sim | X86_64h | Arm64_sim => {
306-
cvs!["MACOSX_DEPLOYMENT_TARGET"]
307-
}
308-
X86_64_macabi | Arm64_macabi => cvs!["IPHONEOS_DEPLOYMENT_TARGET"],
309-
}
303+
cvs!["MACOSX_DEPLOYMENT_TARGET"]
310304
}
311305
}
312306

0 commit comments

Comments
 (0)