Skip to content

Commit

Permalink
Only copy, rename and link llvm-objcopy if llvm tools are enabled
Browse files Browse the repository at this point in the history
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
  • Loading branch information
jieyouxu and bjorn3 committed Nov 7, 2024
1 parent 9200cbc commit cf9cec3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1976,9 +1976,13 @@ impl Step for Assemble {
}
}

{
// `llvm-strip` is used by rustc, which is actually just a symlink to `llvm-objcopy`,
// so copy and rename `llvm-objcopy`.
if builder.config.llvm_enabled(target_compiler.host) && builder.config.llvm_tools_enabled {
// `llvm-strip` is used by rustc, which is actually just a symlink to `llvm-objcopy`, so
// copy and rename `llvm-objcopy`.
//
// But only do so if llvm-tools are enabled, as bootstrap compiler might not contain any
// LLVM tools, e.g. for cg_clif.
// See <https://github.com/rust-lang/rust/issues/132719>.
let src_exe = exe("llvm-objcopy", target_compiler.host);
let dst_exe = exe("rust-objcopy", target_compiler.host);
builder.copy_link(&libdir_bin.join(src_exe), &libdir_bin.join(dst_exe));
Expand Down

0 comments on commit cf9cec3

Please sign in to comment.