Skip to content

Commit

Permalink
Put rustc_codegen_cranelift.dll in bin rather than lib on Windows
Browse files Browse the repository at this point in the history
rustc-clif has long been changed from a custom driver linking against
cg_clif to a wrapper around rustc which passes -Zcodegen-backend.
  • Loading branch information
bjorn3 committed Jan 9, 2025
1 parent 916a0b3 commit 0e8e9b3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
9 changes: 1 addition & 8 deletions build_system/build_sysroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/cargo-clif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion scripts/rustc-clif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);

Expand Down
2 changes: 1 addition & 1 deletion scripts/rustdoc-clif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);

Expand Down

0 comments on commit 0e8e9b3

Please sign in to comment.