This is the mail archive of the 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

Included here is the original email and patch from


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 for some
earlier discussion.

OK to checkin?

Steve Ellcey

2009-11-10  Steve Ellcey  <>

	PR target/37454
	* Modify -rdynamic check.

---	(revision 154058)
+++	(working copy)
@@ -4267,21 +4267,20 @@ enable_plugin=yes; default_plugin=yes)
 if test x"$enable_plugin" = x"yes"; then
-  # Check that the host supports -rdynamic and -ldl
-  have_rdynamic=no
-  have_dl=no
-  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
   # Check -ldl
@@ -4310,9 +4309,6 @@ Building GCC with plugin support require
 -fPIC, -shared, -ldl and -rdynamic.])
-  LIBS="$saved_LIBS"

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