This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH 1/2] Check for prefixed ar, readelf, and nm
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Tue, 05 Nov 2013 17:20:47 +0100
- Subject: Re: [PATCH 1/2] Check for prefixed ar, readelf, and nm
On Fri, 2013-11-01 at 00:51 -0700, Michael Forney wrote:
> Sometimes with cross-compile toolchains, the tools are prefixed with the
> target arch. Using AC_CHECK_TOOL looks for tools named like this.
Pushed with one little tweak because AM_PROG_AR is only available since
automake 1.12. See
https://lists.gnu.org/archive/html/automake/2012-05/msg00015.html
And I added ChangeLog entries.
Thanks,
Mark
>From a45c8043358151085633b15ea615f31f3bd680f7 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Fri, 1 Nov 2013 00:51:04 -0700
Subject: [PATCH] Check for prefixed ar, readelf, and nm
Sometimes with cross-compile toolchains, the tools are prefixed with the
target arch. Using AC_CHECK_TOOL looks for tools named like this.
Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
ChangeLog | 4 ++++
config/ChangeLog | 4 ++++
config/eu.am | 2 +-
configure.ac | 4 ++++
libasm/Makefile.am | 2 +-
libdw/ChangeLog | 4 ++++
libdw/Makefile.am | 2 +-
libelf/ChangeLog | 4 ++++
libelf/Makefile.am | 2 +-
tests/ChangeLog | 5 +++++
tests/Makefile.am | 6 ++++--
tests/run-arsymtest.sh | 2 +-
12 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 433450d..026ce1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-01 Michael Forney <mforney@mforney.org>
+
+ * configure.ac: Call AM_PROG_AR and AC_CHECK_TOOL for readelf and nm.
+
2013-10-30 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (Version 0.158): New.
diff --git a/config/ChangeLog b/config/ChangeLog
index 3b1877d..98bf86f 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-01 Michael Forney <mforney@mforney.org>
+
+ * eu.am: Use READELF.
+
2013-09-30 Mark Wielaard <mjw@redhat.com>
* elfutils.spec.in: Update for readelf NT_SIGINFO and NT_FILE
diff --git a/config/eu.am b/config/eu.am
index 86e5a4e..38718c7 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -61,4 +61,4 @@ endif
CLEANFILES = *.gcno *.gcda
-textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
diff --git a/configure.ac b/configure.ac
index b4c249c..ee2ce26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,10 @@ AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_YACC
AM_PROG_LEX
+# Only available since automake 1.12
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+AC_CHECK_TOOL([READELF], [readelf])
+AC_CHECK_TOOL([NM], [nm])
AC_CACHE_CHECK([for gcc with C99 support], ac_cv_c99, [dnl
old_CFLAGS="$CFLAGS"
diff --git a/libasm/Makefile.am b/libasm/Makefile.am
index e16d4be..4d81536 100644
--- a/libasm/Makefile.am
+++ b/libasm/Makefile.am
@@ -69,7 +69,7 @@ libasm.so: libasm_pic.a libasm.map
-Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \
-Wl,--soname,$@.$(VERSION) \
../libebl/libebl.a ../libelf/libelf.so $(libasm_so_LDLIBS)
- if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+ if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
ln -fs $@ $@.$(VERSION)
install: install-am libasm.so
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 3fa6c0e..7a768fc 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-01 Michael Forney <mforney@mforney.org>
+
+ * Makefile.am: Use READELF.
+
2013-10-30 Jan Kratochvil <jan.kratochvil@redhat.com>
* libdw.map (ELFUTILS_0.158): New.
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index 5fef2e1..bf94560 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -113,7 +113,7 @@ libdw.so: $(srcdir)/libdw.map libdw_pic.a \
-Wl,--version-script,$<,--no-undefined \
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
-ldl $(zip_LIBS)
- if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+ if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
ln -fs $@ $@.$(VERSION)
install: install-am libdw.so
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index d9d6421..c2c5fc4 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-01 Michael Forney <mforney@mforney.org>
+
+ * Makefile.am: Use READELF.
+
2013-10-01 Petr Machata <pmachata@redhat.com>
* elf.h: Update from glibc.
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index 5903ea8..4646fba 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -106,7 +106,7 @@ libelf.so: libelf_pic.a libelf.map
$(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
-Wl,--soname,$@.$(VERSION),-z,defs,-z,relro $(libelf_so_LDLIBS)
- if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+ if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
ln -fs $@ $@.$(VERSION)
install: install-am libelf.so
diff --git a/tests/ChangeLog b/tests/ChangeLog
index c549fa0..5ebc1bd 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-01 Michael Forney <mforney@mforney.org>
+
+ * Makefile.am (TESTS_ENVIRONMENT): Use and export NM.
+ * run-arsymtest.sh: Use NM.
+
2013-11-05 Mark Wielaard <mjw@redhat.com>
* allfcts.c (main): Correct dwarf_getfuncs return value check.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d07cb0b..bc97523 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -231,7 +231,8 @@ installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir); \
export abs_srcdir; export abs_builddir; \
export abs_top_builddir; \
export libdir; export bindir; \
- export LC_ALL; export LANG; export VALGRIND_CMD;
+ export LC_ALL; export LANG; export VALGRIND_CMD; \
+ NM=$(NM); export NM;
installed_LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
installed $(tests_rpath) \
'$(program_transform_name)'
@@ -244,7 +245,8 @@ TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; VALGRIND_CMD=$(valgrind_cmd); \
abs_top_builddir=$(abs_top_builddir); \
export abs_srcdir; export abs_builddir; \
export abs_top_builddir; \
- export LC_ALL; export LANG; export VALGRIND_CMD;
+ export LC_ALL; export LANG; export VALGRIND_CMD; \
+ NM=$(NM); export NM;
LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
$(abs_top_builddir)/libdw:$(abs_top_builddir)/backends:$(abs_top_builddir)/libelf:$(abs_top_builddir)/libasm
diff --git a/tests/run-arsymtest.sh b/tests/run-arsymtest.sh
index dc016e1..b0fdfcd 100755
--- a/tests/run-arsymtest.sh
+++ b/tests/run-arsymtest.sh
@@ -28,7 +28,7 @@ tempfiles $okfile $tmpfile $testfile
result=77
if test -f $lib; then
# Generate list using `nm' we check against.
- nm -s $lib |
+ ${NM} -s $lib |
sed -e '1,/^Arch/d' -e '/^$/,$d' |
sort > $okfile
--
1.7.1