Rollup merge of #86740 - 1000teslas:issue-71519-fix, r=petrochenkov

copy rust-lld as ld in dist

Fixes bug in https://github.com/rust-lang/rust/pull/85961. Linking seems to work for pure Rust projects, but not when a C library needs to be dynamically linked.
This commit is contained in:
Yuki Okushi 2021-07-01 05:20:59 +09:00 committed by GitHub
commit e52a0ec5b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -400,12 +400,12 @@ fn prepare_image(builder: &Builder<'_>, compiler: Compiler, image: &Path) {
// Copy over lld if it's there // Copy over lld if it's there
if builder.config.lld_enabled { if builder.config.lld_enabled {
let exe = exe("rust-lld", compiler.host); let rust_lld = exe("rust-lld", compiler.host);
builder.copy(&src_dir.join(&exe), &dst_dir.join(&exe)); builder.copy(&src_dir.join(&rust_lld), &dst_dir.join(&rust_lld));
// for `-Z gcc-ld=lld` // for `-Z gcc-ld=lld`
let gcc_lld_dir = dst_dir.join("gcc-ld"); let gcc_lld_dir = dst_dir.join("gcc-ld");
t!(fs::create_dir(&gcc_lld_dir)); t!(fs::create_dir(&gcc_lld_dir));
builder.copy(&src_dir.join(&exe), &gcc_lld_dir.join(&exe)); builder.copy(&src_dir.join(&rust_lld), &gcc_lld_dir.join(exe("ld", compiler.host)));
} }
// Copy over llvm-dwp if it's there // Copy over llvm-dwp if it's there