This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils 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]

[PATCH] Check if gcc supports -rdynamic and don't use it if not


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


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