diff mbox

Backport darwin plugin support fixes to gcc 4.5.2

Message ID 20101003183528.GA12026@bromo.med.uc.edu
State New
Headers show

Commit Message

Jack Howarth Oct. 3, 2010, 6:35 p.m. UTC
Currently plugin support is not built for darwin in
gcc-4_5-branch due to the absence of the changes from
r158748 and r164113 which allow the export_sym_check
test to pass on darwin by properly using -g in that case.
Also the required use of "-undefined dynamic_lookup" on darwin
in both gcc/configure.ac and testsuite/lib/plugin-support.exp
added in r158748 has not been backported. The attached patch
eliminates these omissions.
Bootstrap and regression tested on x86_64-apple-darwin10.
Okay for gcc 4.5.2?
                Jack

2010-10-02  Jack Howarth  <howarth@bromo.med.uc.edu>

	Backport from mainline
	2010-04-26  Jack Howarth <howarth@bromo.med.uc.edu>

	PR 43715
	* gcc/configure.ac: Pass -g for export_sym_check on darwin.
	Use "-undefined dynamic_lookup" on darwin.
	* gcc/configure: Regenerate.

2010-10-02  Jack Howarth  <howarth@bromo.med.uc.edu>

	Backport from mainline
	2010-04-26  Jack Howarth <howarth@bromo.med.uc.edu>
		
	PR 43715
	* testsuite/lib/plugin-support.exp: Use "-undefined
	dynamic_lookup" on darwin.

Comments

Mike Stump Oct. 4, 2010, 2:54 a.m. UTC | #1
On Oct 3, 2010, at 11:35 AM, Jack Howarth wrote:
> Okay for gcc 4.5.2?

Ok.
diff mbox

Patch

Index: gcc/testsuite/lib/plugin-support.exp
===================================================================
--- gcc/testsuite/lib/plugin-support.exp	(revision 164915)
+++ 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 164915)
+++ gcc/configure.ac	(working copy)
@@ -4543,13 +4543,26 @@ 
 
 pluginlibs=
 
-if test x$build = x$host; then
-  export_sym_check="objdump${exeext} -T"
-elif test x$host = x$target; then
-  export_sym_check="$gcc_cv_objdump -T"
-else
-  export_sym_check=
-fi
+case "${host}" in
+  *-*-darwin*)
+    if test x$build = x$host; then
+      export_sym_check="nm${exeext} -g"
+    elif test x$host = x$target; then
+      export_sym_check="$gcc_cv_nm -g"
+    else
+      export_sym_check=
+    fi
+  ;;
+  *)
+    if test x$build = x$host; then
+      export_sym_check="objdump${exeext} -T"
+    elif test x$host = x$target; then
+      export_sym_check="$gcc_cv_objdump -T"
+    else
+      export_sym_check=
+    fi
+  ;;
+esac
 
 if test x"$enable_plugin" = x"yes"; then
 
@@ -4587,7 +4600,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;],