Skip to content

Commit 7bde2ec

Browse files
committed
MacOS: add linker flag "-undefined dynamic_lookup" for shared libs.
Necessary for shared libraries where not all symbols are resolved until the library is loaded at runtime. Fixes #62874
1 parent b9cf541 commit 7bde2ec

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc_codegen_ssa/back/linker.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ impl<'a> Linker for GccLinker<'a> {
361361
self.cmd.arg("-dynamiclib");
362362
self.linker_arg("-dylib");
363363

364+
// some symbols may be defined in the program loading the library
365+
self.linker_arg("-undefined,dynamic_lookup");
366+
364367
// Note that the `osx_rpath_install_name` option here is a hack
365368
// purely to support rustbuild right now, we should get a more
366369
// principled solution at some point to force the compiler to pass

0 commit comments

Comments
 (0)