Skip to content

Commit fd37722

Browse files
committed
Update llvm-bitcode-linker tests
1 parent c33f908 commit fd37722

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2059,7 +2059,7 @@ impl Step for Assemble {
20592059
trace!("llvm-bitcode-linker enabled, installing");
20602060
let llvm_bitcode_linker =
20612061
builder.ensure(crate::core::build_steps::tool::LlvmBitcodeLinker {
2062-
compiler,
2062+
build_compiler: compiler,
20632063
target: target_compiler.host,
20642064
});
20652065

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2374,7 +2374,8 @@ impl Step for LlvmBitcodeLinker {
23742374

23752375
builder.ensure(compile::Rustc::new(compiler, target));
23762376

2377-
let llbc_linker = builder.ensure(tool::LlvmBitcodeLinker { compiler, target });
2377+
let llbc_linker =
2378+
builder.ensure(tool::LlvmBitcodeLinker { build_compiler: compiler, target });
23782379

23792380
let self_contained_bin_dir = format!("lib/rustlib/{}/bin/self-contained", target.triple);
23802381

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ impl Step for RustAnalyzerProcMacroSrv {
10141014

10151015
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
10161016
pub struct LlvmBitcodeLinker {
1017-
pub compiler: Compiler,
1017+
pub build_compiler: Compiler,
10181018
pub target: TargetSelection,
10191019
}
10201020

@@ -1031,7 +1031,9 @@ impl Step for LlvmBitcodeLinker {
10311031

10321032
fn make_run(run: RunConfig<'_>) {
10331033
run.builder.ensure(LlvmBitcodeLinker {
1034-
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
1034+
build_compiler: run
1035+
.builder
1036+
.compiler(run.builder.top_stage, run.builder.config.host_target),
10351037
target: run.target,
10361038
});
10371039
}
@@ -1042,7 +1044,7 @@ impl Step for LlvmBitcodeLinker {
10421044
)]
10431045
fn run(self, builder: &Builder<'_>) -> ToolBuildResult {
10441046
builder.ensure(ToolBuild {
1045-
compiler: self.compiler,
1047+
compiler: self.build_compiler,
10461048
target: self.target,
10471049
tool: "llvm-bitcode-linker",
10481050
mode: Mode::ToolRustc,
@@ -1054,6 +1056,10 @@ impl Step for LlvmBitcodeLinker {
10541056
artifact_kind: ToolArtifactKind::Binary,
10551057
})
10561058
}
1059+
1060+
fn metadata(&self) -> Option<StepMetadata> {
1061+
Some(StepMetadata::build("LlvmBitcodeLinker", self.target).built_by(self.build_compiler))
1062+
}
10571063
}
10581064

10591065
#[derive(Debug, Clone, Hash, PartialEq, Eq)]

src/bootstrap/src/core/builder/tests.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,27 @@ mod snapshot {
757757
");
758758
}
759759

760+
#[test]
761+
fn build_compiler_tools() {
762+
let ctx = TestCtx::new();
763+
insta::assert_snapshot!(
764+
ctx
765+
.config("build")
766+
.stage(2)
767+
.args(&["--set", "rust.llvm-bitcode-linker=true"])
768+
.render_steps(), @r"
769+
[build] llvm <host>
770+
[build] rustc 0 <host> -> rustc 1 <host>
771+
[build] rustc 1 <host> -> LlvmBitcodeLinker 2 <host>
772+
[build] rustc 1 <host> -> std 1 <host>
773+
[build] rustc 1 <host> -> rustc 2 <host>
774+
[build] rustc 2 <host> -> LlvmBitcodeLinker 3 <host>
775+
[build] rustc 2 <host> -> std 2 <host>
776+
[build] rustdoc 1 <host>
777+
"
778+
);
779+
}
780+
760781
#[test]
761782
fn build_library_no_explicit_stage() {
762783
let ctx = TestCtx::new();
@@ -1040,6 +1061,7 @@ mod snapshot {
10401061
[build] rustc 0 <host> -> cargo-clippy 1 <host>
10411062
[build] rustc 0 <host> -> miri 1 <host>
10421063
[build] rustc 0 <host> -> cargo-miri 1 <host>
1064+
[build] rustc 1 <host> -> LlvmBitcodeLinker 2 <host>
10431065
");
10441066
}
10451067

@@ -1230,6 +1252,7 @@ mod snapshot {
12301252
[build] rustc 0 <host> -> cargo-clippy 1 <target1>
12311253
[build] rustc 0 <host> -> miri 1 <target1>
12321254
[build] rustc 0 <host> -> cargo-miri 1 <target1>
1255+
[build] rustc 1 <host> -> LlvmBitcodeLinker 2 <target1>
12331256
");
12341257
}
12351258

0 commit comments

Comments
 (0)