Skip to content

Commit

Permalink
Unrolled build for rust-lang#130398
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#130398 - ChrisDenton:win-cross, r=jieyouxu

Add system libs for LLVM when cross compiling for Windows

Windows uses "import libraries" to link to system libraries. These are a kind of static lib that are distributed with the Windows SDK and therefore they don't rely on the host. All that matters is you have the right SDK installed for the target.
  • Loading branch information
rust-timer authored Sep 16, 2024
2 parents 39b7669 + 7223fd8 commit 8d97426
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ fn main() {
let mut cmd = Command::new(&llvm_config);
cmd.arg(llvm_link_arg).arg("--libs");

if !is_crossed {
// Don't link system libs if cross-compiling unless targetting Windows.
// 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") {
cmd.arg("--system-libs");
}

Expand Down

0 comments on commit 8d97426

Please sign in to comment.