]> git.lizzy.rs Git - rust.git/commitdiff
Revert "Set MACOSX_DEPLOYMENT_TARGET env var to default for linking if not set."
authorHans Kratz <hans@appfour.com>
Mon, 13 Dec 2021 20:31:48 +0000 (21:31 +0100)
committerHans Kratz <hans@appfour.com>
Mon, 13 Dec 2021 20:31:48 +0000 (21:31 +0100)
This reverts commit b376f5621b801460b911a75048a70698021bbc69, 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.

Fixes #91372.

compiler/rustc_target/src/spec/aarch64_apple_darwin.rs
compiler/rustc_target/src/spec/apple_base.rs
compiler/rustc_target/src/spec/i686_apple_darwin.rs
compiler/rustc_target/src/spec/x86_64_apple_darwin.rs

index 3ffc852d65080c1cfd16a32fd2b172fa929ef01c..f01ff02da072f2bb5c281c403c7dde5ebb858a7c 100644 (file)
@@ -9,7 +9,6 @@ pub fn target() -> Target {
     base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD;
 
     base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]);
-    base.link_env.extend(super::apple_base::macos_link_env("arm64"));
     base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
 
     // Clang automatically chooses a more specific target based on
index ba8f9a8ce11607fcc04629a97b9ccf45e0aaabda..db6aee59a5dd30cece69887ca7cb238285fd9384 100644 (file)
@@ -79,18 +79,6 @@ pub fn macos_llvm_target(arch: &str) -> String {
     format!("{}-apple-macosx{}.{}.0", arch, major, minor)
 }
 
-pub fn macos_link_env(arch: &str) -> Vec<(String, String)> {
-    // Use the default deployment target for linking just as with the LLVM target if not
-    // specified via MACOSX_DEPLOYMENT_TARGET, otherwise the system linker would use its
-    // default which varies with Xcode version.
-    if env::var("MACOSX_DEPLOYMENT_TARGET").is_err() {
-        let default = macos_default_deployment_target(arch);
-        vec![("MACOSX_DEPLOYMENT_TARGET".to_string(), format!("{}.{}", default.0, default.1))]
-    } else {
-        vec![]
-    }
-}
-
 pub fn macos_link_env_remove() -> Vec<String> {
     let mut env_remove = Vec::with_capacity(2);
     // Remove the `SDKROOT` environment variable if it's clearly set for the wrong platform, which
index 05217c09aedd0dca102e295f2b4472712c86d05b..f2635f0656d7a738445df4d41d1dda6302f935ed 100644 (file)
@@ -5,7 +5,6 @@ pub fn target() -> Target {
     base.cpu = "yonah".to_string();
     base.max_atomic_width = Some(64);
     base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".to_string()]);
-    base.link_env.extend(super::apple_base::macos_link_env("i686"));
     base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
     // don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
     base.stack_probes = StackProbeType::Call;
index 3e20cb0b272ce8a682509b5e81a7909cf6f9828a..22fdaabfcb89b68821fde9b65c7a137c2b1439ba 100644 (file)
@@ -10,7 +10,6 @@ pub fn target() -> Target {
         LinkerFlavor::Gcc,
         vec!["-m64".to_string(), "-arch".to_string(), "x86_64".to_string()],
     );
-    base.link_env.extend(super::apple_base::macos_link_env("x86_64"));
     base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
     // don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
     base.stack_probes = StackProbeType::Call;