commit:     51b2dbe87f72d578e34b628da47826a6a727127b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  3 06:43:48 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Sep  3 06:53:39 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=51b2dbe8

dev-util/debugedit: Bump to 5.0

Closes: https://bugs.gentoo.org/768444
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-util/debugedit/Manifest                        |   2 +
 dev-util/debugedit/debugedit-5.0.ebuild            |  42 +++
 .../debugedit/files/debugedit-5.0-readelf.patch    | 330 +++++++++++++++++++++
 .../files/debugedit-5.0-zero-dir-entry.patch       | 130 ++++++++
 4 files changed, 504 insertions(+)

diff --git a/dev-util/debugedit/Manifest b/dev-util/debugedit/Manifest
index 230ca396760..442b79c16b5 100644
--- a/dev-util/debugedit/Manifest
+++ b/dev-util/debugedit/Manifest
@@ -1 +1,3 @@
+DIST debugedit-5.0.tar.xz 164820 BLAKE2B 
8e79f930a7e5c91709b1646794412836fff0b08da17a4b54beac4752a3f62c7418e3e8b8f7f3c3111ba375d6c672fee0f4279632bab3fb406a2fdd75a9e81a64
 SHA512 
7e7f529eafe41b53f0b5bfc58282fdbfa0dfa93ed7908b70e81942d6d2b6f80fc9c6bff2ed9674fd98947e5750b615f4c8b222544989e2900c5f8ff5ae0efb92
+DIST debugedit-5.0.tar.xz.sig 310 BLAKE2B 
bd8b092e400575fa62f759e4fd2e6bbfc9dbd77da2a363bd13c98b32794d515fbe7987824874b9c4be048e458c334bccb74082a78d845f07429b150083f2bcbf
 SHA512 
2223841eb6c63616dc24028e8076ab9d82579e8d6efa4bba45e5dbd0eb181c947feae6f944136f3504a78678569ae96dc6c4a0dd4e7012bd9aa522b0f7525dc9
 DIST rpm-4.16.1.3.tar.bz2 4354652 BLAKE2B 
10013014bdeaf908b64c90f8e76f1d4b0cd0e8cb926f0cd979d7b1e1963b9a25c5b98531deea7e74e00168e2e6349f443fa4578c69c717ca1ab5e6b79d801f3a
 SHA512 
54e503b32dffaa73d6168f26a00220d9d9124082d8a1eb1ddf34ce32a482f07cb06ec654cf065fca1607cc37b13fa7d4fa9895553541d7cfddecf68c9eb96f2e

diff --git a/dev-util/debugedit/debugedit-5.0.ebuild 
b/dev-util/debugedit/debugedit-5.0.ebuild
new file mode 100644
index 00000000000..ebbfafad2c1
--- /dev/null
+++ b/dev-util/debugedit/debugedit-5.0.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools verify-sig
+
+DESCRIPTION="Create debuginfo and source file distributions"
+HOMEPAGE="https://sourceware.org/debugedit/";
+SRC_URI="
+       https://sourceware.org/ftp/debugedit/${PV}/${P}.tar.xz
+       https://sourceware.org/ftp/debugedit/${PV}/${P}.tar.xz.sig
+"
+
+LICENSE="GPL-2+ LGPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux 
~x86-linux"
+IUSE=""
+
+RDEPEND="
+       >=dev-libs/elfutils-0.176-r1
+"
+DEPEND=${RDEPEND}
+BDEPEND="
+       sys-apps/help2man
+       virtual/pkgconfig
+       verify-sig? (
+               app-crypt/openpgp-keys-debugedit
+       )
+"
+
+VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/debugedit.gpg
+
+PATCHES=(
+       "${FILESDIR}"/${P}-readelf.patch
+       "${FILESDIR}"/${P}-zero-dir-entry.patch
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}

