Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b12286f

Browse files
committed
Let abi-checker take the full path to the cg_clif dylib
1 parent 917be27 commit b12286f

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

build_system/abi_checker.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub(crate) fn run(
1010
channel: &str,
1111
sysroot_kind: SysrootKind,
1212
target_dir: &Path,
13-
cg_clif_build_dir: &Path,
13+
cg_clif_dylib: &Path,
1414
host_triple: &str,
1515
target_triple: &str,
1616
) {
@@ -29,7 +29,7 @@ pub(crate) fn run(
2929
channel,
3030
sysroot_kind,
3131
target_dir,
32-
cg_clif_build_dir,
32+
cg_clif_dylib,
3333
host_triple,
3434
target_triple,
3535
);
@@ -39,11 +39,6 @@ pub(crate) fn run(
3939
abi_checker_path.push("abi-checker");
4040
env::set_current_dir(abi_checker_path.clone()).unwrap();
4141

42-
let build_dir = abi_checker_path.parent().unwrap().join("build");
43-
let cg_clif_dylib_path = build_dir.join(if cfg!(windows) { "bin" } else { "lib" }).join(
44-
env::consts::DLL_PREFIX.to_string() + "rustc_codegen_cranelift" + env::consts::DLL_SUFFIX,
45-
);
46-
4742
let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"];
4843

4944
let mut cmd = Command::new("cargo");
@@ -54,7 +49,7 @@ pub(crate) fn run(
5449
cmd.arg("--pairs");
5550
cmd.args(pairs);
5651
cmd.arg("--add-rustc-codegen-backend");
57-
cmd.arg(format!("cgclif:{}", cg_clif_dylib_path.display()));
52+
cmd.arg(format!("cgclif:{}", cg_clif_dylib.display()));
5853

5954
spawn_and_wait(cmd);
6055
}

build_system/build_backend.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::env;
22
use std::path::{Path, PathBuf};
33
use std::process::Command;
44

5+
use super::rustc_info::get_file_name;
56
use super::utils::is_ci;
67

78
pub(crate) fn build_backend(
@@ -41,5 +42,8 @@ pub(crate) fn build_backend(
4142
eprintln!("[BUILD] rustc_codegen_cranelift");
4243
super::utils::spawn_and_wait(cmd);
4344

44-
Path::new("target").join(host_triple).join(channel)
45+
Path::new("target")
46+
.join(host_triple)
47+
.join(channel)
48+
.join(get_file_name("rustc_codegen_cranelift", "dylib"))
4549
}

build_system/build_sysroot.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub(crate) fn build_sysroot(
1010
channel: &str,
1111
sysroot_kind: SysrootKind,
1212
target_dir: &Path,
13-
cg_clif_build_dir: &Path,
13+
cg_clif_dylib_src: &Path,
1414
host_triple: &str,
1515
target_triple: &str,
1616
) {
@@ -23,7 +23,6 @@ pub(crate) fn build_sysroot(
2323
fs::create_dir_all(target_dir.join("lib")).unwrap();
2424

2525
// Copy the backend
26-
let cg_clif_dylib = get_file_name("rustc_codegen_cranelift", "dylib");
2726
let cg_clif_dylib_path = target_dir
2827
.join(if cfg!(windows) {
2928
// 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(
3231
} else {
3332
"lib"
3433
})
35-
.join(&cg_clif_dylib);
36-
try_hard_link(cg_clif_build_dir.join(cg_clif_dylib), &cg_clif_dylib_path);
34+
.join(get_file_name("rustc_codegen_cranelift", "dylib"));
35+
try_hard_link(cg_clif_dylib_src, &cg_clif_dylib_path);
3736

3837
// Build and copy rustc and cargo wrappers
3938
for wrapper in ["rustc-clif", "cargo-clif"] {

build_system/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ pub fn main() {
130130
process::exit(1);
131131
}
132132

133-
let cg_clif_build_dir =
133+
let cg_clif_dylib =
134134
build_backend::build_backend(channel, &host_triple, use_unstable_features);
135135
match command {
136136
Command::Test => {
137137
tests::run_tests(
138138
channel,
139139
sysroot_kind,
140140
&target_dir,
141-
&cg_clif_build_dir,
141+
&cg_clif_dylib,
142142
&host_triple,
143143
&target_triple,
144144
);
@@ -147,7 +147,7 @@ pub fn main() {
147147
channel,
148148
sysroot_kind,
149149
&target_dir,
150-
&cg_clif_build_dir,
150+
&cg_clif_dylib,
151151
&host_triple,
152152
&target_triple,
153153
);
@@ -157,7 +157,7 @@ pub fn main() {
157157
channel,
158158
sysroot_kind,
159159
&target_dir,
160-
&cg_clif_build_dir,
160+
&cg_clif_dylib,
161161
&host_triple,
162162
&target_triple,
163163
);

build_system/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ pub(crate) fn run_tests(
397397
channel: &str,
398398
sysroot_kind: SysrootKind,
399399
target_dir: &Path,
400-
cg_clif_build_dir: &Path,
400+
cg_clif_dylib: &Path,
401401
host_triple: &str,
402402
target_triple: &str,
403403
) {
@@ -408,7 +408,7 @@ pub(crate) fn run_tests(
408408
channel,
409409
SysrootKind::None,
410410
&target_dir,
411-
cg_clif_build_dir,
411+
cg_clif_dylib,
412412
&host_triple,
413413
&target_triple,
414414
);
@@ -427,7 +427,7 @@ pub(crate) fn run_tests(
427427
channel,
428428
sysroot_kind,
429429
&target_dir,
430-
cg_clif_build_dir,
430+
cg_clif_dylib,
431431
&host_triple,
432432
&target_triple,
433433
);

0 commit comments

Comments
 (0)