diff --git a/src/tools/compiletest/src/runtest/run_make.rs b/src/tools/compiletest/src/runtest/run_make.rs index ee7aed2a39c15..8a49d63053521 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 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 . + 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 diff --git a/src/tools/run-make-support/src/external_deps/rustdoc.rs b/src/tools/run-make-support/src/external_deps/rustdoc.rs index df5e5d8a2e84a..3c0e9c82f0bbc 100644 --- a/src/tools/run-make-support/src/external_deps/rustdoc.rs +++ b/src/tools/run-make-support/src/external_deps/rustdoc.rs @@ -45,8 +45,7 @@ impl Rustdoc { #[track_caller] pub fn new() -> Self { let mut cmd = setup_common(); - let target_rpath_dir = env_var_os("TARGET_RPATH_DIR"); - cmd.arg(format!("-L{}", target_rpath_dir.to_string_lossy())); + cmd.arg("-L").arg(env_var_os("TARGET_RPATH_DIR")); Self { cmd } }