From 5311644ca82f585387b11a269820ab2e6988d7b9 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 28 Apr 2024 17:55:58 +0000 Subject: [PATCH] Force usage of ld classic to workaround crash with ld prime --- build_system/build_sysroot.rs | 8 ++++++++ build_system/main.rs | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs index 10c3f9cf..062fe6a6 100644 --- a/build_system/build_sysroot.rs +++ b/build_system/build_sysroot.rs @@ -137,6 +137,14 @@ pub(crate) fn build_sysroot( if !is_native { target_compiler.set_cross_linker_and_runner(); } + match target_compiler.triple.as_str() { + "x86_64-apple-darwin" => { + // HACK: Force usage of ld classic to workaround crash with ld prime + target_compiler.rustflags.push("-Clink-arg=-ld_classic".to_owned()); + target_compiler.rustdocflags.push("-Clink-arg=-ld_classic".to_owned()); + } + _ => {} + } target_compiler } diff --git a/build_system/main.rs b/build_system/main.rs index cdd2bae0..19af7248 100644 --- a/build_system/main.rs +++ b/build_system/main.rs @@ -153,7 +153,7 @@ fn main() { process::exit(1); } }; - let bootstrap_host_compiler = { + let mut bootstrap_host_compiler = { let cargo = rustc_info::get_cargo_path(); let rustc = rustc_info::get_rustc_path(); let rustdoc = rustc_info::get_rustdoc_path(); @@ -171,6 +171,14 @@ fn main() { runner: vec![], } }; + match bootstrap_host_compiler.triple.as_str() { + "x86_64-apple-darwin" => { + // HACK: Force usage of ld classic to workaround crash with ld prime + bootstrap_host_compiler.rustflags.push("-Clink-arg=-ld_classic".to_owned()); + bootstrap_host_compiler.rustdocflags.push("-Clink-arg=-ld_classic".to_owned()); + } + _ => {} + } let target_triple = std::env::var("TARGET_TRIPLE") .ok() .or_else(|| config::get_value("target"))