diff --git a/dev-util/debugedit/files/debugedit-5.0-readelf.patch 
b/dev-util/debugedit/files/debugedit-5.0-readelf.patch
new file mode 100644
index 00000000000..547b6871032
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.0-readelf.patch
@@ -0,0 +1,330 @@
+From 56e41d7c716a3657bdcce05146f7509d8a4e4a74 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <sly...@gentoo.org>
+Date: Sun, 1 Aug 2021 21:15:35 +0100
+Subject: [PATCH] use $READELF, not readelf
+
+Allow user to specify own readelf. Use detected readelf,
+not 'readelf'.
+
+Noticed as a set of test failures on system with only
+$host-prefixed tools:
+
+  debugedit/tests/testsuite.dir/at-groups/4/test-source:
+    line 40: readelf: command not found
+
+       * configure.ac: Add READELF user override.
+       * scripts/find-debuginfo.in: Use @READELF@ instead of 'readelf'.
+       * tests/atlocal.in: Populate READELF variable detected by configure.
+       * tests/debugedit.at: Use $READELF instad of 'readelf' in tests.
+       * Makefile.am (do_subst): Add READELF substitution.
+
+Signed-off-by: Sergei Trofimovich <sly...@gentoo.org>
+---
+ Makefile.am               |  3 ++-
+ configure.ac              |  1 +
+ scripts/find-debuginfo.in |  2 +-
+ tests/atlocal.in          |  1 +
+ tests/debugedit.at        | 54 +++++++++++++++++++--------------------
+ 5 files changed, 32 insertions(+), 29 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 98b2f20..2060b96 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -32,7 +32,8 @@ CLEANFILES = $(bin_SCRIPTS)
+ 
+ # Some standard substitutions for scripts
+ do_subst = ($(SED) -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
+-                 -e 's,[@]VERSION[@],$(VERSION),g')
++                 -e 's,[@]VERSION[@],$(VERSION),g' \
++                 -e 's,[@]READELF[@],$(READELF),g')
+ 
+ find-debuginfo: $(top_srcdir)/scripts/find-debuginfo.in Makefile
+       $(do_subst) < "$(top_srcdir)/scripts/$@.in" > "$@"
+diff --git a/configure.ac b/configure.ac
+index 85f2c4f..e5c9230 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -44,6 +44,7 @@ AC_PROG_SED
+ AC_PROG_CC_C99
+ AC_PROG_LN_S
+ AC_CHECK_TOOL([LD], [ld])
++AC_CHECK_TOOL([READELF], [readelf])
+ AM_MISSING_PROG(HELP2MAN, help2man)
+ 
+ # Only really an issue on 32bit platforms. Makes sure we'll get large off_t.
+diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in
+index 8b9ce77..9c0a735 100755
+--- a/scripts/find-debuginfo.in
++++ b/scripts/find-debuginfo.in
+@@ -338,7 +338,7 @@ add_minidebug()
+   # symbol and NOBITS sections so cannot use --keep-only because that is
+   # too aggressive. Field $2 is the section name, $3 is the section type
+   # and $8 are the section flags.
+-  local remove_sections=`readelf -W -S "$debuginfo" \
++  local remove_sections=`@READELF@ -W -S "$debuginfo" \
+       | awk '{ if (index($2,".debug_") != 1 \
+                    && ($3 == "PROGBITS" || $3 == "NOTE" || $3 == "NOBITS") \
+                    && index($8,"A") == 0) \
+diff --git a/tests/atlocal.in b/tests/atlocal.in
+index 0eec351..8399f8d 100644
+--- a/tests/atlocal.in
++++ b/tests/atlocal.in
+@@ -9,6 +9,7 @@ CC="@CC@"
+ CFLAGS=""
+ LD="@LD@"
+ LDFLAGS=""
++READELF="@READELF@"
+ 
+ GDWARF_5_FLAG=@GDWARF_5_FLAG@
+ GZ_NONE_FLAG=@GZ_NONE_FLAG@
+diff --git a/tests/debugedit.at b/tests/debugedit.at
+index 608b1d0..0311d26 100644
+--- a/tests/debugedit.at
++++ b/tests/debugedit.at
+@@ -93,7 +93,7 @@ DEBUGEDIT_SETUP([-gdwarf-4])
+ 
+ # Capture strings that start with the testdir (pwd) directory path
+ # (and replace that textually with /foo/bar/baz)
+-readelf -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \
++$READELF -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \
+         | grep ^$(pwd) | sort \
+         | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+ 
+@@ -108,7 +108,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ 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 -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \
++$READELF -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \
+         | grep ^/foo/bar/baz | sort
+ ]],[0],[expout])
+ 
+@@ -125,7 +125,7 @@ DEBUGEDIT_SETUP([-gdwarf-5])
+ 
+ # Capture strings that start with the testdir (pwd) directory path
+ # (and replace that textually with /foo/bar/baz)
+-readelf -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \
++$READELF -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \
+         | cut -c13- \
+         | grep ^$(pwd) | sort | uniq \
+         | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+@@ -141,7 +141,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ 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 -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \
++$READELF -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \
+         | cut -c13- \
+         | grep ^/foo/bar/baz | sort | uniq
+ ]],[0],[expout],[ignore])
+@@ -160,7 +160,7 @@ DEBUGEDIT_SETUP([-gdwarf-4])
+ # (and replace that textually with /foo/bar/baz)
+ # Note that partially linked files, might have multiple duplicate
+ # strings, but debugedit will merge them. So use sort -u.
+-readelf -p.debug_str ./foobarbaz.part.o | cut -c13- \
++$READELF -p.debug_str ./foobarbaz.part.o | cut -c13- \
+         | grep ^$(pwd) | sort -u \
+         | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+ 
+@@ -173,7 +173,7 @@ fi
+ # Check the replaced strings are all there.
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf -p.debug_str ./foobarbaz.part.o | cut -c13- \
++$READELF -p.debug_str ./foobarbaz.part.o | cut -c13- \
+         | grep ^/foo/bar/baz | sort
+ ]],[0],[expout])
+ 
+@@ -192,7 +192,7 @@ DEBUGEDIT_SETUP([-gdwarf-5])
+ # (and replace that textually with /foo/bar/baz)
+ # Note that partially linked files, might have multiple duplicate
+ # strings, but debugedit will merge them. So use sort -u.
+-readelf -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \
++$READELF -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \
+         | grep ^$(pwd) | sort -u | uniq \
+         | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+ 
+@@ -205,7 +205,7 @@ fi
+ # Check the replaced strings are all there.
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \
++$READELF -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \
+         | grep ^/foo/bar/baz | sort | uniq
+ ]],[0],[expout],[ignore])
+ 
+@@ -221,7 +221,7 @@ DEBUGEDIT_SETUP([-gdwarf-4])
+ 
+ # Capture strings that start with the testdir (pwd) directory path
+ # (and replace that textually with /foo/bar/baz)
+-readelf -p.debug_str foobarbaz.exe | cut -c13- \
++$READELF -p.debug_str foobarbaz.exe | cut -c13- \
+         | grep ^$(pwd) | sort \
+         | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+ 
+@@ -235,7 +235,7 @@ fi
+ # Check the replaced strings are all there.
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf -p.debug_str foobarbaz.exe | cut -c13- \
++$READELF -p.debug_str foobarbaz.exe | cut -c13- \
+         | grep ^/foo/bar/baz | sort
+ ]],[0],[expout])
+ 
+@@ -252,7 +252,7 @@ DEBUGEDIT_SETUP([-gdwarf-5])
+ 
+ # Capture strings that start with the testdir (pwd) directory path
+ # (and replace that textually with /foo/bar/baz)
+-readelf -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \
++$READELF -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \
+         | grep ^$(pwd) | sort | uniq \
+         | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+ 
+@@ -266,7 +266,7 @@ fi
+ # Check the replaced strings are all there.
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \
++$READELF -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \
+         | grep ^/foo/bar/baz | sort | uniq
+ ]],[0],[expout],[ignore])
+ 
+@@ -305,7 +305,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ 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=info foo.o subdir_bar/bar.o baz.o \
++$READELF --debug-dump=info foo.o subdir_bar/bar.o baz.o \
+         | grep -E 'DW_AT_(name|comp_dir)' \
+         | rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u
+ ]],[0],[expout])
+@@ -328,7 +328,7 @@ AT_DATA([expout],
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf --debug-dump=info ./foobarbaz.part.o \
++$READELF --debug-dump=info ./foobarbaz.part.o \
+         | grep -E 'DW_AT_(name|comp_dir)' \
+         | rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u
+ ]],[0],[expout])
+@@ -351,7 +351,7 @@ AT_DATA([expout],
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf --debug-dump=info ./foobarbaz.exe | grep -E 'DW_AT_(name|comp_dir)' \
++$READELF --debug-dump=info ./foobarbaz.exe | grep -E 'DW_AT_(name|comp_dir)' \
+         | rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u
+ ]],[0],[expout])
+ 
+@@ -385,7 +385,7 @@ 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([[
+ for i in ./foo.o ./subdir_bar/bar.o ./baz.o;do \
+-  readelf --debug-dump=info $i \
++  $READELF --debug-dump=info $i \
+           | awk '/Abbrev 
Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \
+           | sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \
+           | sort;
+@@ -415,7 +415,7 @@ stz
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf --debug-dump=info ./foobarbaz.part.o \
++$READELF --debug-dump=info ./foobarbaz.part.o \
+         | awk '/Abbrev Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \
+         | sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \
+         | sort
+@@ -444,7 +444,7 @@ stz
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf --debug-dump=info ./foobarbaz.exe \
++$READELF --debug-dump=info ./foobarbaz.exe \
+         | awk '/Abbrev Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \
+         | sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \
+         | sort
+@@ -474,7 +474,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ 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 \
++$READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \
+         | grep -A3 "The Directory Table" | grep "^  [123]" \
+       | grep /foo/ | cut -c5- | sort
+ ]],[0],[expout])
+@@ -499,7 +499,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ 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 \
++$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
+ ]],[0],[expout])
+@@ -521,7 +521,7 @@ AT_DATA([expout],
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf --debug-dump=line ./foobarbaz.part.o \
++$READELF --debug-dump=line ./foobarbaz.part.o \
+         | grep -A3 "The Directory Table" | grep "^  [123]" \
+       | grep /foo/ | cut -c5- | sort
+ ]],[0],[expout])
+@@ -544,7 +544,7 @@ foo/bar/baz/subdir_headers
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf --debug-dump=line ./foobarbaz.part.o \
++$READELF --debug-dump=line ./foobarbaz.part.o \
+         | grep -A5 "The Directory Table" | grep "^  [123]" \
+       | cut -f2- -d/ | grep ^foo/ | sort
+ ]],[0],[expout])
+@@ -566,7 +566,7 @@ AT_DATA([expout],
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf --debug-dump=line ./foobarbaz.exe \
++$READELF --debug-dump=line ./foobarbaz.exe \
+         | grep -A3 "The Directory Table" | grep "^  [123]" \
+       | grep /foo/ | cut -c5- | sort
+ ]],[0],[expout])
+@@ -589,7 +589,7 @@ foo/bar/baz/subdir_headers
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf --debug-dump=line ./foobarbaz.exe \
++$READELF --debug-dump=line ./foobarbaz.exe \
+         | grep -A5 "The Directory Table" | grep "^  [123]" \
+       | cut -f2- -d/ | grep ^foo/ | sort
+ ]],[0],[expout])
+@@ -615,7 +615,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ 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=macro foo.o subdir_bar/bar.o baz.o \
++$READELF --debug-dump=macro foo.o subdir_bar/bar.o baz.o \
+         | grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
+ ]],[0],[expout])
+ 
+@@ -638,7 +638,7 @@ NUMBER 42
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf --debug-dump=macro ./foobarbaz.part.o \
++$READELF --debug-dump=macro ./foobarbaz.part.o \
+         | grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
+ ]],[0],[expout])
+ 
+@@ -661,7 +661,7 @@ NUMBER 42
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf --debug-dump=macro ./foobarbaz.exe \
++$READELF --debug-dump=macro ./foobarbaz.exe \
+         | grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
+ ]],[0],[expout])
+ 
+-- 
+2.27.0
+

