about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-01-12 10:57:26 +0800
committer许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-01-12 13:03:22 +0800
commitfec2e3ab1a53bc9c3ae9cd25a71f57f9948d1b3e (patch)
tree6abca990a79d8a6706bde3b1497ec986de6a19c6
parent12445e0b2c532e389b8293924ed7c2b6fad5238f (diff)
downloadrust-fec2e3ab1a53bc9c3ae9cd25a71f57f9948d1b3e.tar.gz
rust-fec2e3ab1a53bc9c3ae9cd25a71f57f9948d1b3e.zip
compiletest: include stage0-sysroot libstd dylib in recipe dylib search path
To fix some of the failures in
`COMPILETEST_FORCE_STAGE0=1 ./x test run-make --stage 0`.
-rw-r--r--src/tools/compiletest/src/runtest/run_make.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest/run_make.rs b/src/tools/compiletest/src/runtest/run_make.rs
index ee7aed2a39c..8a49d630535 100644
--- a/src/tools/compiletest/src/runtest/run_make.rs
+++ b/src/tools/compiletest/src/runtest/run_make.rs
@@ -353,8 +353,8 @@ impl TestCx<'_> {
         // to work correctly.
         //
         // See <https://github.com/rust-lang/rust/pull/122248> for more background.
+        let stage0_sysroot = build_root.join("stage0-sysroot");
         if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
-            let stage0_sysroot = build_root.join("stage0-sysroot");
             rustc.arg("--sysroot").arg(&stage0_sysroot);
         }
 
@@ -373,6 +373,15 @@ impl TestCx<'_> {
         // Compute dynamic library search paths for recipes.
         let recipe_dylib_search_paths = {
             let mut paths = base_dylib_search_paths.clone();
+
+            // For stage 0, we need to explicitly include the stage0-sysroot libstd dylib.
+            // See <https://github.com/rust-lang/rust/issues/135373>.
+            if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
+                paths.push(
+                    stage0_sysroot.join("lib").join("rustlib").join(&self.config.host).join("lib"),
+                );
+            }
+
             paths.push(support_lib_path.parent().unwrap().to_path_buf());
             paths.push(stage_std_path.join("rustlib").join(&self.config.host).join("lib"));
             paths