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]

Re: [PATCH][Revised] PR43715 - Fix --enable-plugin on darwin


On Sun, Apr 11, 2010 at 09:34:47PM +0200, Ralf Wildenhues wrote:
> Hello Jack,
> 
> I think such a patch needs to be tested on a non-darwin system as well.
> 
> * Jack Howarth wrote on Sun, Apr 11, 2010 at 09:02:35PM CEST:
> > --- gcc/configure.ac	(revision 158199)
> > +++ 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
> 
> Double-quotes around $gcc_cv_objdump and white spaces before ] needed
> here.
> 
> > +    export_sym_check="$gcc_cv_nm -g | grep T"
> 
> This means you need to eval "$export_sym_check" when you use it,
> the shell does variable expansion after parsing command pipelines ...
> 
> > +  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
> 
> ... here ...
> 
> >      : # 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
> 
> ... and here.
> 
> >        pluginlibs="-rdynamic"
> >      else
> >        enable_plugin=no
> 
> Cheers,
> Ralf

Ralf,
   How does this look?

Index: configure.ac
===================================================================
--- configure.ac	(revision 158204)
+++ 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 | grep T"
+  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;],

I see other examples in the same configure.ac which lack evaluation
in the actual if statement such as...

         if $gcc_cv_ld -v | grep GNU >/dev/null 2>&1; then

Thanks for any corrections.
            Jack


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