Skip to content

Commit 2681a74

Browse files
KobzolFractalFir
authored andcommitted
Remove sysroot copy from LlvmBitcodeLinker step
That step should be responsible for building the tool, not performing side-effects. Also, only copy the tool to the `self-contained` directory, not to the `rustlib/<target>/bin` directory.
1 parent d5fc97b commit 2681a74

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2060,10 +2060,17 @@ impl Step for Assemble {
20602060
compiler,
20612061
target: target_compiler.host,
20622062
});
2063+
2064+
// Copy the llvm-bitcode-linker to the self-contained binary directory
2065+
let bindir_self_contained = builder
2066+
.sysroot(compiler)
2067+
.join(format!("lib/rustlib/{}/bin/self-contained", compiler.host));
20632068
let tool_exe = exe("llvm-bitcode-linker", target_compiler.host);
2069+
2070+
t!(fs::create_dir_all(&bindir_self_contained));
20642071
builder.copy_link(
20652072
&llvm_bitcode_linker.tool_path,
2066-
&libdir_bin.join(tool_exe),
2073+
&bindir_self_contained.join(tool_exe),
20672074
FileType::Executable,
20682075
);
20692076
}

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ impl Step for LlvmBitcodeLinker {
10411041
instrument(level = "debug", name = "LlvmBitcodeLinker::run", skip_all)
10421042
)]
10431043
fn run(self, builder: &Builder<'_>) -> ToolBuildResult {
1044-
let tool_result = builder.ensure(ToolBuild {
1044+
builder.ensure(ToolBuild {
10451045
compiler: self.compiler,
10461046
target: self.target,
10471047
tool: "llvm-bitcode-linker",
@@ -1052,24 +1052,7 @@ impl Step for LlvmBitcodeLinker {
10521052
allow_features: "",
10531053
cargo_args: Vec::new(),
10541054
artifact_kind: ToolArtifactKind::Binary,
1055-
});
1056-
1057-
if tool_result.target_compiler.stage > 0 {
1058-
let bindir_self_contained = builder
1059-
.sysroot(tool_result.target_compiler)
1060-
.join(format!("lib/rustlib/{}/bin/self-contained", self.target.triple));
1061-
t!(fs::create_dir_all(&bindir_self_contained));
1062-
let bin_destination = bindir_self_contained
1063-
.join(exe("llvm-bitcode-linker", tool_result.target_compiler.host));
1064-
builder.copy_link(&tool_result.tool_path, &bin_destination, FileType::Executable);
1065-
ToolBuildResult {
1066-
tool_path: bin_destination,
1067-
build_compiler: tool_result.build_compiler,
1068-
target_compiler: tool_result.target_compiler,
1069-
}
1070-
} else {
1071-
tool_result
1072-
}
1055+
})
10731056
}
10741057
}
10751058

0 commit comments

Comments
 (0)