Skip to content

Commit

Permalink
Use -target when linking binaries for Mac Catalyst
Browse files Browse the repository at this point in the history
  • Loading branch information
visigoth committed Dec 20, 2020
1 parent c1d5843 commit 8553aee
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2197,8 +2197,13 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
return;
}
};
let arch_name = llvm_target.split('-').next().expect("LLVM target must have a hyphen");
cmd.args(&["-arch", arch_name, "-isysroot", &sdk_root, "-Wl,-syslibroot", &sdk_root]);
if llvm_target.contains("macabi") {
cmd.args(&["-target", llvm_target])
} else {
let arch_name = llvm_target.split('-').next().expect("LLVM target must have a hyphen");
cmd.args(&["-arch", arch_name])
}
cmd.args(&["-isysroot", &sdk_root, "-Wl,-syslibroot", &sdk_root]);
}

fn get_apple_sdk_root(sdk_name: &str) -> Result<String, String> {
Expand Down

0 comments on commit 8553aee

Please sign in to comment.