[COMMITTED] Fix BUILD_STATIC build and enable gcov for debuginfod.

Mark Wielaard mark@klomp.org
Tue Nov 26 08:06:00 GMT 2019


libdw now always needs -lpthread and -ld even when BUILD_STATIC.
BUILD_STATIC is only used when doing a gcov enabled build.
Enable gcov coverage also for debuginfod.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 ChangeLog              | 4 ++++
 configure.ac           | 1 +
 debuginfod/ChangeLog   | 5 +++++
 debuginfod/Makefile.am | 4 ++--
 src/ChangeLog          | 4 ++++
 src/Makefile.am        | 2 +-
 tests/ChangeLog        | 6 ++++++
 tests/Makefile.am      | 2 +-
 tests/coverage.sh      | 4 ++--
 9 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9d1c05f4..3d0756be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2019-11-26  Mark Wielaard  <mark@klomp.org>
+
+	* configure.ac: Add CXXFLAGS for gcov.
+
 2019-10-28  Aaron Merey  <amerey@redhat.com>
 
 	* debuginfod/: New directory for debuginfod code.
diff --git a/configure.ac b/configure.ac
index 5deec336..dc553bb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -299,6 +299,7 @@ AC_ARG_ENABLE([gcov],
 AS_HELP_STRING([--enable-gcov],[build binaries with gcov support]), [use_gcov=$enableval], [use_gcov=no])
 if test "$use_gcov" = yes; then
   CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+  CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
   LDFLAGS="$LDFLAGS -fprofile-arcs"
 fi
 AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 4df45d83..8aa29443 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-26  Mark Wielaard  <mark@klomp.org>
+
+	* Makefile.am (BUILD_STATIC): Add needed libraries for libdw and
+	libdebuginfod.
+
 2019-11-25  Frank Ch. Eigler  <fche@redhat.com>
 
 	* debuginfod.cxx (groom): Add a sqlite3_db_release_memory()
diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am
index ec0f49f1..52ead30a 100644
--- a/debuginfod/Makefile.am
+++ b/debuginfod/Makefile.am
@@ -43,9 +43,9 @@ program_transform_name = s,x,x,
 
 if BUILD_STATIC
 libasm = ../libasm/libasm.a
-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl
+libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
 libelf = ../libelf/libelf.a -lz
-libdebuginfod = ./libdebuginfod.a
+libdebuginfod = ./libdebuginfod.a $(libcurl_LIBS)
 else
 libasm = ../libasm/libasm.so
 libdw = ../libdw/libdw.so
diff --git a/src/ChangeLog b/src/ChangeLog
index 3144c935..6af977ed 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2019-11-26  Mark Wielaard  <mark@klomp.org>
+
+	* Makefile.am (BUILD_STATIC): Add libraries needed for libdw.
+
 2019-10-26  Mark Wielaard  <mark@klomp.org>
 
 	* unstrip.c (collect_symbols): Check symbol strings are
diff --git a/src/Makefile.am b/src/Makefile.am
index ab72a0e9..e462e7d7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,7 +41,7 @@ CLEANFILES += make-debug-archive
 
 if BUILD_STATIC
 libasm = ../libasm/libasm.a
-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf)
+libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) -ldl -lpthread
 libelf = ../libelf/libelf.a -lz
 else
 libasm = ../libasm/libasm.so
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 27bc4ec2..6e3923f5 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2019-11-26  Mark Wielaard  <mark@klomp.org>
+
+	* Makefile.am (BUILD_STATIC): Add libraries needed for libdw.
+	* coverage.sh: Add debuginfod directory, check whether source
+	is .c or cxx.
+
 2019-11-24  Mark Wielaard  <mark@klomp.org>
 
 	* run-debuginfod-find.sh: Reduce verbosity. Add new cleanup
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 83d27a06..eab4ae6f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -512,7 +512,7 @@ libasm = -lasm
 libebl = -lebl
 else !STANDALONE
 if BUILD_STATIC
-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl)
+libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
 libelf = ../libelf/libelf.a -lz
 libasm = ../libasm/libasm.a
 else
diff --git a/tests/coverage.sh b/tests/coverage.sh
index 5cc353c9..01d292cc 100755
--- a/tests/coverage.sh
+++ b/tests/coverage.sh
@@ -8,14 +8,14 @@ fi
 
 cd ..
 
-for d in lib libasm libdw libdwfl libebl libelf backends src; do
+for d in lib libasm libdw libdwfl libebl libelf backends src debuginfod; do
   tmp=$d-data
   cd $d
   unused=0
   unused_files=
   for f in *.gcno; do
     base="$(basename $f .gcno)"
-    fc="$base.c"
+    if [ -f "$base.c" ]; then fc="$base.c"; else fc="$base.cxx"; fi
     gcda="$base.gcda"
     if [ -f "$gcda" ]; then
       gcov -n -a "$fc" |
-- 
2.20.1



More information about the Elfutils-devel mailing list