Skip to content

Commit 3011154

Browse files
committed
Revert "Set MACOSX_DEPLOYMENT_TARGET env var to default for linking if not set."
This reverts commit b376f56, which is the main part of rust-lang#90499, because it turns out that this causes a good amount of breakage in crates relying on the old behavior. Fixes rust-lang#91372.
1 parent 1796de7 commit 3011154

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)