public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Check if gcc supports -rdynamic and don't use it if not
@ 2017-05-03 11:35 Ulf Hermann
  0 siblings, 0 replies; only message in thread
From: Ulf Hermann @ 2017-05-03 11:35 UTC (permalink / raw)
  To: elfutils-devel

On some platforms the symbols are automatically exported and -rdynamic 
will produce a warning.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 ChangeLog         |  4 ++++
 configure.ac      | 11 +++++++++++
 tests/ChangeLog   |  5 +++++
 tests/Makefile.am |  2 +-
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d43eeb6..eaea959 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-05-03  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* configure.ac: Add check for -rdynamic.
+
 2017-04-28  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* configure.ac: Determine the binary format we're building natively.
diff --git a/configure.ac b/configure.ac
index 18ef6d6..e45584e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -237,6 +237,17 @@ fi
 
 AC_SUBST([dso_LDFLAGS])
 
+rdynamic_LDFLAGS="-rdynamic"
+AC_CACHE_CHECK([whether gcc supports $rdynamic_LDFLAGS], ac_cv_rdynamic, [dnl
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$rdynamic_LDFLAGS $save_LDFLAGS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_cv_rdynamic=yes, ac_cv_rdynamic=no)
+LDFLAGS="$save_LDFLAGS"
+])
+if test "$ac_cv_rdynamic" = "no"; then
+	rdynamic_LDFLAGS=""
+fi
+
 AC_CACHE_CHECK([for rpath support], ac_cv_rpath, [dnl
 save_LDFLAGS="$LDFLAGS"
 LDFLAGS="$save_LDFLAGS -Wl,--enable-new-dtags,-rpath,/foo/bar"
diff --git a/tests/ChangeLog b/tests/ChangeLog
index ab1a3788..b00c848 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-03  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* Makefile.am: Skip -rdynamic when compiling deleted-lib.so with a
+	compiler that doesn't support it.
+
 2017-04-28  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* run-disasm-x86-64.sh: Disable if the native binary format is not
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 943c694..114ab7a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -520,7 +520,7 @@ endif
 system_elf_libelf_test_LDADD = $(libelf) $(libgnu)
 
 deleted-lib$(LIBEXT): deleted-lib.c $(libgnu)
-	$(AM_V_CCLD)$(COMPILE) $(fpic_CFLAGS) -fasynchronous-unwind-tables -shared -rdynamic -o $@ $^
+	$(AM_V_CCLD)$(COMPILE) $(fpic_CFLAGS) -fasynchronous-unwind-tables -shared $(rdynamic_LDFLAGS) -o $@ $^
 
 if GCOV
 check: check-am coverage
-- 
2.1.4

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-05-03 11:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 11:35 [PATCH] Check if gcc supports -rdynamic and don't use it if not Ulf Hermann

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