diff --git a/dev-util/debugedit/files/debugedit-5.0-zero-dir-entry.patch 
b/dev-util/debugedit/files/debugedit-5.0-zero-dir-entry.patch
new file mode 100644
index 00000000000..f564b0b99e8
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.0-zero-dir-entry.patch
@@ -0,0 +1,130 @@
+From ae27211cbbfb63a0ad3c141cd1310d7f583ec40e Mon Sep 17 00:00:00 2001
+From: Mark Wielaard <m...@klomp.org>
+Date: Fri, 30 Jul 2021 18:09:46 +0200
+Subject: [PATCH] tests: Handle zero directory entry in .debug_line DWARF5
+ debugedit.at
+
+We were skipping the zero directory entry, because it was always
+the same as the directory entry at position one. But that isn't
+true anymore with gcc 11.2.1. There the zero dir entry is unique.
+Fix the debugedit.at .debug_line testcases using DWARF5 to also
+include dir entry zero.
+
+Signed-off-by: Mark Wielaard <m...@klomp.org>
+---
+ 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 0311d26..725e68e 100644
+--- a/tests/debugedit.at
++++ b/tests/debugedit.at
+@@ -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
++foo/bar/baz/subdir_bar
+ foo/bar/baz/subdir_headers
+ ])
+ 
+@@ -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 -A5 "The Directory Table" | grep "^  [0123]" \
++      | cut -f2- -d/ | grep ^foo/ | sort -u
+ ]],[0],[expout])
+ 
+ AT_CLEANUP
+@@ -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
++foo/bar/baz/subdir_bar
+ foo/bar/baz/subdir_headers
+ ])
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+ $READELF --debug-dump=line ./foobarbaz.part.o \
+-        | grep -A5 "The Directory Table" | grep "^  [123]" \
+-      | cut -f2- -d/ | grep ^foo/ | sort
++      | grep -A5 "The Directory Table" | grep "^  [0123]" \
++      | cut -f2- -d/ | grep ^foo/ | sort -u
+ ]],[0],[expout])
+ 
+ AT_CLEANUP
+@@ -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
++foo/bar/baz/subdir_bar
+ foo/bar/baz/subdir_headers
+ ])
+ 
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+ $READELF --debug-dump=line ./foobarbaz.exe \
+-        | grep -A5 "The Directory Table" | grep "^  [123]" \
+-      | cut -f2- -d/ | grep ^foo/ | sort
++      | grep -A5 "The Directory Table" | grep "^  [0123]" \
++      | cut -f2- -d/ | grep ^foo/ | sort -u
+ ]],[0],[expout])
+ 
+ AT_CLEANUP
+-- 
+2.27.0
+

Reply via email to