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][RevisedX4 - PR43715 - Fix --enable-plugin on darwin - trunk version


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 the exported symbol tests on darwin and "$gcc_cv_nm -D"
otherwise and adding "-undefined dynamic_lookup" on darwin to the
linkages. Bootstrapped and regression tested on x86_64-apple-darwin10
and x86_64 Fedora 10 linux 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-21  Jack Howarth <howarth@bromo.med.uc.edu>

        PR 43715
	* gcc/configure.ac: Use "$gcc_cv_nm -g" on darwin and
	"$gcc_cv_nm -D" otherwise instead of $gcc_cv_objdump.
	Use "-undefined dynamic_lookup" on darwin.
        * gcc/configure: Regenerate.
	* testsuite/lib/plugin-support.exp: Use "-undefined
	dynamic_lookup" on darwin.


Index: gcc/testsuite/lib/plugin-support.exp
===================================================================
--- gcc/testsuite/lib/plugin-support.exp	(revision 158624)
+++ gcc/testsuite/lib/plugin-support.exp	(working copy)
@@ -88,6 +88,10 @@
 
     set optstr "$includes $extra_flags -DIN_GCC -fPIC -shared"
 
+    if { [ ishost *-*-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: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 158624)
+++ gcc/configure.ac	(working copy)
@@ -4456,15 +4456,23 @@
 pluginlibs=
 if test x"$enable_plugin" = x"yes"; then
 
+  case "${host}" in
+    *-*-darwin*)
+      export_sym_check="$gcc_cv_nm -g"
+    ;;
+    *)
+      export_sym_check="$gcc_cv_nm -D"
+    ;;
+  esac
   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 $export_sym_check 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 $export_sym_check conftest | grep foobar > /dev/null; then
       plugin_rdynamic=yes
       pluginlibs="-rdynamic"
     else
@@ -4484,7 +4492,14 @@
 
   # Check that we can build shared objects with -fPIC -shared
   saved_LDFLAGS="$LDFLAGS"
-  LDFLAGS="$LDFLAGS -fPIC -shared"
+  case "${host}" 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]