This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] Check if gcc supports -rdynamic and don't use it if not
- From: Ulf Hermann <ulf dot hermann at qt dot io>
- To: <elfutils-devel at sourceware dot org>
- Date: Wed, 3 May 2017 13:04:24 +0200
- Subject: [PATCH] Check if gcc supports -rdynamic and don't use it if not
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=qt.io;
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qtcompany.onmicrosoft.com; s=selector1-qt-io; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2ic8kOFIgToaBM2A2PgnHnNxr3O4hdUky+n8GuyVnkM=; b=Hmjf6xT7ny6viAFeCFL1BQT5YRBs1wPGKU5UT6fV+FB2JBU0XBQDBx7KVlvHFPiuuf5KqyakrHu/3zi5QbnExjpw/t2mrX8a5HIHC5oWTw91ORYYt9GeByaTCW+jNfKj9RQsuM5XAbuNxVKEfd9qH8fS+AmIliGsymZIzW0BUfc=
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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