Skip to content

Commit f44fa63

Browse files
committed
Only use the -dynamiclib flag when the linker is not ld
This is not a valid flag for ld64. When the ld64 linker is explicitly provided through `config.toml`, rustc will not successfully compile.
1 parent 32ddd02 commit f44fa63

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,10 @@ impl<'a> GccLinker<'a> {
315315
fn build_dylib(&mut self, out_filename: &Path) {
316316
// On mac we need to tell the linker to let this library be rpathed
317317
if self.sess.target.is_like_osx {
318-
self.cmd.arg("-dynamiclib");
318+
if !self.is_ld {
319+
self.cmd.arg("-dynamiclib");
320+
}
321+
319322
self.linker_arg("-dylib");
320323

321324
// Note that the `osx_rpath_install_name` option here is a hack

0 commit comments

Comments
 (0)