public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] PR 37454 - Fix -rdynamic check in gcc/configure
@ 2009-11-10 17:40 Steve Ellcey
  2009-11-11  2:47 ` John David Anglin
  2009-11-20 17:37 ` Ping: " Steve Ellcey
  0 siblings, 2 replies; 3+ messages in thread
From: Steve Ellcey @ 2009-11-10 17:40 UTC (permalink / raw)
  To: gcc-patches

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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] PR 37454 - Fix -rdynamic check in gcc/configure
  2009-11-10 17:40 [Patch] PR 37454 - Fix -rdynamic check in gcc/configure Steve Ellcey
@ 2009-11-11  2:47 ` John David Anglin
  2009-11-20 17:37 ` Ping: " Steve Ellcey
  1 sibling, 0 replies; 3+ messages in thread
From: John David Anglin @ 2009-11-11  2:47 UTC (permalink / raw)
  To: sje; +Cc: gcc-patches

> 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.

I'm thinking of supporting the -rdynamic flag on PA-RISC HP-UX using
the -E linker option because:

1) It's necessary in the 32-bit runtime to mark all symbols for export.
   We need this for plugins.
2) "In a 64-bit +std link, all symbols are exported by default, so -E is
   not necessary to make symbols visible.  However, it has an additional
   side effect of identifying all exported symbols as necessary, so that
   they will not be removed when using dead code elimination (+Oprocelim)."
   The same may apply to IA64.

The -rdynamic configure check also fails on PA-RISC HP-UX, so I support
fixing the configure check.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Ping: [Patch] PR 37454 - Fix -rdynamic check in gcc/configure
  2009-11-10 17:40 [Patch] PR 37454 - Fix -rdynamic check in gcc/configure Steve Ellcey
  2009-11-11  2:47 ` John David Anglin
@ 2009-11-20 17:37 ` Steve Ellcey
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Ellcey @ 2009-11-20 17:37 UTC (permalink / raw)
  To: gcc-patches

This is a ping for my patch to fix 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).

Patch:

http://gcc.gnu.org/ml/gcc-patches/2009-11/msg00505.html


Steve Ellcey
sje@cup.hp.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-20 17:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-10 17:40 [Patch] PR 37454 - Fix -rdynamic check in gcc/configure Steve Ellcey
2009-11-11  2:47 ` John David Anglin
2009-11-20 17:37 ` Ping: " Steve Ellcey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).