Skip to content

Commit

Permalink
Only use the -dynamiclib flag when the linker is not ld
Browse files Browse the repository at this point in the history
This is not a valid flag for ld64. When the ld64 linker is explicitly
provided through `config.toml`, rustc will not successfully compile.
  • Loading branch information
kit-981 committed Nov 14, 2021
1 parent 32ddd02 commit f44fa63
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ impl<'a> GccLinker<'a> {
fn build_dylib(&mut self, out_filename: &Path) {
// On mac we need to tell the linker to let this library be rpathed
if self.sess.target.is_like_osx {
self.cmd.arg("-dynamiclib");
if !self.is_ld {
self.cmd.arg("-dynamiclib");
}

self.linker_arg("-dylib");

// Note that the `osx_rpath_install_name` option here is a hack
Expand Down

0 comments on commit f44fa63

Please sign in to comment.