From patchwork Sun Oct 3 18:35:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Backport darwin plugin support fixes to gcc 4.5.2 Date: Sun, 03 Oct 2010 08:35:28 -0000 From: Jack Howarth X-Patchwork-Id: 66601 Message-Id: <20101003183528.GA12026@bromo.med.uc.edu> To: gcc-patches@gcc.gnu.org Cc: mikestump@comcast.net, doko@ubuntu.com, iains@gcc.gnu.org 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 Backport from mainline 2010-04-26 Jack Howarth 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 Backport from mainline 2010-04-26 Jack Howarth PR 43715 * 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 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;],