Skip to content

Commit 2e87a6e

Browse files
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.
1 parent a7b092f commit 2e87a6e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/bootstrap/compile.rs

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

src/bootstrap/config.rs

+7
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,13 @@ impl Config {
667667
// CI-built LLVM is shared
668668
config.llvm_link_shared = true;
669669
}
670+
671+
if config.llvm_thin_lto {
672+
// If we're building with ThinLTO on, we want to link to LLVM
673+
// shared, to avoid re-doing ThinLTO (which happens in the link
674+
// step) with each stage.
675+
config.llvm_link_shared = true;
676+
}
670677
}
671678

672679
if let Some(ref rust) = toml.rust {

0 commit comments

Comments
 (0)