Skip to content

Commit 2f270e4

Browse files
authored
Rollup merge of #91870 - rusticstuff:macosx_min_version_revert, r=Mark-Simulacrum
Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking This reverts commit b376f56, which is the main part of #90499, because it turns out that this causes a good amount of breakage in crates relying on the old behavior. In particular `winit`, `coreaudio` and crates that depend on them are affected. Fixes #91372. Background: Before #90499 the behavior was the following: If MACOSX_DEPLOYMENT_TARGET is not set, we pass the minimum supported OS version to LLVM but not to the linker. The linker default depends on the Xcode version and the version of the OS it is running on. That caused one known problem in libcurl with the most recent Xcode versions. #90499 passed the minumum supported version (10.7 for Macos x86-64) to the linker instead. This has shown to be problematic because some crates such as winit, coreaudio implicitly expect a newer minimum OS version. The libcurl issue has been fixed independently (see alexcrichton/curl-rust#417), so a revert should not really be problematic. Eventually we should probably mimic clang's behavior and fall back to the default of the currently configured Macos SDK for both the LLVM min os target version and MACOSX_DEPLOYMENT_TARGET for linking. That would entail looking at the `Version` property of the `SDKSettings.json` in the currently configured SDK.
2 parents ccfc22b + 3011154 commit 2f270e4

File tree

4 files changed

+0
-15
lines changed

4 files changed

+0
-15
lines changed

compiler/rustc_target/src/spec/aarch64_apple_darwin.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub fn target() -> Target {
99
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD;
1010

1111
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]);
12-
base.link_env.extend(super::apple_base::macos_link_env("arm64"));
1312
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
1413

1514
// Clang automatically chooses a more specific target based on

compiler/rustc_target/src/spec/apple_base.rs

-12
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,6 @@ pub fn macos_llvm_target(arch: &str) -> String {
7979
format!("{}-apple-macosx{}.{}.0", arch, major, minor)
8080
}
8181

82-
pub fn macos_link_env(arch: &str) -> Vec<(String, String)> {
83-
// Use the default deployment target for linking just as with the LLVM target if not
84-
// specified via MACOSX_DEPLOYMENT_TARGET, otherwise the system linker would use its
85-
// default which varies with Xcode version.
86-
if env::var("MACOSX_DEPLOYMENT_TARGET").is_err() {
87-
let default = macos_default_deployment_target(arch);
88-
vec![("MACOSX_DEPLOYMENT_TARGET".to_string(), format!("{}.{}", default.0, default.1))]
89-
} else {
90-
vec![]
91-
}
92-
}
93-
9482
pub fn macos_link_env_remove() -> Vec<String> {
9583
let mut env_remove = Vec::with_capacity(2);
9684
// Remove the `SDKROOT` environment variable if it's clearly set for the wrong platform, which

compiler/rustc_target/src/spec/i686_apple_darwin.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pub fn target() -> Target {
55
base.cpu = "yonah".to_string();
66
base.max_atomic_width = Some(64);
77
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".to_string()]);
8-
base.link_env.extend(super::apple_base::macos_link_env("i686"));
98
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
109
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
1110
base.stack_probes = StackProbeType::Call;

compiler/rustc_target/src/spec/x86_64_apple_darwin.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub fn target() -> Target {
1010
LinkerFlavor::Gcc,
1111
vec!["-m64".to_string(), "-arch".to_string(), "x86_64".to_string()],
1212
);
13-
base.link_env.extend(super::apple_base::macos_link_env("x86_64"));
1413
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
1514
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
1615
base.stack_probes = StackProbeType::Call;

0 commit comments

Comments
 (0)