This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][RevisedX3] PR43715 - Fix --enable-plugin on darwin
- From: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mikestump at comcast dot net, iains at gcc dot gnu dot org, peter at pogma dot com
- Date: Sun, 11 Apr 2010 23:28:19 -0400
- Subject: [PATCH][RevisedX3] 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 the exported symbol tests when $gcc_cv_objdump
is empty 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-12 Jack Howarth <howarth@bromo.med.uc.edu>
PR 43715
* gcc/configure.ac: Use "$gcc_cv_nm -g" when
$gcc_cv_objdump empty. 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 158212)
+++ 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 158212)
+++ gcc/configure.ac (working copy)
@@ -4381,15 +4381,20 @@
pluginlibs=
if test x"$enable_plugin" = x"yes"; then
+ if test -z "$gcc_cv_objdump"; then
+ export_sym_check="$gcc_cv_nm -g"
+ else
+ export_sym_check="$gcc_cv_objdump -T"
+ fi
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
pluginlibs="-rdynamic"
else
enable_plugin=no
@@ -4406,7 +4411,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;],