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]

Ping^2: [Patch] PR 37454 - Fix -rdynamic check in gcc/configure


This is another ping for my patch to fix PR 37454, the -rdynamic flag
check in gcc/configure by first checking to see if symbols are exported
without the use of this flag and then to verify that they get exported
when the flag is used (instead of just looking for an ld error).  I am
also cc'ing the build machinery maintainers.

Steve Ellcey
sje@cup.hp.com

Included here is the original email and patch from
http://gcc.gnu.org/ml/gcc-patches/2009-11/msg00505.html

------------------

On IA64 HP-UX the gcc/configure script tries to use -rdynamic when
linking in order to support plugins.  GCC on IA64 HP-UX doesn't handle
the -rdynamic flag but the build tries to use it because the link that
configure does works, it just gives a warning which is ignored.  On IA64
HP-UX all symbols are exported by default so no flag is needed.  This patch
changes the check for -rynamic by first checking to see if a symbol is
exported by default and then checking to see if it is exported when the
-rdynamic flag is used.

Tested on IA64 HP-UX and Linux with no regressions.

See http://gcc.gnu.org/ml/gcc/2009-08/msg00528.html for some
earlier discussion.

OK to checkin?

Steve Ellcey
sje@cup.hp.com


2009-11-10  Steve Ellcey  <sje@cup.hp.com>

	PR target/37454
	* configure.ac: Modify -rdynamic check.


Index: configure.ac
===================================================================
--- configure.ac	(revision 154058)
+++ configure.ac	(working copy)
@@ -4267,21 +4267,20 @@ enable_plugin=yes; default_plugin=yes)
 
 pluginlibs=
 if test x"$enable_plugin" = x"yes"; then
-  # Check that the host supports -rdynamic and -ldl
-  have_rdynamic=no
-  have_dl=no
-  saved_LDFLAGS="$LDFLAGS"
-  saved_LIBS="$LIBS"
-  LIBS=
-
-  # Check -rdynamic
-  LDFLAGS="$LDFLAGS -rdynamic"
-  AC_MSG_CHECKING([for -rdynamic])
-  AC_TRY_LINK([],[return 0;],
-    [AC_MSG_RESULT([yes]); have_rdynamic=yes],
-    [AC_MSG_RESULT([no])])
-  if test x"$have_rdynamic" = x"yes" ; then
-    pluginlibs="-rdynamic"
+
+  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
+    : # 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
+      pluginlibs="-rdynamic"
+    else
+      enable_plugin=no
+    fi
   fi
 
   # Check -ldl
@@ -4310,9 +4309,6 @@ Building GCC with plugin support require
 -fPIC, -shared, -ldl and -rdynamic.])
     fi
   fi
-
-  LDFLAGS="$saved_LDFLAGS"
-  LIBS="$saved_LIBS"
 fi
 
 AC_SUBST(pluginlibs)


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