1
Fork 0

Set link-shared if LLVM ThinLTO is enabled in config.rs

This avoids missing a shared build when uplifting LLVM artifacts into the
sysroot. We were already producing a shared link anyway, though, so this is not
a visible change from the end user's perspective.
This commit is contained in:
Mark Rousskov 2020-09-12 15:10:13 -04:00
parent a7b092f418
commit 2e87a6e78d
2 changed files with 8 additions and 1 deletions

View file

@ -593,7 +593,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
let file = compiler_file(builder, builder.cxx(target).unwrap(), target, "libstdc++.a");
cargo.env("LLVM_STATIC_STDCPP", file);
}
if builder.config.llvm_link_shared || builder.config.llvm_thin_lto {
if builder.config.llvm_link_shared {
cargo.env("LLVM_LINK_SHARED", "1");
}
if builder.config.llvm_use_libcxx {

View file

@ -667,6 +667,13 @@ impl Config {
// CI-built LLVM is shared
config.llvm_link_shared = true;
}
if config.llvm_thin_lto {
// If we're building with ThinLTO on, we want to link to LLVM
// shared, to avoid re-doing ThinLTO (which happens in the link
// step) with each stage.
config.llvm_link_shared = true;
}
}
if let Some(ref rust) = toml.rust {