Simplify implementation of -Z gcc-ld
- The logic is now unified for all targets (wasm targets should also be supported now) - Additional "symlink" files like `ld64` are eliminated - lld-wrapper is used for propagating the correct lld flavor - Cleanup "unwrap or exit" logic in lld-wrapper
This commit is contained in:
parent
1b5e1215ef
commit
2984bf674f
8 changed files with 71 additions and 122 deletions
|
|
@ -1164,14 +1164,11 @@ impl Step for Assemble {
|
|||
// for `-Z gcc-ld=lld`
|
||||
let gcc_ld_dir = libdir_bin.join("gcc-ld");
|
||||
t!(fs::create_dir(&gcc_ld_dir));
|
||||
for flavor in ["ld", "ld64"] {
|
||||
let lld_wrapper_exe = builder.ensure(crate::tool::LldWrapper {
|
||||
compiler: build_compiler,
|
||||
target: target_compiler.host,
|
||||
flavor_feature: flavor,
|
||||
});
|
||||
builder.copy(&lld_wrapper_exe, &gcc_ld_dir.join(exe(flavor, target_compiler.host)));
|
||||
}
|
||||
let lld_wrapper_exe = builder.ensure(crate::tool::LldWrapper {
|
||||
compiler: build_compiler,
|
||||
target: target_compiler.host,
|
||||
});
|
||||
builder.copy(&lld_wrapper_exe, &gcc_ld_dir.join(exe("ld", target_compiler.host)));
|
||||
}
|
||||
|
||||
if builder.config.rust_codegen_backends.contains(&INTERNER.intern_str("llvm")) {
|
||||
|
|
|
|||
|
|
@ -407,11 +407,8 @@ impl Step for Rustc {
|
|||
let gcc_lld_src_dir = src_dir.join("gcc-ld");
|
||||
let gcc_lld_dst_dir = dst_dir.join("gcc-ld");
|
||||
t!(fs::create_dir(&gcc_lld_dst_dir));
|
||||
for flavor in ["ld", "ld64"] {
|
||||
let exe_name = exe(flavor, compiler.host);
|
||||
builder
|
||||
.copy(&gcc_lld_src_dir.join(&exe_name), &gcc_lld_dst_dir.join(&exe_name));
|
||||
}
|
||||
let exe_name = exe("ld", compiler.host);
|
||||
builder.copy(&gcc_lld_src_dir.join(&exe_name), &gcc_lld_dst_dir.join(&exe_name));
|
||||
}
|
||||
|
||||
// Man pages
|
||||
|
|
|
|||
|
|
@ -656,7 +656,6 @@ impl Step for Cargo {
|
|||
pub struct LldWrapper {
|
||||
pub compiler: Compiler,
|
||||
pub target: TargetSelection,
|
||||
pub flavor_feature: &'static str,
|
||||
}
|
||||
|
||||
impl Step for LldWrapper {
|
||||
|
|
@ -676,7 +675,7 @@ impl Step for LldWrapper {
|
|||
path: "src/tools/lld-wrapper",
|
||||
is_optional_tool: false,
|
||||
source_type: SourceType::InTree,
|
||||
extra_features: vec![self.flavor_feature.to_owned()],
|
||||
extra_features: Vec::new(),
|
||||
})
|
||||
.expect("expected to build -- essential tool");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue