diff mbox

[committed] jit: on OS X, add -Wl,-undefined,dynamic_lookup to driver invocation

Message ID 1439516439-62360-1-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Aug. 14, 2015, 1:40 a.m. UTC
Reported as fixing the library on OS X Yosemite:
  https://gcc.gnu.org/ml/jit/2015-q3/msg00147.html

Committed to trunk as r226882.
Committed to gcc-5-branch as r226883.

gcc/jit/ChangeLog:
	* jit-playback.c (invoke_driver): On OS X, add
	"-Wl,-undefined,dynamic_lookup" to the driver arguments.
---
 gcc/jit/jit-playback.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox

Patch

diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c
index 925fa86..01cfd4b 100644
--- a/gcc/jit/jit-playback.c
+++ b/gcc/jit/jit-playback.c
@@ -2416,6 +2416,15 @@  invoke_driver (const char *ctxt_progname,
      time.  */
   ADD_ARG ("-fno-use-linker-plugin");
 
+#if defined (DARWIN_X86) || defined (DARWIN_PPC)
+  /* OS X's linker defaults to treating undefined symbols as errors.
+     If the context has any imported functions or globals they will be
+     undefined until the .so is dynamically-linked into the process.
+     Ensure that the driver passes in "-undefined dynamic_lookup" to the
+     linker.  */
+  ADD_ARG ("-Wl,-undefined,dynamic_lookup");
+#endif
+
   /* pex argv arrays are NULL-terminated.  */
   argvec.safe_push (NULL);