about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorkit <kit@hastur.io>2021-11-09 10:44:49 +1100
committerkit <kit@hastur.io>2021-11-14 18:49:18 +1100
commitf44fa6348f48403a79b506823286444b453267cb (patch)
tree962d3aceed77c576381a2349007ae4b29ffe6119 /compiler
parent32ddd0206c9bd1956f7629c8c76191369f19023f (diff)
downloadrust-f44fa6348f48403a79b506823286444b453267cb.tar.gz
rust-f44fa6348f48403a79b506823286444b453267cb.zip
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.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/linker.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs
index f8f88bf607a..15d16e7d3d6 100644
--- a/compiler/rustc_codegen_ssa/src/back/linker.rs
+++ b/compiler/rustc_codegen_ssa/src/back/linker.rs
@@ -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