File tree 1 file changed +5
-3
lines changed
compiler/rustc_codegen_ssa/src/back
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -404,12 +404,14 @@ impl<'a> GccLinker<'a> {
404
404
fn build_dylib ( & mut self , crate_type : CrateType , out_filename : & Path ) {
405
405
// On mac we need to tell the linker to let this library be rpathed
406
406
if self . sess . target . is_like_osx {
407
- if !self . is_ld {
407
+ if self . is_cc ( ) {
408
+ // `-dynamiclib` makes `cc` pass `-dylib` to the linker.
408
409
self . cc_arg ( "-dynamiclib" ) ;
410
+ } else {
411
+ self . link_arg ( "-dylib" ) ;
412
+ // Clang also sets `-dynamic`, but that's implied by `-dylib`, so unnecessary.
409
413
}
410
414
411
- self . link_arg ( "-dylib" ) ;
412
-
413
415
// Note that the `osx_rpath_install_name` option here is a hack
414
416
// purely to support bootstrap right now, we should get a more
415
417
// principled solution at some point to force the compiler to pass
You can’t perform that action at this time.
0 commit comments