This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR43715 - Fix --enable-plugin on darwin


Currently the --enable-plugin configure option fails on darwin because
the exported symbol tests require objdump, which is missing on that platform,
and the required usage of "-undefined dynamic_lookup" is missing from
the linkages on darwin. This patch solves these issues by substituting
"$gcc_cv_nm -g" for missing "$gcc_cv_objdump -T" in the tests for
exported symbols and adding "-undefined dynamic_lookup" on darwin to the
linkages. Bootstrapped and regression tested on x86_64-apple-darwin10
using gcc-4_5-branch. Okay for gcc trunk and gcc 4.5.1?
               Jack
ps We really want this in gcc 4.5.1 as the dragon-egg developers
would rather work with llvm svn and the stable FSF gcc release.

2010-04-11  Jack Howarth <howarth@bromo.med.uc.edu>

        PR 43715
	* gcc/configure.ac: Use "$gcc_cv_nm -g" to check
	for exported symbols. Use "-undefined dynamic_lookup"
	on darwin.
        * gcc/configure: Regenerate.
	* testsuite/lib/plugin-support.exp: Use "-undefined
	dynamic_lookup" on darwin.


Index: testsuite/lib/plugin-support.exp
===================================================================
--- testsuite/lib/plugin-support.exp	(revision 158199)
+++ testsuite/lib/plugin-support.exp	(working copy)
@@ -88,6 +88,10 @@
 
     set optstr "$includes $extra_flags -DIN_GCC -fPIC -shared"
 
+    if { [ istarget *-*-darwin* ] } {
+        set optstr [concat $optstr "-undefined dynamic_lookup"]
+    }
+
     # Temporarily switch to the environment for the plugin compiler.
     restore_ld_library_path_env_vars
     set status [remote_exec build "$PLUGINCC $PLUGINCFLAGS $plugin_src $optstr -o $plugin_lib"]
Index: configure.ac
===================================================================
--- configure.ac	(revision 158199)
+++ configure.ac	(working copy)
@@ -4384,12 +4384,12 @@
   AC_MSG_CHECKING([for exported symbols])
   echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c
   ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest > /dev/null 2>&1
-  if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
+  if $gcc_cv_nm -g conftest | grep foobar > /dev/null; then
     : # No need to use a flag
   else
     AC_MSG_CHECKING([for -rdynamic])
     ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest > /dev/null 2>&1
-    if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
+    if $gcc_cv_nm -g conftest | grep foobar > /dev/null; then
       pluginlibs="-rdynamic"
     else
       enable_plugin=no
@@ -4406,7 +4406,14 @@
 
   # Check that we can build shared objects with -fPIC -shared
   saved_LDFLAGS="$LDFLAGS"
-  LDFLAGS="$LDFLAGS -fPIC -shared"
+  case "${target}" in
+    *-*-darwin*)
+      LDFLAGS="$LDFLAGS -fPIC -shared -undefined dynamic_lookup"
+    ;;
+    *)
+      LDFLAGS="$LDFLAGS -fPIC -shared"
+    ;;
+  esac
   AC_MSG_CHECKING([for -fPIC -shared])
   AC_TRY_LINK(
     [extern int X;],[return X == 0;],


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]