@@ -25,6 +25,7 @@ use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
2525use crate :: cache:: { Interned , INTERNER } ;
2626use crate :: channel;
2727use crate :: compile;
28+ use crate :: config:: Target ;
2829use crate :: config:: TargetSelection ;
2930use crate :: doc:: DocumentationFormat ;
3031use crate :: llvm;
@@ -1964,20 +1965,29 @@ fn install_llvm_file(builder: &Builder<'_>, source: &Path, destination: &Path) {
19641965///
19651966/// Returns whether the files were actually copied.
19661967fn maybe_install_llvm ( builder : & Builder < ' _ > , target : TargetSelection , dst_libdir : & Path ) -> bool {
1967- if !builder. is_rust_llvm ( target) {
1968- // If the LLVM was externally provided, then we don't currently copy
1969- // artifacts into the sysroot. This is not necessarily the right
1970- // choice (in particular, it will require the LLVM dylib to be in
1971- // the linker's load path at runtime), but the common use case for
1972- // external LLVMs is distribution provided LLVMs, and in that case
1973- // they're usually in the standard search path (e.g., /usr/lib) and
1974- // copying them here is going to cause problems as we may end up
1975- // with the wrong files and isn't what distributions want.
1976- //
1977- // This behavior may be revisited in the future though.
1978- //
1968+ // If the LLVM was externally provided, then we don't currently copy
1969+ // artifacts into the sysroot. This is not necessarily the right
1970+ // choice (in particular, it will require the LLVM dylib to be in
1971+ // the linker's load path at runtime), but the common use case for
1972+ // external LLVMs is distribution provided LLVMs, and in that case
1973+ // they're usually in the standard search path (e.g., /usr/lib) and
1974+ // copying them here is going to cause problems as we may end up
1975+ // with the wrong files and isn't what distributions want.
1976+ //
1977+ // This behavior may be revisited in the future though.
1978+ //
1979+ // NOTE: this intentionally doesn't use `is_rust_llvm`; whether this is patched or not doesn't matter,
1980+ // we only care if the shared object itself is managed by bootstrap.
1981+ let should_install_llvm = match builder. config . target_config . get ( & target) {
19791982 // If the LLVM is coming from ourselves (just from CI) though, we
19801983 // still want to install it, as it otherwise won't be available.
1984+ Some ( Target { llvm_config : Some ( _) , .. } ) => {
1985+ builder. config . llvm_from_ci && target == builder. config . build
1986+ }
1987+ Some ( Target { llvm_config : None , .. } ) | None => true ,
1988+ } ;
1989+
1990+ if !should_install_llvm {
19811991 return false ;
19821992 }
19831993
0 commit comments