Skip to content

Commit

Permalink
Force usage of ld classic to workaround crash with ld prime
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Apr 28, 2024
1 parent 1e485f1 commit 4824303
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/abi-cafe.yml
Expand Up @@ -51,6 +51,10 @@ jobs:
if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
run: rustup set default-host x86_64-pc-windows-gnu

- name: Select XCode version
if: matrix.os == 'macos-latest'
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app

- name: Prepare dependencies
run: ./y.sh prepare

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -104,6 +104,10 @@ jobs:
sudo apt-get update
sudo apt-get install -y ${{ matrix.apt_deps }}
- name: Select XCode version
if: matrix.os == 'macos-latest'
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app

- name: Prepare dependencies
run: ./y.sh prepare

Expand Down Expand Up @@ -236,6 +240,10 @@ jobs:
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64-x86-64
- name: Select XCode version
if: matrix.os == 'macos-latest'
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app

- name: Prepare dependencies
run: ./y.sh prepare

Expand Down
8 changes: 8 additions & 0 deletions build_system/build_sysroot.rs
Expand Up @@ -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
}

Expand Down
10 changes: 9 additions & 1 deletion build_system/main.rs
Expand Up @@ -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();
Expand All @@ -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"))
Expand Down

0 comments on commit 4824303

Please sign in to comment.