[lttng-dev] [PATCH] use AC_CHECK_TOOL for objcopy and strip

Nathan Lynch nathan_lynch at mentor.com
Fri Dec 11 11:43:24 EST 2015


The build steps for some tests refer directly to objcopy and strip,
which when cross-compiling can result in:

 objcopy --only-keep-debug prog prog.debug
 objcopy: Unable to recognise the format of the input file `prog'

Use AC_CHECK_TOOL to use appropriate programs for the target.

Signed-off-by: Nathan Lynch <nathan_lynch at mentor.com>
---
 configure.ac                                     | 2 ++
 tests/regression/ust/baddr-statedump/Makefile.am | 6 +++---
 tests/regression/ust/ust-dl/Makefile.am          | 6 +++---
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5537c154015e..64a6be9b8594 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,8 @@ AC_PROG_LEX
 AC_PROG_MAKE_SET
 AC_PROG_SED
 AC_PROG_YACC
+AC_CHECK_TOOL([OBJCOPY], [objcopy])
+AC_CHECK_TOOL([STRIP], [strip])
 LT_INIT
 
 # Checks for typedefs, structures, and compiler characteristics.
diff --git a/tests/regression/ust/baddr-statedump/Makefile.am b/tests/regression/ust/baddr-statedump/Makefile.am
index f45c5aeeb155..8869ed55ef9e 100644
--- a/tests/regression/ust/baddr-statedump/Makefile.am
+++ b/tests/regression/ust/baddr-statedump/Makefile.am
@@ -13,9 +13,9 @@ all-local: prog$(EXEEXT)
 			cp -f $(srcdir)/$$script $(builddir); \
 		done; \
 	fi
-	objcopy --only-keep-debug prog prog.debug
-	strip -g prog
-	objcopy --add-gnu-debuglink prog.debug prog
+	$(OBJCOPY) --only-keep-debug prog prog.debug
+	$(STRIP) -g prog
+	$(OBJCOPY) --add-gnu-debuglink prog.debug prog
 
 clean-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
diff --git a/tests/regression/ust/ust-dl/Makefile.am b/tests/regression/ust/ust-dl/Makefile.am
index 4893a97e4793..d3c975a4d6dc 100644
--- a/tests/regression/ust/ust-dl/Makefile.am
+++ b/tests/regression/ust/ust-dl/Makefile.am
@@ -18,9 +18,9 @@ all-local: libfoo.la
 			cp -f $(srcdir)/$$script $(builddir); \
 		done; \
 	fi
-	objcopy --only-keep-debug .libs/libfoo.so .libs/libfoo.so.debug
-	strip -g .libs/libfoo.so
-	objcopy --add-gnu-debuglink .libs/libfoo.so.debug .libs/libfoo.so
+	$(OBJCOPY) --only-keep-debug .libs/libfoo.so .libs/libfoo.so.debug
+	$(STRIP) -g .libs/libfoo.so
+	$(OBJCOPY) --add-gnu-debuglink .libs/libfoo.so.debug .libs/libfoo.so
 
 clean-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-- 
2.4.3




More information about the lttng-dev mailing list