Skip to content

Commit cab3e9b

Browse files
committed
compiletest/rmake: improve clarity of support_lib_{path,deps,deps_deps} calculations
1 parent e335cca commit cab3e9b

File tree

1 file changed

+42
-21
lines changed

1 file changed

+42
-21
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3533,29 +3533,50 @@ impl<'test> TestCx<'test> {
35333533
debug!(?self.config.stage_id);
35343534
let stage = self.config.stage_id.split('-').next().unwrap();
35353535

3536-
// First, we construct the path to the built support library.
3537-
// FIXME(jieyouxu): explain what the hecc we are doing here.
3538-
let mut support_lib_path = PathBuf::new();
3539-
support_lib_path.push(&build_root);
3540-
support_lib_path.push(format!("{}-tools-bin", stage));
3541-
support_lib_path.push("librun_make_support.rlib");
3542-
3543-
// FIXME(jieyouxu): explain what the hecc we are doing here.
3544-
let mut support_lib_deps = PathBuf::new();
3545-
support_lib_deps.push(&build_root);
3546-
support_lib_deps.push(format!("{}-tools", stage));
3547-
support_lib_deps.push(&self.config.host);
3548-
support_lib_deps.push("release");
3549-
support_lib_deps.push("deps");
3550-
3551-
// FIXME(jieyouxu): explain what the hecc we are doing here.
3552-
let mut support_lib_deps_deps = PathBuf::new();
3553-
support_lib_deps_deps.push(&build_root);
3554-
support_lib_deps_deps.push(format!("{}-tools", stage));
3555-
support_lib_deps_deps.push("release");
3556-
support_lib_deps_deps.push("deps");
3536+
// In order to link in the support library as a rlib when compiling recipes, we need three
3537+
// paths:
3538+
// 1. Path of the built support library rlib itself.
3539+
// 2. Path of the built support library's dependencies directory.
3540+
// 3. Path of the built support library's dependencies' dependencies directory.
3541+
//
3542+
// The paths look like
3543+
//
3544+
// ```
3545+
// build/<target_tuplet>/
3546+
// ├── stageN-tools-bin/
3547+
// │ └── librun_make_support.rlib // <- support rlib itself
3548+
// ├── stageN-tools/
3549+
// │ ├── release/deps/ // <- deps of deps
3550+
// │ └── <host_tuplet>/release/deps/ // <- deps
3551+
// ```
3552+
//
3553+
// There almost certainly is a better way to do this, but this seems to work for now.
35573554

3555+
let support_lib_path = {
3556+
let mut p = build_root.clone();
3557+
p.push(format!("{}-tools-bin", stage));
3558+
p.push("librun_make_support.rlib");
3559+
p
3560+
};
3561+
debug!(?support_lib_path);
3562+
3563+
let support_lib_deps = {
3564+
let mut p = build_root.clone();
3565+
p.push(format!("{}-tools", stage));
3566+
p.push(&self.config.host);
3567+
p.push("release");
3568+
p.push("deps");
3569+
p
3570+
};
35583571
debug!(?support_lib_deps);
3572+
3573+
let support_lib_deps_deps = {
3574+
let mut p = build_root.clone();
3575+
p.push(format!("{}-tools", stage));
3576+
p.push("release");
3577+
p.push("deps");
3578+
p
3579+
};
35593580
debug!(?support_lib_deps_deps);
35603581

35613582
// FIXME(jieyouxu): explain what the hecc we are doing here.

0 commit comments

Comments
 (0)