diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index a662694ac38f2..9a6549379d39c 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"); }