Skip to content

Commit 7a20ab0

Browse files
committed
Remove compiler_for from test::CodegenGCC
1 parent 6841177 commit 7a20ab0

File tree

1 file changed

+31
-51
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+31
-51
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 31 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3547,7 +3547,7 @@ impl Step for CodegenCranelift {
35473547

35483548
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
35493549
pub struct CodegenGCC {
3550-
compiler: Compiler,
3550+
compilers: RustcPrivateCompilers,
35513551
target: TargetSelection,
35523552
}
35533553

@@ -3563,7 +3563,7 @@ impl Step for CodegenGCC {
35633563
fn make_run(run: RunConfig<'_>) {
35643564
let builder = run.builder;
35653565
let host = run.build_triple();
3566-
let compiler = run.builder.compiler_for(run.builder.top_stage, host, host);
3566+
let compilers = RustcPrivateCompilers::new(run.builder, run.builder.top_stage, host);
35673567

35683568
if builder.doc_tests == DocTests::Only {
35693569
return;
@@ -3592,68 +3592,41 @@ impl Step for CodegenGCC {
35923592
return;
35933593
}
35943594

3595-
builder.ensure(CodegenGCC { compiler, target: run.target });
3595+
builder.ensure(CodegenGCC { compilers, target: run.target });
35963596
}
35973597

35983598
fn run(self, builder: &Builder<'_>) {
3599-
let compiler = self.compiler;
3599+
let compilers = self.compilers;
36003600
let target = self.target;
36013601

36023602
let gcc = builder.ensure(Gcc { target });
36033603

36043604
builder.ensure(
3605-
compile::Std::new(compiler, target)
3605+
compile::Std::new(compilers.build_compiler(), target)
36063606
.extra_rust_args(&["-Csymbol-mangling-version=v0", "-Cpanic=abort"]),
36073607
);
36083608

3609-
// If we're not doing a full bootstrap but we're testing a stage2
3610-
// version of libstd, then what we're actually testing is the libstd
3611-
// produced in stage1. Reflect that here by updating the compiler that
3612-
// we're working with automatically.
3613-
let compiler = builder.compiler_for(compiler.stage, compiler.host, target);
3614-
3615-
let build_cargo = || {
3616-
let mut cargo = builder::Cargo::new(
3617-
builder,
3618-
compiler,
3619-
Mode::Codegen, // Must be codegen to ensure dlopen on compiled dylibs works
3620-
SourceType::InTree,
3621-
target,
3622-
Kind::Run,
3623-
);
3624-
3625-
cargo.current_dir(&builder.src.join("compiler/rustc_codegen_gcc"));
3626-
cargo
3627-
.arg("--manifest-path")
3628-
.arg(builder.src.join("compiler/rustc_codegen_gcc/build_system/Cargo.toml"));
3629-
compile::rustc_cargo_env(builder, &mut cargo, target);
3630-
add_cg_gcc_cargo_flags(&mut cargo, &gcc);
3609+
let _msg = builder.msg_test("rustc_codegen_gcc", compilers.build_compiler());
36313610

3632-
// Avoid incremental cache issues when changing rustc
3633-
cargo.env("CARGO_BUILD_INCREMENTAL", "false");
3634-
cargo.rustflag("-Cpanic=abort");
3635-
3636-
cargo
3637-
};
3638-
3639-
builder.info(&format!(
3640-
"{} GCC stage{} ({} -> {})",
3641-
Kind::Test.description(),
3642-
compiler.stage,
3643-
&compiler.host,
3644-
target
3645-
));
3646-
let _time = helpers::timeit(builder);
3611+
let mut cargo = builder::Cargo::new(
3612+
builder,
3613+
compilers.build_compiler(),
3614+
Mode::Codegen, // Must be codegen to ensure dlopen on compiled dylibs works
3615+
SourceType::InTree,
3616+
target,
3617+
Kind::Run,
3618+
);
36473619

3648-
// FIXME: Uncomment the `prepare` command below once vendoring is implemented.
3649-
/*
3650-
let mut prepare_cargo = build_cargo();
3651-
prepare_cargo.arg("--").arg("prepare");
3652-
#[expect(deprecated)]
3653-
builder.config.try_run(&mut prepare_cargo.into()).unwrap();
3654-
*/
3620+
cargo.current_dir(&builder.src.join("compiler/rustc_codegen_gcc"));
3621+
cargo
3622+
.arg("--manifest-path")
3623+
.arg(builder.src.join("compiler/rustc_codegen_gcc/build_system/Cargo.toml"));
3624+
compile::rustc_cargo_env(builder, &mut cargo, target);
3625+
add_cg_gcc_cargo_flags(&mut cargo, &gcc);
36553626

3656-
let mut cargo = build_cargo();
3627+
// Avoid incremental cache issues when changing rustc
3628+
cargo.env("CARGO_BUILD_INCREMENTAL", "false");
3629+
cargo.rustflag("-Cpanic=abort");
36573630

36583631
cargo
36593632
// cg_gcc's build system ignores RUSTFLAGS. pass some flags through CG_RUSTFLAGS instead.
@@ -3665,14 +3638,21 @@ impl Step for CodegenGCC {
36653638
.arg("--gcc-path")
36663639
.arg(gcc.libgccjit.parent().unwrap())
36673640
.arg("--out-dir")
3668-
.arg(builder.stage_out(compiler, Mode::ToolRustc).join("cg_gcc"))
3641+
.arg(builder.stage_out(compilers.build_compiler(), Mode::Codegen).join("cg_gcc"))
36693642
.arg("--release")
36703643
.arg("--mini-tests")
36713644
.arg("--std-tests");
36723645
cargo.args(builder.config.test_args());
36733646

36743647
cargo.into_cmd().run(builder);
36753648
}
3649+
3650+
fn metadata(&self) -> Option<StepMetadata> {
3651+
Some(
3652+
StepMetadata::test("rustc_codegen_gcc", self.target)
3653+
.built_by(self.compilers.build_compiler()),
3654+
)
3655+
}
36763656
}
36773657

36783658
/// Get a build compiler that can be used to test the standard library (i.e. its stage will

0 commit comments

Comments
 (0)