about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--build_system/abi_checker.rs11
-rw-r--r--build_system/build_backend.rs6
-rw-r--r--build_system/build_sysroot.rs7
-rw-r--r--build_system/mod.rs8
-rw-r--r--build_system/tests.rs6
5 files changed, 18 insertions, 20 deletions
diff --git a/build_system/abi_checker.rs b/build_system/abi_checker.rs
index 67dbd0a38a4..faff081745f 100644
--- a/build_system/abi_checker.rs
+++ b/build_system/abi_checker.rs
@@ -10,7 +10,7 @@ pub(crate) fn run(
     channel: &str,
     sysroot_kind: SysrootKind,
     target_dir: &Path,
-    cg_clif_build_dir: &Path,
+    cg_clif_dylib: &Path,
     host_triple: &str,
     target_triple: &str,
 ) {
@@ -29,7 +29,7 @@ pub(crate) fn run(
         channel,
         sysroot_kind,
         target_dir,
-        cg_clif_build_dir,
+        cg_clif_dylib,
         host_triple,
         target_triple,
     );
@@ -39,11 +39,6 @@ pub(crate) fn run(
     abi_checker_path.push("abi-checker");
     env::set_current_dir(abi_checker_path.clone()).unwrap();
 
-    let build_dir = abi_checker_path.parent().unwrap().join("build");
-    let cg_clif_dylib_path = build_dir.join(if cfg!(windows) { "bin" } else { "lib" }).join(
-        env::consts::DLL_PREFIX.to_string() + "rustc_codegen_cranelift" + env::consts::DLL_SUFFIX,
-    );
-
     let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"];
 
     let mut cmd = Command::new("cargo");
@@ -54,7 +49,7 @@ pub(crate) fn run(
     cmd.arg("--pairs");
     cmd.args(pairs);
     cmd.arg("--add-rustc-codegen-backend");
-    cmd.arg(format!("cgclif:{}", cg_clif_dylib_path.display()));
+    cmd.arg(format!("cgclif:{}", cg_clif_dylib.display()));
 
     spawn_and_wait(cmd);
 }
diff --git a/build_system/build_backend.rs b/build_system/build_backend.rs
index 9e59b8199b4..d199d9906c3 100644
--- a/build_system/build_backend.rs
+++ b/build_system/build_backend.rs
@@ -2,6 +2,7 @@ use std::env;
 use std::path::{Path, PathBuf};
 use std::process::Command;
 
+use super::rustc_info::get_file_name;
 use super::utils::is_ci;
 
 pub(crate) fn build_backend(
@@ -41,5 +42,8 @@ pub(crate) fn build_backend(
     eprintln!("[BUILD] rustc_codegen_cranelift");
     super::utils::spawn_and_wait(cmd);
 
-    Path::new("target").join(host_triple).join(channel)
+    Path::new("target")
+        .join(host_triple)
+        .join(channel)
+        .join(get_file_name("rustc_codegen_cranelift", "dylib"))
 }
diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs
index 7e205b0fd0b..5b18982fa7e 100644
--- a/build_system/build_sysroot.rs
+++ b/build_system/build_sysroot.rs
@@ -10,7 +10,7 @@ pub(crate) fn build_sysroot(
     channel: &str,
     sysroot_kind: SysrootKind,
     target_dir: &Path,
-    cg_clif_build_dir: &Path,
+    cg_clif_dylib_src: &Path,
     host_triple: &str,
     target_triple: &str,
 ) {
@@ -23,7 +23,6 @@ pub(crate) fn build_sysroot(
     fs::create_dir_all(target_dir.join("lib")).unwrap();
 
     // Copy the backend
-    let cg_clif_dylib = get_file_name("rustc_codegen_cranelift", "dylib");
     let cg_clif_dylib_path = target_dir
         .join(if cfg!(windows) {
             // Windows doesn't have rpath support, so the cg_clif dylib needs to be next to the
@@ -32,8 +31,8 @@ pub(crate) fn build_sysroot(
         } else {
             "lib"
         })
-        .join(&cg_clif_dylib);
-    try_hard_link(cg_clif_build_dir.join(cg_clif_dylib), &cg_clif_dylib_path);
+        .join(get_file_name("rustc_codegen_cranelift", "dylib"));
+    try_hard_link(cg_clif_dylib_src, &cg_clif_dylib_path);
 
     // Build and copy rustc and cargo wrappers
     for wrapper in ["rustc-clif", "cargo-clif"] {
diff --git a/build_system/mod.rs b/build_system/mod.rs
index c3706dc6f82..c665d1ef71c 100644
--- a/build_system/mod.rs
+++ b/build_system/mod.rs
@@ -130,7 +130,7 @@ pub fn main() {
         process::exit(1);
     }
 
-    let cg_clif_build_dir =
+    let cg_clif_dylib =
         build_backend::build_backend(channel, &host_triple, use_unstable_features);
     match command {
         Command::Test => {
@@ -138,7 +138,7 @@ pub fn main() {
                 channel,
                 sysroot_kind,
                 &target_dir,
-                &cg_clif_build_dir,
+                &cg_clif_dylib,
                 &host_triple,
                 &target_triple,
             );
@@ -147,7 +147,7 @@ pub fn main() {
                 channel,
                 sysroot_kind,
                 &target_dir,
-                &cg_clif_build_dir,
+                &cg_clif_dylib,
                 &host_triple,
                 &target_triple,
             );
@@ -157,7 +157,7 @@ pub fn main() {
                 channel,
                 sysroot_kind,
                 &target_dir,
-                &cg_clif_build_dir,
+                &cg_clif_dylib,
                 &host_triple,
                 &target_triple,
             );
diff --git a/build_system/tests.rs b/build_system/tests.rs
index 3f225b4efa2..d3296c6fda3 100644
--- a/build_system/tests.rs
+++ b/build_system/tests.rs
@@ -397,7 +397,7 @@ pub(crate) fn run_tests(
     channel: &str,
     sysroot_kind: SysrootKind,
     target_dir: &Path,
-    cg_clif_build_dir: &Path,
+    cg_clif_dylib: &Path,
     host_triple: &str,
     target_triple: &str,
 ) {
@@ -408,7 +408,7 @@ pub(crate) fn run_tests(
             channel,
             SysrootKind::None,
             &target_dir,
-            cg_clif_build_dir,
+            cg_clif_dylib,
             &host_triple,
             &target_triple,
         );
@@ -427,7 +427,7 @@ pub(crate) fn run_tests(
             channel,
             sysroot_kind,
             &target_dir,
-            cg_clif_build_dir,
+            cg_clif_dylib,
             &host_triple,
             &target_triple,
         );