@@ -22,6 +22,7 @@ use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
22
22
use crate :: cache:: { Interned , INTERNER } ;
23
23
use crate :: channel;
24
24
use crate :: compile;
25
+ use crate :: config:: Target ;
25
26
use crate :: config:: TargetSelection ;
26
27
use crate :: doc:: DocumentationFormat ;
27
28
use crate :: tarball:: { GeneratedTarball , OverlayKind , Tarball } ;
@@ -1890,20 +1891,29 @@ fn add_env(builder: &Builder<'_>, cmd: &mut Command, target: TargetSelection) {
1890
1891
///
1891
1892
/// Returns whether the files were actually copied.
1892
1893
fn maybe_install_llvm ( builder : & Builder < ' _ > , target : TargetSelection , dst_libdir : & Path ) -> bool {
1893
- if !builder. is_rust_llvm ( target) {
1894
- // If the LLVM was externally provided, then we don't currently copy
1895
- // artifacts into the sysroot. This is not necessarily the right
1896
- // choice (in particular, it will require the LLVM dylib to be in
1897
- // the linker's load path at runtime), but the common use case for
1898
- // external LLVMs is distribution provided LLVMs, and in that case
1899
- // they're usually in the standard search path (e.g., /usr/lib) and
1900
- // copying them here is going to cause problems as we may end up
1901
- // with the wrong files and isn't what distributions want.
1902
- //
1903
- // This behavior may be revisited in the future though.
1904
- //
1894
+ // If the LLVM was externally provided, then we don't currently copy
1895
+ // artifacts into the sysroot. This is not necessarily the right
1896
+ // choice (in particular, it will require the LLVM dylib to be in
1897
+ // the linker's load path at runtime), but the common use case for
1898
+ // external LLVMs is distribution provided LLVMs, and in that case
1899
+ // they're usually in the standard search path (e.g., /usr/lib) and
1900
+ // copying them here is going to cause problems as we may end up
1901
+ // with the wrong files and isn't what distributions want.
1902
+ //
1903
+ // This behavior may be revisited in the future though.
1904
+ //
1905
+ // NOTE: this intentionally doesn't use `is_rust_llvm`; whether this is patched or not doesn't matter,
1906
+ // we only care if the shared object itself is managed by bootstrap.
1907
+ let should_install_llvm = match builder. config . target_config . get ( & target) {
1905
1908
// If the LLVM is coming from ourselves (just from CI) though, we
1906
1909
// still want to install it, as it otherwise won't be available.
1910
+ Some ( Target { llvm_config : Some ( _) , .. } ) => {
1911
+ builder. config . llvm_from_ci && target == builder. config . build
1912
+ }
1913
+ Some ( Target { llvm_config : None , .. } ) | None => true ,
1914
+ } ;
1915
+
1916
+ if !should_install_llvm {
1907
1917
return false ;
1908
1918
}
1909
1919
0 commit comments