Let abi-checker take the full path to the cg_clif dylib

This commit is contained in:
bjorn3 2022-08-28 16:46:09 +00:00
parent 917be273ab
commit b12286fec3
5 changed files with 18 additions and 20 deletions

View File

@ -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);
}

View File

@ -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"))
}

View File

@ -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"] {

View File

@ -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,
);

View File

@ -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,
);