Add other maintainer requires and update patch for DWARF5 configure check

This commit is contained in:
Mark Wielaard 2021-08-03 00:32:20 +02:00
parent 07ed771c56
commit 37c58757dd
2 changed files with 69 additions and 16 deletions

View File

@ -1,4 +1,4 @@
From 2e5be3d9b8501c4ca3d01b990191ff79171faf17 Mon Sep 17 00:00:00 2001
From ae27211cbbfb63a0ad3c141cd1310d7f583ec40e Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Fri, 30 Jul 2021 18:09:46 +0200
Subject: [PATCH] tests: Handle zero directory entry in .debug_line DWARF5
@ -12,14 +12,55 @@ include dir entry zero.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
tests/debugedit.at | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
configure.ac | 14 ++++++++++++++
tests/atlocal.in | 1 +
tests/debugedit.at | 18 ++++++++++++------
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index e5c9230..6a53365 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,20 @@ CFLAGS="$save_CFLAGS"
GDWARF_5_FLAG=$ac_cv_gdwarf_5
AC_SUBST([GDWARF_5_FLAG])
+AC_CACHE_CHECK([whether -gdwarf-5 produced DWARF5 .debug_line], ac_cv_dwarf_5_debugline, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="-gdwarf-5"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i=0;]],[[/* empty main */]])],
+ [if readelf --debug-dump=line conftest.o 2>&1 | \
+ grep "DWARF Version:" 2>&1 | grep "5" > /dev/null 2>&1; \
+ then ac_cv_dwarf_5_debugline=yes; \
+ else ac_cv_dwarf_5_debugline=no; fi],
+ ac_cv_dwarf_5_debugline=no)
+CFLAGS="$save_CFLAGS"
+])
+DWARF_5_DEBUGLINE=$ac_cv_dwarf_5_debugline
+AC_SUBST([DWARF_5_DEBUGLINE])
+
AC_CACHE_CHECK([whether gcc supports -gz=none], ac_cv_gz_none, [dnl
save_CFLAGS="$CFLAGS"
CFLAGS="-gz=none"
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 8399f8d..d916301 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -13,3 +13,4 @@ READELF="@READELF@"
GDWARF_5_FLAG=@GDWARF_5_FLAG@
GZ_NONE_FLAG=@GZ_NONE_FLAG@
+DWARF_5_DEBUGLINE=@DWARF_5_DEBUGLINE@
diff --git a/tests/debugedit.at b/tests/debugedit.at
index 608b1d0..c73bf82 100644
index 0311d26..725e68e 100644
--- a/tests/debugedit.at
+++ b/tests/debugedit.at
@@ -492,6 +492,7 @@ DEBUGEDIT_SETUP([-gdwarf-5])
@@ -488,10 +488,12 @@ AT_CLEANUP
AT_SETUP([debugedit .debug_line objects DWARF5])
AT_KEYWORDS([debuginfo] [debugedit])
AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"])
+AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"])
DEBUGEDIT_SETUP([-gdwarf-5])
AT_DATA([expout],
[foo/bar/baz
@ -27,18 +68,23 @@ index 608b1d0..c73bf82 100644
foo/bar/baz/subdir_headers
])
@@ -500,8 +501,8 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
@@ -500,8 +502,8 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
AT_CHECK([[
readelf --debug-dump=line foo.o subdir_bar/bar.o baz.o \
- | grep -A5 "The Directory Table" | grep "^ [123]" \
- | cut -f2- -d/ | grep ^foo/ | sort
+ | grep -A6 "The Directory Table" | grep "^ [0123]" \
+ | cut -f2- -d/ | grep ^foo/ | sort | uniq
+ | grep -A5 "The Directory Table" | grep "^ [0123]" \
+ | cut -f2- -d/ | grep ^foo/ | sort -u
]],[0],[expout])
AT_CLEANUP
@@ -539,14 +540,15 @@ DEBUGEDIT_SETUP([-gdwarf-5])
@@ -535,18 +537,20 @@ AT_CLEANUP
AT_SETUP([debugedit .debug_line partial DWARF5])
AT_KEYWORDS([debuginfo] [debugedit])
AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"])
+AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"])
DEBUGEDIT_SETUP([-gdwarf-5])
AT_DATA([expout],
[foo/bar/baz
@ -51,12 +97,17 @@ index 608b1d0..c73bf82 100644
readelf --debug-dump=line ./foobarbaz.part.o \
- | grep -A5 "The Directory Table" | grep "^ [123]" \
- | cut -f2- -d/ | grep ^foo/ | sort
+ | grep -A6 "The Directory Table" | grep "^ [0123]" \
+ | cut -f2- -d/ | grep ^foo/ | sort | uniq
+ | grep -A5 "The Directory Table" | grep "^ [0123]" \
+ | cut -f2- -d/ | grep ^foo/ | sort -u
]],[0],[expout])
AT_CLEANUP
@@ -584,14 +586,15 @@ DEBUGEDIT_SETUP([-gdwarf-5])
@@ -580,18 +584,20 @@ AT_CLEANUP
AT_SETUP([debugedit .debug_line exe DWARF5])
AT_KEYWORDS([debuginfo] [debugedit])
AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"])
+AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"])
DEBUGEDIT_SETUP([-gdwarf-5])
AT_DATA([expout],
[foo/bar/baz
@ -69,11 +120,11 @@ index 608b1d0..c73bf82 100644
readelf --debug-dump=line ./foobarbaz.exe \
- | grep -A5 "The Directory Table" | grep "^ [123]" \
- | cut -f2- -d/ | grep ^foo/ | sort
+ | grep -A6 "The Directory Table" | grep "^ [0123]" \
+ | cut -f2- -d/ | grep ^foo/ | sort | uniq
+ | grep -A5 "The Directory Table" | grep "^ [0123]" \
+ | cut -f2- -d/ | grep ^foo/ | sort -u
]],[0],[expout])
AT_CLEANUP
--
2.31.1
2.27.0

View File

@ -11,11 +11,12 @@ Source2: gpgkey-5C1D1AA44BE649DE760A.gpg
BuildRequires: make gcc
BuildRequires: pkgconfig(libelf)
BuildRequires: pkgconfig(libdw)
BuildRequires: help2man
BuildRequires: gnupg2
# For the testsuite.
BuildRequires: autoconf
BuildRequires: automake
# The find-debuginfo.sh script has a couple of tools it needs at runtime.
# For strip_to_debug, eu-strip
@ -53,6 +54,7 @@ read and write ELF files, DWARF data and build-ids.
%autosetup -p1
%build
autoreconf -f -v -i
%configure
%make_build