Skip to content

Commit 6178c6d

Browse files
committed
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 9ed5fba commit 6178c6d

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
@@ -2032,10 +2032,17 @@ impl Step for Assemble {
20322032
compiler,
20332033
target: target_compiler.host,
20342034
});
2035+
2036+
// Copy the llvm-bitcode-linker to the self-contained binary directory
2037+
let bindir_self_contained = builder
2038+
.sysroot(compiler)
2039+
.join(format!("lib/rustlib/{}/bin/self-contained", compiler.host));
20352040
let tool_exe = exe("llvm-bitcode-linker", target_compiler.host);
2041+
2042+
t!(fs::create_dir_all(&bindir_self_contained));
20362043
builder.copy_link(
20372044
&llvm_bitcode_linker.tool_path,
2038-
&libdir_bin.join(tool_exe),
2045+
&bindir_self_contained.join(tool_exe),
20392046
FileType::Executable,
20402047
);
20412048
}

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

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ impl Step for LlvmBitcodeLinker {
10121012
instrument(level = "debug", name = "LlvmBitcodeLinker::run", skip_all)
10131013
)]
10141014
fn run(self, builder: &Builder<'_>) -> ToolBuildResult {
1015-
let tool_result = builder.ensure(ToolBuild {
1015+
builder.ensure(ToolBuild {
10161016
compiler: self.compiler,
10171017
target: self.target,
10181018
tool: "llvm-bitcode-linker",
@@ -1023,24 +1023,7 @@ impl Step for LlvmBitcodeLinker {
10231023
allow_features: "",
10241024
cargo_args: Vec::new(),
10251025
artifact_kind: ToolArtifactKind::Binary,
1026-
});
1027-
1028-
if tool_result.target_compiler.stage > 0 {
1029-
let bindir_self_contained = builder
1030-
.sysroot(tool_result.target_compiler)
1031-
.join(format!("lib/rustlib/{}/bin/self-contained", self.target.triple));
1032-
t!(fs::create_dir_all(&bindir_self_contained));
1033-
let bin_destination = bindir_self_contained
1034-
.join(exe("llvm-bitcode-linker", tool_result.target_compiler.host));
1035-
builder.copy_link(&tool_result.tool_path, &bin_destination, FileType::Executable);
1036-
ToolBuildResult {
1037-
tool_path: bin_destination,
1038-
build_compiler: tool_result.build_compiler,
1039-
target_compiler: tool_result.target_compiler,
1040-
}
1041-
} else {
1042-
tool_result
1043-
}
1026+
})
10441027
}
10451028
}
10461029

0 commit comments

Comments
 (0)