Skip to content

Commit 3985715

Browse files
committed
bootstrap: include llvm-objcopy in dist
1 parent 484c8e7 commit 3985715

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

Diff for: src/bootstrap/src/core/build_steps/compile.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,7 @@ impl Step for Std {
235235
.join(compiler.host)
236236
.join("bin");
237237
if src_sysroot_bin.exists() {
238-
let target_sysroot_bin =
239-
builder.sysroot_libdir(compiler, target).parent().unwrap().join("bin");
238+
let target_sysroot_bin = builder.sysroot_bindir(compiler, target);
240239
t!(fs::create_dir_all(&target_sysroot_bin));
241240
builder.cp_link_r(&src_sysroot_bin, &target_sysroot_bin);
242241
}
@@ -1976,6 +1975,14 @@ impl Step for Assemble {
19761975
}
19771976
}
19781977

1978+
{
1979+
// `llvm-strip` is used by rustc, which is actually just a symlink to `llvm-objcopy`,
1980+
// so copy and rename `llvm-objcopy`.
1981+
let src_exe = exe("llvm-objcopy", target_compiler.host);
1982+
let dst_exe = exe("rust-objcopy", target_compiler.host);
1983+
builder.copy_link(&libdir_bin.join(src_exe), &libdir_bin.join(dst_exe));
1984+
}
1985+
19791986
// In addition to `rust-lld` also install `wasm-component-ld` when
19801987
// LLD is enabled. This is a relatively small binary that primarily
19811988
// delegates to the `rust-lld` binary for linking and then runs

Diff for: src/bootstrap/src/core/build_steps/dist.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ impl Step for Rustc {
459459

460460
// Copy over lld if it's there
461461
if builder.config.lld_enabled {
462-
let src_dir = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin");
462+
let src_dir = builder.sysroot_bindir(compiler, host);
463463
let rust_lld = exe("rust-lld", compiler.host);
464464
builder.copy_link(&src_dir.join(&rust_lld), &dst_dir.join(&rust_lld));
465465
let self_contained_lld_src_dir = src_dir.join("gcc-ld");
@@ -473,8 +473,16 @@ impl Step for Rustc {
473473
);
474474
}
475475
}
476+
477+
{
478+
let src_dir = builder.sysroot_bindir(compiler, host);
479+
let llvm_objcopy = exe("llvm-objcopy", compiler.host);
480+
let rust_objcopy = exe("rust-objcopy", compiler.host);
481+
builder.copy_link(&src_dir.join(&llvm_objcopy), &dst_dir.join(&rust_objcopy));
482+
}
483+
476484
if builder.tool_enabled("wasm-component-ld") {
477-
let src_dir = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin");
485+
let src_dir = builder.sysroot_bindir(compiler, host);
478486
let ld = exe("wasm-component-ld", compiler.host);
479487
builder.copy_link(&src_dir.join(&ld), &dst_dir.join(&ld));
480488
}

Diff for: src/bootstrap/src/core/builder.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,11 @@ impl<'a> Builder<'a> {
11601160
self.ensure(compile::Sysroot::new(compiler))
11611161
}
11621162

1163+
/// Returns the bindir for a compiler's sysroot.
1164+
pub fn sysroot_bindir(&self, compiler: Compiler, target: TargetSelection) -> PathBuf {
1165+
self.sysroot_libdir(compiler, target).parent().unwrap().join("bin")
1166+
}
1167+
11631168
/// Returns the libdir where the standard library and other artifacts are
11641169
/// found for a compiler's sysroot.
11651170
pub fn sysroot_libdir(&self, compiler: Compiler, target: TargetSelection) -> PathBuf {

0 commit comments

Comments
 (0)