Skip to content

Commit ab92eca

Browse files
authored
Rollup merge of #91685 - Aaron1011:install-llvm-tools, r=Mark-Simulacrum
Install llvm tools to sysroot when assembling local toolchain Some projects (e.g. the `bootimage` crate) may require the user to install the `llvm-tools-preview` rustup component. However, this cannot be easily done with a locally built toolchain. To allow a local toolchain to be used a drop-in replacement for a normal rustup toolchain in more cases, this PR copies the built LLVM tools to the sysoot. From the perspective a tool looking at the sysroot, this is equivalent to installing `llvm-tools-preview`.
2 parents 8c94b2c + 9bcbc58 commit ab92eca

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: src/bootstrap/compile.rs

+11
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use crate::dist;
2828
use crate::native;
2929
use crate::tool::SourceType;
3030
use crate::util::{exe, is_debug_info, is_dylib, symlink_dir};
31+
use crate::LLVM_TOOLS;
3132
use crate::{Compiler, DependencyType, GitRepo, Mode};
3233

3334
#[derive(Debug, PartialOrd, Ord, Copy, Clone, PartialEq, Eq, Hash)]
@@ -1164,6 +1165,16 @@ impl Step for Assemble {
11641165
let llvm_bin_dir = output(Command::new(llvm_config_bin).arg("--bindir"));
11651166
let llvm_bin_dir = Path::new(llvm_bin_dir.trim());
11661167
builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe));
1168+
1169+
// Since we've already built the LLVM tools, install them to the sysroot.
1170+
// This is the equivalent of installing the `llvm-tools-preview` component via
1171+
// rustup, and lets developers use a locally built toolchain to
1172+
// build projects that expect llvm tools to be present in the sysroot
1173+
// (e.g. the `bootimage` crate).
1174+
for tool in LLVM_TOOLS {
1175+
let tool_exe = exe(tool, target_compiler.host);
1176+
builder.copy(&llvm_bin_dir.join(&tool_exe), &libdir_bin.join(&tool_exe));
1177+
}
11671178
}
11681179
}
11691180

0 commit comments

Comments
 (0)