From 0e8e9b38878f1f30f53a7445a752783c7de38583 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:26:50 +0000 Subject: [PATCH] Put rustc_codegen_cranelift.dll in bin rather than lib on Windows rustc-clif has long been changed from a custom driver linking against cg_clif to a wrapper around rustc which passes -Zcodegen-backend. --- build_system/build_sysroot.rs | 9 +-------- scripts/cargo-clif.rs | 2 +- scripts/rustc-clif.rs | 2 +- scripts/rustdoc-clif.rs | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs index 337599469..a73e3c87d 100644 --- a/build_system/build_sysroot.rs +++ b/build_system/build_sysroot.rs @@ -33,14 +33,7 @@ pub(crate) fn build_sysroot( let cg_clif_dylib_path = match cg_clif_dylib_src { CodegenBackend::Local(src_path) => { // Copy the backend - let cg_clif_dylib_path = if cfg!(windows) { - // Windows doesn't have rpath support, so the cg_clif dylib needs to be next to the - // binaries. - dist_dir.join("bin") - } else { - dist_dir.join("lib") - } - .join(src_path.file_name().unwrap()); + let cg_clif_dylib_path = dist_dir.join("lib").join(src_path.file_name().unwrap()); try_hard_link(src_path, &cg_clif_dylib_path); CodegenBackend::Local(cg_clif_dylib_path) } diff --git a/scripts/cargo-clif.rs b/scripts/cargo-clif.rs index 1e14f41d4..ebbb68796 100644 --- a/scripts/cargo-clif.rs +++ b/scripts/cargo-clif.rs @@ -16,7 +16,7 @@ fn main() { if let Some(name) = option_env!("BUILTIN_BACKEND") { rustflags.push(format!("-Zcodegen-backend={name}")); } else { - let dylib = sysroot.join(if cfg!(windows) { "bin" } else { "lib" }).join( + let dylib = sysroot.join("lib").join( env::consts::DLL_PREFIX.to_string() + "rustc_codegen_cranelift" + env::consts::DLL_SUFFIX, diff --git a/scripts/rustc-clif.rs b/scripts/rustc-clif.rs index a27b9983b..528031af8 100644 --- a/scripts/rustc-clif.rs +++ b/scripts/rustc-clif.rs @@ -11,7 +11,7 @@ fn main() { sysroot = sysroot.parent().unwrap(); } - let cg_clif_dylib_path = sysroot.join(if cfg!(windows) { "bin" } else { "lib" }).join( + let cg_clif_dylib_path = sysroot.join("lib").join( env::consts::DLL_PREFIX.to_string() + "rustc_codegen_cranelift" + env::consts::DLL_SUFFIX, ); diff --git a/scripts/rustdoc-clif.rs b/scripts/rustdoc-clif.rs index 1cad312bb..6ebe060d8 100644 --- a/scripts/rustdoc-clif.rs +++ b/scripts/rustdoc-clif.rs @@ -11,7 +11,7 @@ fn main() { sysroot = sysroot.parent().unwrap(); } - let cg_clif_dylib_path = sysroot.join(if cfg!(windows) { "bin" } else { "lib" }).join( + let cg_clif_dylib_path = sysroot.join("lib").join( env::consts::DLL_PREFIX.to_string() + "rustc_codegen_cranelift" + env::consts::DLL_SUFFIX, );