Rollup merge of #141819 - mati865:windows-gnullvm-host-fixes, r=jieyouxu

Fixes for building windows-gnullvm hosts

Split out from: https://github.com/rust-lang/rust/pull/140772
This commit is contained in:
Matthias Krüger
2025-05-31 18:51:51 +02:00
committed by GitHub
2 changed files with 6 additions and 3 deletions
@@ -1409,7 +1409,7 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect
cargo.env("LLVM_LINKER_FLAGS", llvm_linker_flags);
}
// Building with a static libstdc++ is only supported on linux right now,
// Building with a static libstdc++ is only supported on Linux and windows-gnu* right now,
// not for MSVC or macOS
if builder.config.llvm_static_stdcpp
&& !target.contains("freebsd")
@@ -1417,12 +1417,14 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect
&& !target.contains("apple")
&& !target.contains("solaris")
{
let libstdcxx_name =
if target.contains("windows-gnullvm") { "libc++.a" } else { "libstdc++.a" };
let file = compiler_file(
builder,
&builder.cxx(target).unwrap(),
target,
CLang::Cxx,
"libstdc++.a",
libstdcxx_name,
);
cargo.env("LLVM_STATIC_STDCPP", file);
}
+2 -1
View File
@@ -285,7 +285,8 @@ fn run(self, builder: &Builder<'_>) -> LlvmResult {
LlvmBuildStatus::ShouldBuild(m) => m,
};
if builder.llvm_link_shared() && target.is_windows() {
if builder.llvm_link_shared() && target.is_windows() && !target.ends_with("windows-gnullvm")
{
panic!("shared linking to LLVM is not currently supported on {}", target.triple);
}