Rollup merge of #122248 - jieyouxu:rmake-sysroot, r=Mark-Simulacrum

Respect stage0 sysroot when compiling rmake.rs with COMPILETEST_FORCE_STAGE0

Context: <https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/stage0.20compiletest.20broken>.
> cg_clif uses `COMPILETEST_FORCE_STAGE0=1 ./x.py test --stage 0` for running the rustc test suite. With the introduction of rmake.rs this broke. `librun_make_support.rlib` is compiled using the bootstrap rustc wrapper which sets `--sysroot build/aarch64-unknown-linux-gnu/stage0-sysroot`, but then compiletest will compile `rmake.rs` using the sysroot of the bootstrap compiler causing it to not find the `libstd.rlib` against which `librun_make_support.rlib` is compiled.

cc ``@bjorn3``

Fixes #122196.
This commit is contained in:
Matthias Krüger 2024-03-17 08:23:25 +01:00 committed by GitHub
commit a5dbdc2fa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3734,14 +3734,10 @@ fn run_rmake_v2_test(&self) {
debug!(?support_lib_deps); debug!(?support_lib_deps);
debug!(?support_lib_deps_deps); debug!(?support_lib_deps_deps);
let res = self.cmd2procres( let mut cmd = Command::new(&self.config.rustc_path);
Command::new(&self.config.rustc_path) cmd.arg("-o")
.arg("-o")
.arg(&recipe_bin) .arg(&recipe_bin)
.arg(format!( .arg(format!("-Ldependency={}", &support_lib_path.parent().unwrap().to_string_lossy()))
"-Ldependency={}",
&support_lib_path.parent().unwrap().to_string_lossy()
))
.arg(format!("-Ldependency={}", &support_lib_deps.to_string_lossy())) .arg(format!("-Ldependency={}", &support_lib_deps.to_string_lossy()))
.arg(format!("-Ldependency={}", &support_lib_deps_deps.to_string_lossy())) .arg(format!("-Ldependency={}", &support_lib_deps_deps.to_string_lossy()))
.arg("--extern") .arg("--extern")
@ -3762,8 +3758,18 @@ fn run_rmake_v2_test(&self) {
// at the top level // at the top level
.env_remove("MAKEFLAGS") .env_remove("MAKEFLAGS")
.env_remove("MFLAGS") .env_remove("MFLAGS")
.env_remove("CARGO_MAKEFLAGS"), .env_remove("CARGO_MAKEFLAGS");
);
if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
let mut stage0_sysroot = build_root.clone();
stage0_sysroot.push("stage0-sysroot");
debug!(?stage0_sysroot);
debug!(exists = stage0_sysroot.exists());
cmd.arg("--sysroot").arg(&stage0_sysroot);
}
let res = self.cmd2procres(&mut cmd);
if !res.status.success() { if !res.status.success() {
self.fatal_proc_rec("run-make test failed: could not build `rmake.rs` recipe", &res); self.fatal_proc_rec("run-make test failed: could not build `rmake.rs` recipe", &res);
} }