about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMateusz Mikuła <oss@mateuszmikula.dev>2025-04-27 13:10:06 +0200
committerMateusz Mikuła <oss@mateuszmikula.dev>2025-05-31 15:47:14 +0200
commit81f61acf77b539af47291f23d5eb2617878a3e2a (patch)
tree58fab4b79bc86f57b7537bc6edb5d8bd58bc41c9
parente0d014a3dffbb3f0575cfbeb0f480c5080c4d018 (diff)
downloadrust-81f61acf77b539af47291f23d5eb2617878a3e2a.tar.gz
rust-81f61acf77b539af47291f23d5eb2617878a3e2a.zip
rustc_llvm: add Windows system libs only when cross-compiling from Windows
This obviously doesn't work when cross-compiling from Linux.

Split out from: https://github.com/rust-lang/rust/pull/140772
-rw-r--r--compiler/rustc_llvm/build.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index a662694ac38..9a6549379d3 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -228,10 +228,10 @@ fn main() {
     let mut cmd = Command::new(&llvm_config);
     cmd.arg(llvm_link_arg).arg("--libs");
 
-    // Don't link system libs if cross-compiling unless targeting Windows.
+    // Don't link system libs if cross-compiling unless targeting Windows from Windows host.
     // On Windows system DLLs aren't linked directly, instead import libraries are used.
     // These import libraries are independent of the host.
-    if !is_crossed || target.contains("windows") {
+    if !is_crossed || target.contains("windows") && host.contains("windows") {
         cmd.arg("--system-libs");
     }