[PATCH] tests: use ${CC} instead of 'gcc' in tests

2021-01-31 Thread Sergei Trofimovich via Elfutils-devel
To better support cross-compilation Gentoo provides a way
to configure system without 'gcc' binary and only provide
tool-prefixed tools, like 'x86_64-pc-linux-gnu-gcc'.
The packages are built as ./configure --host=x86_64-pc-linux-gnu.

In https://bugs.gentoo.org/718872 Agostino Sarubbo found
a few test failures that use hardcoded 'gcc' instead of
expected ${CC}. The change propagates detected ${CC} at
configure time to test scripts.

Signed-off-by: Sergei Trofimovich 
---
 tests/ChangeLog| 10 ++
 tests/Makefile.am  |  6 --
 tests/run-disasm-x86-64.sh |  2 +-
 tests/run-disasm-x86.sh|  2 +-
 tests/run-strip-g.sh   |  2 +-
 tests/run-strip-nothing.sh |  2 +-
 tests/run-test-includes.sh | 14 +++---
 7 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 3e5b630a..c6e9f618 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,13 @@
+2021-01-31  Sergei Trofimovich  
+
+   * Makefile.am (TESTS_ENVIRONMENT): export CC variable
+   to tests for use instead of 'gcc'.
+   * run-disasm-x86-64.sh: use ${CC} instead of 'gcc'.
+   * run-disasm-x86.sh: Likewise.
+   * run-strip-g.sh: Likewise.
+   * run-strip-nothing.sh: Likewise.
+   * run-test-includes.sh: Likewise.
+
 2021-01-06  Timm Bäder  
 
* zstrptr.c (main): Lift print_strings function up to ...
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 502becff..c145720c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -527,7 +527,8 @@ installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir); \
  export libdir; export bindir; \
  export LC_ALL; export LANG; export VALGRIND_CMD; \
  unset DEBUGINFOD_URLS; \
- NM=$(NM); export NM;
+ NM=$(NM); export NM; \
+ CC=$(CC); export CC;
 installed_LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
 installed $(tests_rpath) \
 '$(program_transform_name)'
@@ -538,7 +539,8 @@ TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; 
VALGRIND_CMD=$(valgrind_cmd); \
export abs_top_builddir; \
export LC_ALL; export LANG; export VALGRIND_CMD; \
unset DEBUGINFOD_URLS; \
-   NM=$(NM); export NM;
+   NM=$(NM); export NM; \
+   CC=$(CC); export CC;
 LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
   
$(abs_top_builddir)/libdw:$(abs_top_builddir)/backends:$(abs_top_builddir)/libelf:$(abs_top_builddir)/libasm:$(abs_top_builddir)/debuginfod
 
diff --git a/tests/run-disasm-x86-64.sh b/tests/run-disasm-x86-64.sh
index a6be62bb..07b612b0 100755
--- a/tests/run-disasm-x86-64.sh
+++ b/tests/run-disasm-x86-64.sh
@@ -22,7 +22,7 @@ case "`uname -m`" in
   x86_64)
 tempfiles testfile45.o
 testfiles testfile45.S testfile45.expect
-gcc -m64 -c -o testfile45.o testfile45.S
+${CC} -m64 -c -o testfile45.o testfile45.S
 testrun_compare ${abs_top_builddir}/src/objdump -d testfile45.o < 
testfile45.expect
 ;;
 esac
diff --git a/tests/run-disasm-x86.sh b/tests/run-disasm-x86.sh
index 28a3df74..7ac73ad7 100755
--- a/tests/run-disasm-x86.sh
+++ b/tests/run-disasm-x86.sh
@@ -22,7 +22,7 @@ case "`uname -m`" in
   x86_64 | i?86 )
 tempfiles testfile44.o
 testfiles testfile44.S testfile44.expect
-gcc -m32 -c -o testfile44.o testfile44.S
+${CC} -m32 -c -o testfile44.o testfile44.S
 testrun_compare ${abs_top_builddir}/src/objdump -d testfile44.o < 
testfile44.expect
 ;;
 esac
diff --git a/tests/run-strip-g.sh b/tests/run-strip-g.sh
index 13038195..15921215 100755
--- a/tests/run-strip-g.sh
+++ b/tests/run-strip-g.sh
@@ -25,7 +25,7 @@
 tempfiles a.out strip.out debug.out readelf.out
 
 echo Create debug a.out.
-echo "int main() { return 1; }" | gcc -g -xc -
+echo "int main() { return 1; }" | ${CC} -g -xc -
 
 echo strip -g to file with debug file
 testrun ${abs_top_builddir}/src/strip -g -o strip.out -f debug.out ||
diff --git a/tests/run-strip-nothing.sh b/tests/run-strip-nothing.sh
index 914fdfbf..710c200d 100755
--- a/tests/run-strip-nothing.sh
+++ b/tests/run-strip-nothing.sh
@@ -23,7 +23,7 @@
 tempfiles a.out strip.out debug.out
 
 # Create no-debug a.out.
-echo "int main() { return 1; }" | gcc -s -xc -
+echo "int main() { return 1; }" | ${CC} -s -xc -
 
 # strip to file
 testrun ${abs_top_builddir}/src/strip -g -o strip.out ||
diff --git a/tests/run-test-includes.sh b/tests/run-test-includes.sh
index b0ccdd9b..b107c6b9 100755
--- a/tests/run-test-includes.sh
+++ b/tests/run-test-includes.sh
@@ -3,24 +3,24 @@
 . $srcdir/test-subr.sh
 
 echo '#include "libelf.h"' \
-  | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf -xc -
+  | ${CC} -c -o /dev/null -I ${abs_srcdir}/../libelf -xc -
 echo '#include "gelf.h"' \
-  | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf

Re: [PATCH] tests: use ${CC} instead of 'gcc' in tests

2021-01-31 Thread Mark Wielaard
On Sun, Jan 31, 2021 at 03:49:13PM +, Sergei Trofimovich via Elfutils-devel 
wrote:
> To better support cross-compilation Gentoo provides a way
> to configure system without 'gcc' binary and only provide
> tool-prefixed tools, like 'x86_64-pc-linux-gnu-gcc'.
> The packages are built as ./configure --host=x86_64-pc-linux-gnu.
> 
> In https://bugs.gentoo.org/718872 Agostino Sarubbo found
> a few test failures that use hardcoded 'gcc' instead of
> expected ${CC}. The change propagates detected ${CC} at
> configure time to test scripts.

Looks good. As long as CC accepts the same arguments as gcc this
should work just fine. And I think all requirements are checked
against CC in configure. Pushed.

BTW. Note that tests/run-debuginfod-find.sh still contains "bare" gcc
calls.

Thanks,

Mark


debuginfod client as GDB/LLDB Plugin

2021-01-31 Thread Matt Schulte via Elfutils-devel
Hi all!

I have been working on a GDB and LLDB python plugin that will bring
debuginfod to older versions of GDB and LLDB. It's still in the early
stages of development (no support for source loading, no support for
Python 2...) but wanted to raise awareness of my work and say thank
you for coming out with debuginfod!

You can find it here:
https://github.com/schultetwin1/gdbundle-debuginfod

-Matt