From be4a936e252efb821ad30a30b59ba4ef1450097a Mon Sep 17 00:00:00 2001
From: Matt Jolly <kangie@gentoo.org>
Date: Tue, 29 Jul 2025 13:05:54 +1000
Subject: [PATCH 1/2] compiler: link with system libs unconditionally

See-also: https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22
See-also: https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497
Signed-off-by: Matt Jolly <kangie@gentoo.org>
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -228,12 +228,8 @@ 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 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") && host.contains("windows") {
-        cmd.arg("--system-libs");
-    }
+    // Link against system libs
+    cmd.arg("--system-libs");
 
     // We need libkstat for getHostCPUName on SPARC builds.
     // See also: https://github.com/llvm/llvm-project/issues/64186
-- 
2.50.1

