From: Ulf Hermann <ulf.hermann@qt.io>
To: <elfutils-devel@sourceware.org>
Subject: [PATCH] Check if rpath is supported before setting it
Date: Mon, 01 May 2017 14:22:00 -0000 [thread overview]
Message-ID: <3c173d54-893d-3c91-5065-ac32d5794b9a@qt.io> (raw)
Some systems don't have rpath. In that case the backends need to be
made available by some external mechanism. Warn about it.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
ChangeLog | 5 +++++
configure.ac | 12 ++++++++++++
libdw/ChangeLog | 5 +++++
libdw/Makefile.am | 9 +++++++--
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 01f88f3..e5b74fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-28 Ulf Hermann <ulf.hermann@qt.io>
+
+ * configure.ac: Check if the linker supports -rpath and output a
+ warning if it doesn't.
+
2017-04-27 Ulf Hermann <ulf.hermann@qt.io>
* configure.ac: Check if the compiler supports
diff --git a/configure.ac b/configure.ac
index efcd3c0..b943547 100644
--- a/configure.ac
+++ b/configure.ac
@@ -204,6 +204,18 @@ fi
AC_SUBST([dso_LDFLAGS])
+AC_CACHE_CHECK([for rpath support], ac_cv_rpath, [dnl
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$save_LDFLAGS -Wl,--enable-new-dtags,-rpath,/foo/bar"
+AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_cv_rpath=yes, ac_cv_rpath=no)
+LDFLAGS="$save_LDFLAGS"
+])
+if test "$ac_cv_rpath" = "no"; then
+ AC_MSG_WARN([rpath is not supported. libdw will not automatically
+ find the ebl backends.])
+fi
+AM_CONDITIONAL(RPATH, test "$ac_cv_rpath" = "yes")
+
AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
# Use the same flags that we use for our DSOs, so the test is representative.
# Some old compiler/linker/libc combinations fail some ways and not others.
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 79c3898..45303d6 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-28 Ulf Hermann <ulf.hermann@qt.io>
+
+ * Makefile.am: If the linker doesn't support -rpath, don't try to set
+ it.
+
2017-02-27 Ulf Hermann <ulf.hermann@qt.io>
* libdwP.h: Use attribute_hidden.
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index 31f7012..055e3f1 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -99,6 +99,12 @@ $(srcdir)/known-dwarf.h: $(top_srcdir)/config/known-dwarf.awk $(srcdir)/dwarf.h
mv -f $@.new $@
endif
+if RPATH
+PKG_RPATH = -Wl,--enable-new-dtags,-rpath,$(pkglibdir)
+else
+PKG_RPATH =
+endif
+
libdw_pic_a_SOURCES =
am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
@@ -115,8 +121,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
# The rpath is necessary for libebl because its $ORIGIN use will
# not fly in a setuid executable that links in libdw.
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ -Wl,--soname,$@.$(VERSION) \
- -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
- -Wl,--version-script,$<,--no-undefined \
+ -Wl,--version-script,$<,--no-undefined $(PKG_RPATH) \
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
-ldl -lz $(intl_LDADD) $(zip_LIBS) $(libgnu)
@$(textrel_check)
--
2.1.4
reply other threads:[~2017-04-28 11:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3c173d54-893d-3c91-5065-ac32d5794b9a@qt.io \
--to=ulf.hermann@qt.io \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).