]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/native.rs
Rollup merge of #93755 - ChayimFriedman2:allow-comparing-vecs-with-different-allocato...
[rust.git] / src / bootstrap / native.rs
index f00c5ce5aa6f03fff9885a022260c1d4df076014..6d7ca9a94cfbde9432fcff3e52c30dc7e435a125 100644 (file)
@@ -259,18 +259,6 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
             cfg.define("LLVM_LINK_LLVM_DYLIB", "ON");
         }
 
-        // For distribution we want the LLVM tools to be *statically* linked to libstdc++.
-        // We also do this if the user explicitly requested static libstdc++.
-        if builder.config.llvm_tools_enabled || builder.config.llvm_static_stdcpp {
-            if !target.contains("msvc") && !target.contains("netbsd") {
-                if target.contains("apple") {
-                    ldflags.push_all("-static-libstdc++");
-                } else {
-                    ldflags.push_all("-Wl,-Bsymbolic -static-libstdc++");
-                }
-            }
-        }
-
         if target.starts_with("riscv") && !target.contains("freebsd") {
             // RISC-V GCC erroneously requires linking against
             // `libatomic` when using 1-byte and 2-byte C++
@@ -576,6 +564,18 @@ fn configure_cmake(
         ldflags.push_all(&flags);
     }
 
+    // For distribution we want the LLVM tools to be *statically* linked to libstdc++.
+    // We also do this if the user explicitly requested static libstdc++.
+    if builder.config.llvm_static_stdcpp {
+        if !target.contains("msvc") && !target.contains("netbsd") {
+            if target.contains("apple") || target.contains("windows") {
+                ldflags.push_all("-static-libstdc++");
+            } else {
+                ldflags.push_all("-Wl,-Bsymbolic -static-libstdc++");
+            }
+        }
+    }
+
     cfg.define("CMAKE_SHARED_LINKER_FLAGS", &ldflags.shared);
     cfg.define("CMAKE_MODULE_LINKER_FLAGS", &ldflags.module);
     cfg.define("CMAKE_EXE_LINKER_FLAGS", &ldflags.exe);