Skip to content

Commit c33f908

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 754d46e commit c33f908

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
@@ -2062,10 +2062,17 @@ impl Step for Assemble {
20622062
compiler,
20632063
target: target_compiler.host,
20642064
});
2065+
2066+
// Copy the llvm-bitcode-linker to the self-contained binary directory
2067+
let bindir_self_contained = builder
2068+
.sysroot(compiler)
2069+
.join(format!("lib/rustlib/{}/bin/self-contained", compiler.host));
20652070
let tool_exe = exe("llvm-bitcode-linker", target_compiler.host);
2071+
2072+
t!(fs::create_dir_all(&bindir_self_contained));
20662073
builder.copy_link(
20672074
&llvm_bitcode_linker.tool_path,
2068-
&libdir_bin.join(tool_exe),
2075+
&bindir_self_contained.join(tool_exe),
20692076
FileType::Executable,
20702077
);
20712078
}

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)