bootstrap: copy llvm-dwp to sysroot

`llvm-dwp` is required for linking the DWARF objects into DWARF packages
when using Split DWARF, especially given that rustc produces multiple
DWARF objects (one for each codegen unit).

Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
David Wood 2020-10-14 18:16:05 +01:00
parent 6890312ea3
commit 241160de72
No known key found for this signature in database
GPG key ID: 2592E76C87381FD9
2 changed files with 24 additions and 11 deletions

View file

@ -969,15 +969,25 @@ impl Step for Assemble {
copy_codegen_backends_to_sysroot(builder, build_compiler, target_compiler);
// We prepend this bin directory to the user PATH when linking Rust binaries. To
// avoid shadowing the system LLD we rename the LLD we provide to `rust-lld`.
let libdir = builder.sysroot_libdir(target_compiler, target_compiler.host);
let libdir_bin = libdir.parent().unwrap().join("bin");
t!(fs::create_dir_all(&libdir_bin));
if let Some(lld_install) = lld_install {
let src_exe = exe("lld", target_compiler.host);
let dst_exe = exe("rust-lld", target_compiler.host);
// we prepend this bin directory to the user PATH when linking Rust binaries. To
// avoid shadowing the system LLD we rename the LLD we provide to `rust-lld`.
let dst = libdir.parent().unwrap().join("bin");
t!(fs::create_dir_all(&dst));
builder.copy(&lld_install.join("bin").join(&src_exe), &dst.join(&dst_exe));
builder.copy(&lld_install.join("bin").join(&src_exe), &libdir_bin.join(&dst_exe));
}
// Similarly, copy `llvm-dwp` into libdir for Split DWARF.
{
let src_exe = exe("llvm-dwp", target_compiler.host);
let dst_exe = exe("rust-llvm-dwp", target_compiler.host);
let llvm_config_bin = builder.ensure(native::Llvm { target: target_compiler.host });
let llvm_bin_dir = llvm_config_bin.parent().unwrap();
builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe));
}
// Ensure that `libLLVM.so` ends up in the newly build compiler directory,

View file

@ -523,17 +523,20 @@ impl Step for Rustc {
// component for now.
maybe_install_llvm_runtime(builder, host, image);
let src_dir = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin");
let dst_dir = image.join("lib/rustlib").join(&*host.triple).join("bin");
t!(fs::create_dir_all(&dst_dir));
// Copy over lld if it's there
if builder.config.lld_enabled {
let exe = exe("rust-lld", compiler.host);
let src =
builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin").join(&exe);
// for the rationale about this rename check `compile::copy_lld_to_sysroot`
let dst = image.join("lib/rustlib").join(&*host.triple).join("bin").join(&exe);
t!(fs::create_dir_all(&dst.parent().unwrap()));
builder.copy(&src, &dst);
builder.copy(&src_dir.join(&exe), &dst_dir.join(&exe));
}
// Copy over llvm-dwp if it's there
let exe = exe("rust-llvm-dwp", compiler.host);
builder.copy(&src_dir.join(&exe), &dst_dir.join(&exe));
// Man pages
t!(fs::create_dir_all(image.join("share/man/man1")));
let man_src = builder.src.join("src/doc/man");