public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/
@ 2019-03-14 12:24 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2019-03-14 12:24 UTC (permalink / raw
  To: gentoo-commits

commit:     0e56e352403a2405a99465e68218e84a057933b4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 13 18:07:16 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Mar 14 12:23:41 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e56e352

dev-util/debugedit: Apply GCC breakage workaround

Thanks to slyfox for the patch.

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

 dev-util/debugedit/debugedit-4.14.2-r1.ebuild      | 92 ++++++++++++++++++++++
 .../files/debugedit-4.14.2-no-reorder.patch        | 57 ++++++++++++++
 2 files changed, 149 insertions(+)

diff --git a/dev-util/debugedit/debugedit-4.14.2-r1.ebuild b/dev-util/debugedit/debugedit-4.14.2-r1.ebuild
new file mode 100644
index 00000000000..0aabb6cf18d
--- /dev/null
+++ b/dev-util/debugedit/debugedit-4.14.2-r1.ebuild
@@ -0,0 +1,92 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic
+
+MY_P=rpm-${PV}
+DESCRIPTION="Stand-alone debugedit from RPM"
+HOMEPAGE="http://www.rpm.org
+	https://github.com/rpm-software-management/rpm"
+SRC_URI="http://ftp.rpm.org/releases/rpm-$(ver_cut 1-2).x/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2+ LGPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+RDEPEND="
+	sys-libs/zlib:=
+	>=dev-libs/popt-1.7
+	dev-libs/elfutils
+	dev-libs/nss
+"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+	# do not reorder sections, ever; otherwise it breaks gcc
+	# https://bugs.gentoo.org/666954
+	eapply "${FILESDIR}"/debugedit-4.14.2-no-reorder.patch
+	eapply_user
+
+	# cheat it into believing we're bundling db
+	mkdir -p db/dist || die
+	touch db/dist/configure || die
+	chmod +x db/dist/configure || die
+	echo 'install:' > db3/Makefile || die
+
+	# TODO: why do we need to do this?
+	mkdir rpm || die
+	find -name '*.h' -exec cp {} rpm/ ';' || die
+}
+
+src_configure() {
+	append-cppflags -I"${EPREFIX}/usr/include/nss" -I"${EPREFIX}/usr/include/nspr"
+	local myconf=(
+		# force linking to static librpmio
+		--disable-shared
+
+		# disable linking compression libraries
+		ac_cv_header_bzlib_h=no
+		ac_cv_header_lzma_h=no
+		--disable-zstd
+
+		# fake some libraries we don't use
+		ac_cv_header_magic_h=yes
+		ac_cv_lib_magic_magic_open=yes
+
+		# use nss as crypto provider
+		--with-crypto=nss
+
+		# disable other stuff irrelevant to debugedit
+		--disable-nls
+		--disable-python
+		--without-acl
+		--without-archive
+		--without-cap
+		--without-external-db
+		--without-hackingdocs
+		--without-lua
+		--without-selinux
+	)
+	econf "${myconf[@]}"
+}
+
+src_compile() {
+	emake -C misc
+	emake -C rpmio
+	emake debugedit
+}
+
+src_test() {
+	:
+}
+
+src_install() {
+	dobin debugedit
+}

diff --git a/dev-util/debugedit/files/debugedit-4.14.2-no-reorder.patch b/dev-util/debugedit/files/debugedit-4.14.2-no-reorder.patch
new file mode 100644
index 00000000000..0c196a842b4
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-4.14.2-no-reorder.patch
@@ -0,0 +1,57 @@
+From 0779d60cb5941610dd1f31632aa1655bf2cc447a Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sat, 6 Oct 2018 17:56:00 +0100
+Subject: [PATCH] debugedit: don't reorder sections
+
+In https://bugs.gentoo.org/666954 debugedit processed
+crtbeginS.o from gcc-8.2.0 and turned into invalid ELF:
+
+```
+$ cp crtbeginS-ok-7.3.0.o.back crtbeginS-ok-7.3.0.o
+$ debugedit -i -b $(pwd) -d /usr/src/debug -l ./foo crtbeginS-ok-7.3.0.o
+$ export LANG=C
+$ readelf -a crtbeginS-ok-7.3.0.o.back >/dev/null && echo ok
+readelf: Warning: [ 9]: Info field (8) should index a relocatable section.
+ok
+
+$ readelf -a crtbeginS-ok-7.3.0.o >/dev/null && echo ok
+readelf: Warning: [ 9]: Info field (8) should index a relocatable section.
+readelf: Error:  bad symbol index: 54495f00 in reloc
+readelf: Error:  bad symbol index: 656c6261 in reloc
+readelf: Error:  bad symbol index: 62615465 in reloc
+readelf: Error:  bad symbol index: 69665f61 in reloc
+readelf: Warning: local symbol 11 found at index >= symtab's sh_info value of 11
+readelf: Warning: local symbol 14 found at index >= symtab's sh_info value of 11
+readelf: Warning: local symbol 15 found at index >= symtab's sh_info value of 11
+```
+
+Ths fix is not to reorder sections as debugedit does not
+account for offset change.
+
+debugedit already does it for final executables and shared libraries.
+
+Bug: https://bugs.gentoo.org/666954
+Closes: https://github.com/rpm-software-management/rpm/issues/423
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ tools/debugedit.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/tools/debugedit.c b/tools/debugedit.c
+index 84568dd29..a723283c0 100644
+--- a/tools/debugedit.c
++++ b/tools/debugedit.c
+@@ -2347,10 +2347,9 @@ fdopen_dso (int fd, const char *name)
+       goto error_out;
+     }
+ 
+-  /* If there are phdrs we want to maintain the layout of the
+-     allocated sections in the file.  */
+-  if (phnum != 0)
+-    elf_flagelf (elf, ELF_C_SET, ELF_F_LAYOUT);
++  /* We maintain the layout of the allocated sections in the file:
++     https://github.com/rpm-software-management/rpm/issues/423  */
++  elf_flagelf (elf, ELF_C_SET, ELF_F_LAYOUT);
+ 
+   memset (dso, 0, sizeof(DSO));
+   dso->elf = elf;


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/
@ 2019-06-20  8:01 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2019-06-20  8:01 UTC (permalink / raw
  To: gentoo-commits

commit:     769d3ad8c5253937d16de8ef18770cd5b1fe5824
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 20 07:59:32 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jun 20 08:01:33 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=769d3ad8

dev-util/debugedit: Drop old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-util/debugedit/Manifest                        |   1 -
 dev-util/debugedit/debugedit-0.5.3.5-r1.ebuild     |  44 -------
 .../debugedit/files/debugedit-5.3.5-DWARF-4.patch  | 129 ---------------------
 3 files changed, 174 deletions(-)

diff --git a/dev-util/debugedit/Manifest b/dev-util/debugedit/Manifest
index 9a83bb233b3..355633f1484 100644
--- a/dev-util/debugedit/Manifest
+++ b/dev-util/debugedit/Manifest
@@ -1,2 +1 @@
-DIST debugedit-5.3.5.tar.bz2 27799 BLAKE2B f81b39122502afe66386b962d0e50e9a16a314f31acf2a44c6d53f16d24ac91b62483a67fed43d085c3dd573adcd312cbb5e15c214fd8f00bc5415835c2caa37 SHA512 afac800a8f2e035705fcf997500d8fd2c3dc658850f47754863e8811db97859748721c5a252cc90dc81d07bf08763a9507e2272e983ee3f6bf16d8016fe5b8c9
 DIST rpm-4.14.2.tar.bz2 4151934 BLAKE2B eb7e32dd736a195f2e5effc184ee8f2c700dcaf80477574c2112b6c96504d86a67c81e611f82ea35ce244e95fad339bd262eb51c35ada5eeffa8d306b6938cb7 SHA512 22e309e8be936e6070430cedd6f5ea0c3871db4c6aadd0d567a9c418796c178c8dd45d44920d7eaa66681790cc2821347affe471cb215d7a490fe7947fbf291c

diff --git a/dev-util/debugedit/debugedit-0.5.3.5-r1.ebuild b/dev-util/debugedit/debugedit-0.5.3.5-r1.ebuild
deleted file mode 100644
index 0f558d0076a..00000000000
--- a/dev-util/debugedit/debugedit-0.5.3.5-r1.ebuild
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# To recreate this tarball, just grab latest rpm5 release:
-#	http://rpm5.org/files/rpm/
-# The files are in tools/
-# Or see $FILESDIR/update.sh
-
-EAPI="5"
-
-inherit toolchain-funcs eutils
-
-# See #653906 for the need to reversion.
-MY_PV=${PV#0.}
-MY_P="${PN}-${MY_PV}"
-
-DESCRIPTION="standalone debugedit taken from rpm"
-HOMEPAGE="http://www.rpm5.org/"
-SRC_URI="https://dev.gentoo.org/~swegener/distfiles/${MY_P}.tar.bz2
-	https://dev.gentoo.org/~vapier/dist/${MY_P}.tar.bz2"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="amd64 hppa ~ia64 ppc ppc64 x86 ~amd64-linux ~x86-linux"
-IUSE=""
-
-DEPEND="dev-libs/popt
-	dev-libs/elfutils
-	dev-libs/beecrypt"
-RDEPEND="${DEPEND}"
-
-S="${WORKDIR}/${MY_P}"
-
-src_prepare() {
-	epatch "${FILESDIR}"/${PN}-5.3.5-DWARF-4.patch #400663
-}
-
-src_compile() {
-	emake CC="$(tc-getCC)"
-}
-
-src_install() {
-	dobin debugedit
-}

diff --git a/dev-util/debugedit/files/debugedit-5.3.5-DWARF-4.patch b/dev-util/debugedit/files/debugedit-5.3.5-DWARF-4.patch
deleted file mode 100644
index 3e1406196e9..00000000000
--- a/dev-util/debugedit/files/debugedit-5.3.5-DWARF-4.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-add DWARF 4 support
-
-https://bugs.gentoo.org/400663
-https://bugzilla.redhat.com/show_bug.cgi?id=707677
-
---- debugedit-5.3.5/debugedit.c	2011-10-11 05:37:49.000000000 +0200
-+++ debugedit-5.3.5/debugedit.c	2012-01-25 01:27:23.487999039 +0100
-@@ -70,6 +70,10 @@
- #include <rpmtag.h>
- 
- #define DW_TAG_partial_unit 0x3c
-+#define DW_FORM_sec_offset 0x17
-+#define DW_FORM_exprloc 0x18
-+#define DW_FORM_flag_present 0x19
-+#define DW_FORM_ref_sig8 0x20
- 
- char *base_dir = NULL;
- char *dest_dir = NULL;
-@@ -246,6 +250,7 @@
- #define DEBUG_STR	8
- #define DEBUG_FRAME	9
- #define DEBUG_RANGES	10
-+#define DEBUG_TYPES	11
-     { ".debug_info", NULL, NULL, 0, 0, 0 },
-     { ".debug_abbrev", NULL, NULL, 0, 0, 0 },
-     { ".debug_line", NULL, NULL, 0, 0, 0 },
-@@ -257,6 +262,7 @@
-     { ".debug_str", NULL, NULL, 0, 0, 0 },
-     { ".debug_frame", NULL, NULL, 0, 0, 0 },
-     { ".debug_ranges", NULL, NULL, 0, 0, 0 },
-+    { ".debug_types", NULL, NULL, 0, 0, 0 },
-     { NULL, NULL, NULL, 0, 0, 0 }
-   };
- 
-@@ -349,7 +355,8 @@
- 		goto no_memory;
- 	    }
- 	  form = read_uleb128 (ptr);
--	  if (form == 2 || form > DW_FORM_indirect)
-+	  if (form == 2
-+	      || (form > DW_FORM_flag_present && form != DW_FORM_ref_sig8))
- 	    {
- 	      error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, form);
- 	      htab_delete (h);
-@@ -378,7 +385,6 @@
- canonicalize_path (const char *s, char *d)
- {
-   char *rv = d;
--  const char *sroot;
-   char *droot;
- 
-   if (IS_DIR_SEPARATOR (*s))
-@@ -394,7 +400,6 @@
- 	s++;
-     }
-   droot = d;
--  sroot = s;
- 
-   while (*s)
-     {
-@@ -513,7 +518,7 @@
-     }
- 
-   value = read_16 (ptr);
--  if (value != 2 && value != 3)
-+  if (value != 2 && value != 3 && value != 4)
-     {
-       error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
- 	     value);
-@@ -529,8 +534,8 @@
-       return 1;
-     }
-   
--  opcode_base = ptr[4];
--  ptr = dir = ptr + 4 + opcode_base;
-+  opcode_base = ptr[4 + (value >= 4)];
-+  ptr = dir = ptr + 4 + (value >= 4) + opcode_base;
-   
-   /* dir table: */
-   value = 1;
-@@ -758,7 +763,8 @@
- 	{
- 	  if (t->attr[i].attr == DW_AT_stmt_list)
- 	    {
--	      if (form == DW_FORM_data4)
-+	      if (form == DW_FORM_data4
-+		  || form == DW_FORM_sec_offset)
- 		{
- 		  list_offs = do_read_32_relocated (ptr);
- 		  found_list_offs = 1;
-@@ -864,6 +870,8 @@
- 	      else
- 		ptr += 4;
- 	      break;
-+	    case DW_FORM_flag_present:
-+	      break;
- 	    case DW_FORM_addr:
- 	      ptr += ptr_size;
- 	      break;
-@@ -878,10 +886,12 @@
- 	      break;
- 	    case DW_FORM_ref4:
- 	    case DW_FORM_data4:
-+	    case DW_FORM_sec_offset:
- 	      ptr += 4;
- 	      break;
- 	    case DW_FORM_ref8:
- 	    case DW_FORM_data8:
-+	    case DW_FORM_ref_sig8:
- 	      ptr += 8;
- 	      break;
- 	    case DW_FORM_sdata:
-@@ -910,6 +920,7 @@
- 	      form = DW_FORM_block1;
- 	      break;
- 	    case DW_FORM_block:
-+	    case DW_FORM_exprloc:
- 	      len = read_uleb128 (ptr);
- 	      form = DW_FORM_block1;
- 	      assert (len < UINT_MAX);
-@@ -1213,7 +1224,7 @@
- 		}
- 	      
- 	      cu_version = read_16 (ptr);
--	      if (cu_version != 2 && cu_version != 3)
-+	      if (cu_version != 2 && cu_version != 3 && cu_version != 4)
- 		{
- 		  error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
- 			 cu_version);


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/
@ 2019-09-08  6:43 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2019-09-08  6:43 UTC (permalink / raw
  To: gentoo-commits

commit:     9985eb2bfefb4c77f2f56d1c468cc3ea2f9e2969
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  8 06:14:26 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Sep  8 06:14:26 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9985eb2b

dev-util/debugedit: Drop old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-util/debugedit/debugedit-4.14.2-r1.ebuild      | 92 ----------------------
 .../files/debugedit-4.14.2-no-reorder.patch        | 57 --------------
 2 files changed, 149 deletions(-)

diff --git a/dev-util/debugedit/debugedit-4.14.2-r1.ebuild b/dev-util/debugedit/debugedit-4.14.2-r1.ebuild
deleted file mode 100644
index ad6b532ec6c..00000000000
--- a/dev-util/debugedit/debugedit-4.14.2-r1.ebuild
+++ /dev/null
@@ -1,92 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit flag-o-matic
-
-MY_P=rpm-${PV}
-DESCRIPTION="Stand-alone debugedit from RPM"
-HOMEPAGE="http://www.rpm.org
-	https://github.com/rpm-software-management/rpm"
-SRC_URI="http://ftp.rpm.org/releases/rpm-$(ver_cut 1-2).x/${MY_P}.tar.bz2"
-
-LICENSE="GPL-2+ LGPL-2+"
-SLOT="0"
-KEYWORDS="amd64 hppa ~ia64 ppc ppc64 x86 ~amd64-linux ~x86-linux"
-IUSE=""
-
-RDEPEND="
-	sys-libs/zlib:=
-	>=dev-libs/popt-1.7
-	dev-libs/elfutils
-	dev-libs/nss
-"
-DEPEND="${RDEPEND}
-	virtual/pkgconfig
-"
-
-S=${WORKDIR}/${MY_P}
-
-src_prepare() {
-	# do not reorder sections, ever; otherwise it breaks gcc
-	# https://bugs.gentoo.org/666954
-	eapply "${FILESDIR}"/debugedit-4.14.2-no-reorder.patch
-	eapply_user
-
-	# cheat it into believing we're bundling db
-	mkdir -p db/dist || die
-	touch db/dist/configure || die
-	chmod +x db/dist/configure || die
-	echo 'install:' > db3/Makefile || die
-
-	# TODO: why do we need to do this?
-	mkdir rpm || die
-	find -name '*.h' -exec cp {} rpm/ ';' || die
-}
-
-src_configure() {
-	append-cppflags -I"${EPREFIX}/usr/include/nss" -I"${EPREFIX}/usr/include/nspr"
-	local myconf=(
-		# force linking to static librpmio
-		--disable-shared
-
-		# disable linking compression libraries
-		ac_cv_header_bzlib_h=no
-		ac_cv_header_lzma_h=no
-		--disable-zstd
-
-		# fake some libraries we don't use
-		ac_cv_header_magic_h=yes
-		ac_cv_lib_magic_magic_open=yes
-
-		# use nss as crypto provider
-		--with-crypto=nss
-
-		# disable other stuff irrelevant to debugedit
-		--disable-nls
-		--disable-python
-		--without-acl
-		--without-archive
-		--without-cap
-		--without-external-db
-		--without-hackingdocs
-		--without-lua
-		--without-selinux
-	)
-	econf "${myconf[@]}"
-}
-
-src_compile() {
-	emake -C misc
-	emake -C rpmio
-	emake debugedit
-}
-
-src_test() {
-	:
-}
-
-src_install() {
-	dobin debugedit
-}

diff --git a/dev-util/debugedit/files/debugedit-4.14.2-no-reorder.patch b/dev-util/debugedit/files/debugedit-4.14.2-no-reorder.patch
deleted file mode 100644
index 0c196a842b4..00000000000
--- a/dev-util/debugedit/files/debugedit-4.14.2-no-reorder.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 0779d60cb5941610dd1f31632aa1655bf2cc447a Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Sat, 6 Oct 2018 17:56:00 +0100
-Subject: [PATCH] debugedit: don't reorder sections
-
-In https://bugs.gentoo.org/666954 debugedit processed
-crtbeginS.o from gcc-8.2.0 and turned into invalid ELF:
-
-```
-$ cp crtbeginS-ok-7.3.0.o.back crtbeginS-ok-7.3.0.o
-$ debugedit -i -b $(pwd) -d /usr/src/debug -l ./foo crtbeginS-ok-7.3.0.o
-$ export LANG=C
-$ readelf -a crtbeginS-ok-7.3.0.o.back >/dev/null && echo ok
-readelf: Warning: [ 9]: Info field (8) should index a relocatable section.
-ok
-
-$ readelf -a crtbeginS-ok-7.3.0.o >/dev/null && echo ok
-readelf: Warning: [ 9]: Info field (8) should index a relocatable section.
-readelf: Error:  bad symbol index: 54495f00 in reloc
-readelf: Error:  bad symbol index: 656c6261 in reloc
-readelf: Error:  bad symbol index: 62615465 in reloc
-readelf: Error:  bad symbol index: 69665f61 in reloc
-readelf: Warning: local symbol 11 found at index >= symtab's sh_info value of 11
-readelf: Warning: local symbol 14 found at index >= symtab's sh_info value of 11
-readelf: Warning: local symbol 15 found at index >= symtab's sh_info value of 11
-```
-
-Ths fix is not to reorder sections as debugedit does not
-account for offset change.
-
-debugedit already does it for final executables and shared libraries.
-
-Bug: https://bugs.gentoo.org/666954
-Closes: https://github.com/rpm-software-management/rpm/issues/423
-Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
----
- tools/debugedit.c | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/tools/debugedit.c b/tools/debugedit.c
-index 84568dd29..a723283c0 100644
---- a/tools/debugedit.c
-+++ b/tools/debugedit.c
-@@ -2347,10 +2347,9 @@ fdopen_dso (int fd, const char *name)
-       goto error_out;
-     }
- 
--  /* If there are phdrs we want to maintain the layout of the
--     allocated sections in the file.  */
--  if (phnum != 0)
--    elf_flagelf (elf, ELF_C_SET, ELF_F_LAYOUT);
-+  /* We maintain the layout of the allocated sections in the file:
-+     https://github.com/rpm-software-management/rpm/issues/423  */
-+  elf_flagelf (elf, ELF_C_SET, ELF_F_LAYOUT);
- 
-   memset (dso, 0, sizeof(DSO));
-   dso->elf = elf;


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/
@ 2021-09-03  6:53 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2021-09-03  6:53 UTC (permalink / raw
  To: gentoo-commits

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 <slyfox@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 <slyfox@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 <mark@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 <mark@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
+


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/
@ 2022-02-02  6:14 Sam James
  0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-02-02  6:14 UTC (permalink / raw
  To: gentoo-commits

commit:     8d9fa65d81d14143e4c6a45cf46d0a5147d68b8b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  2 06:12:39 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb  2 06:13:54 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8d9fa65d

dev-util/debugedit: add HPPA patch

Fixes tests but it's really a runtime error. Should affect
non-HPPA uses too if cross-compiling or otherwise handling
PARISC objects.

Bug: https://bugs.gentoo.org/831766
Thanks-to: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/debugedit/debugedit-5.0-r1.ebuild        | 42 +++++++++++++++++++++++
 dev-util/debugedit/files/debugedit-5.0-hppa.patch | 25 ++++++++++++++
 2 files changed, 67 insertions(+)

diff --git a/dev-util/debugedit/debugedit-5.0-r1.ebuild b/dev-util/debugedit/debugedit-5.0-r1.ebuild
new file mode 100644
index 000000000000..a06dbefac224
--- /dev/null
+++ b/dev-util/debugedit/debugedit-5.0-r1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2022 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 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
+
+RDEPEND="
+	>=dev-libs/elfutils-0.176-r1
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	sys-apps/help2man
+	virtual/pkgconfig
+	verify-sig? (
+		sec-keys/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
+	"${FILESDIR}"/${P}-hppa.patch
+)
+
+src_prepare() {
+	default
+	eautoreconf
+}

diff --git a/dev-util/debugedit/files/debugedit-5.0-hppa.patch b/dev-util/debugedit/files/debugedit-5.0-hppa.patch
new file mode 100644
index 000000000000..296b9a4390ff
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.0-hppa.patch
@@ -0,0 +1,25 @@
+https://sourceware.org/git/?p=debugedit.git;a=commitdiff;h=86130f41d05584581530fc65aa119badb400f4d4
+
+From: Mark Wielaard <mark@klomp.org>
+Date: Thu, 18 Nov 2021 14:14:28 +0100
+Subject: [PATCH] debugedit: Handle hppa EM_PARISC and R_PARISC_DIR32
+
+	* tools/debugedit.c (setup_relbuf): Handle EM_PARISC
+
+https://sourceware.org/bugzilla/show_bug.cgi?id=28598
+
+Patch-provided-by: dave.anglin@bell.net
+Signed-off-by: Mark Wielaard <mark@klomp.org>
+--- a/tools/debugedit.c
++++ b/tools/debugedit.c
+@@ -590,6 +590,10 @@ setup_relbuf (DSO *dso, debug_section *sec, int *reltype)
+ 	  if (rtype != R_390_32)
+ 	    goto fail;
+ 	  break;
++	case EM_PARISC:
++	  if (rtype != R_PARISC_DIR32)
++	    goto fail;
++	  break;
+ 	case EM_IA_64:
+ 	  if (rtype != R_IA64_SECREL32LSB)
+ 	    goto fail;


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/
@ 2022-07-18  0:26 Sam James
  0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-07-18  0:26 UTC (permalink / raw
  To: gentoo-commits

commit:     3c3c878c44cb226d776bd989b0206e543dd9ac46
Author:     brahmajit das <brahmajit.xyz <AT> gmail <DOT> com>
AuthorDate: Sat Jul 16 04:36:45 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 18 00:26:12 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c3c878c

dev-util/debugedit: Fix build on musl

musl doesn't provide error.h as a result debugedit is failing to build
on musl. So we're creating a error define that redefines the err
function and takes precedence over it. Thanks to gentoo developer
Anthony G. Basile <blueness <AT> gentoo.org> for the patch idea.

Signed-off-by: brahmajit das <brahmajit.xyz <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/26223
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/debugedit/debugedit-5.0-r1.ebuild         |  1 +
 .../files/debugedit-5.0-musl-error.h-fix.patch     | 50 ++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/dev-util/debugedit/debugedit-5.0-r1.ebuild b/dev-util/debugedit/debugedit-5.0-r1.ebuild
index 18f1e7b7cde5..f510f92c003b 100644
--- a/dev-util/debugedit/debugedit-5.0-r1.ebuild
+++ b/dev-util/debugedit/debugedit-5.0-r1.ebuild
@@ -34,6 +34,7 @@ PATCHES=(
 	"${FILESDIR}"/${P}-readelf.patch
 	"${FILESDIR}"/${P}-zero-dir-entry.patch
 	"${FILESDIR}"/${P}-hppa.patch
+	"${FILESDIR}"/${P}-musl-error.h-fix.patch
 )
 
 src_prepare() {

diff --git a/dev-util/debugedit/files/debugedit-5.0-musl-error.h-fix.patch b/dev-util/debugedit/files/debugedit-5.0-musl-error.h-fix.patch
new file mode 100644
index 000000000000..4c7f23911108
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.0-musl-error.h-fix.patch
@@ -0,0 +1,50 @@
+# musl doesn't provide error.h as a result debugedit is failing to build on
+# musl.
+#
+# With advice from developer Anthony G. Basile <blueness@gentoo.org> I went
+# with creating a define that redefines the err function. The major
+# improvements over the previous implementation is that this time the patch is
+# smaller and more readable compared to previous implementation.
+#
+# Closes: https://bugs.gentoo.org/714206
+--- a/configure.ac
++++ b/configure.ac
+@@ -57,6 +57,8 @@ PKG_CHECK_MODULES([LIBDW], [libdw])
+
+ # Checks for header files.
+ AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h unistd.h])
++AC_CHECK_HEADERS([error.h],
++		 [AC_DEFINE(HAVE_ERROR_H, 1, [has error.h -- non musl system])])
+
+ # Checks for typedefs, structures, and compiler characteristics.
+ AC_CHECK_HEADER_STDBOOL
+--- a/tools/debugedit.c
++++ b/tools/debugedit.c
+@@ -25,7 +25,12 @@
+ #include <byteswap.h>
+ #include <endian.h>
+ #include <errno.h>
++#ifdef HAVE_ERROR_H
+ #include <error.h>
++#else
++#include <err.h>
++#define error(status, errno, ...) err(status, __VA_ARGS__)
++#endif
+ #include <limits.h>
+ #include <string.h>
+ #include <stdlib.h>
+--- a/tools/sepdebugcrcfix.c
++++ b/tools/sepdebugcrcfix.c
+@@ -29,7 +29,12 @@
+ #include <endian.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#ifdef HAVE_ERROR_H
+ #include <error.h>
++#else
++#include <err.h>
++#define error(status, errno, ...) err(status, __VA_ARGS__)
++#endif
+ #include <libelf.h>
+ #include <gelf.h>
+


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/
@ 2023-09-18  9:01 Sam James
  0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2023-09-18  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     03f6b6cdc6dcb889208e1c32100f58a2b4d6eab6
Author:     Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Mon Jun 26 21:52:52 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 08:51:56 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03f6b6cd

dev-util/debugedit: Fix build on musl 1.2.4

Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Closes: https://github.com/gentoo/gentoo/pull/31631
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...gedit-5.0-r1.ebuild => debugedit-5.0-r2.ebuild} |  3 ++
 .../debugedit/files/debugedit-5.0-musl-1.2.4.patch | 38 ++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/dev-util/debugedit/debugedit-5.0-r1.ebuild b/dev-util/debugedit/debugedit-5.0-r2.ebuild
similarity index 92%
rename from dev-util/debugedit/debugedit-5.0-r1.ebuild
rename to dev-util/debugedit/debugedit-5.0-r2.ebuild
index 6ec21d7d3bb5..eef678585541 100644
--- a/dev-util/debugedit/debugedit-5.0-r1.ebuild
+++ b/dev-util/debugedit/debugedit-5.0-r2.ebuild
@@ -35,6 +35,9 @@ PATCHES=(
 	"${FILESDIR}"/${P}-zero-dir-entry.patch
 	"${FILESDIR}"/${P}-hppa.patch
 	"${FILESDIR}"/${P}-musl-error.h-fix.patch
+
+	# Upstreamed, remove next release
+	"${FILESDIR}"/${P}-musl-1.2.4.patch
 )
 
 src_prepare() {

diff --git a/dev-util/debugedit/files/debugedit-5.0-musl-1.2.4.patch b/dev-util/debugedit/files/debugedit-5.0-musl-1.2.4.patch
new file mode 100644
index 000000000000..1fe01df67c2a
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.0-musl-1.2.4.patch
@@ -0,0 +1,38 @@
+From 187ba161d1d18ad0d675115d8a9eee7ec1790074 Mon Sep 17 00:00:00 2001
+From: Violet Purcell <vimproved@inventati.org>
+Date: Mon, 26 Jun 2023 21:46:20 +0000
+Subject: [PATCH] Fix build failure on musl 1.2.4 due to removal of LFS64
+ compat symbols.
+
+--- a/tools/sepdebugcrcfix.c
++++ b/tools/sepdebugcrcfix.c
+@@ -144,7 +144,7 @@ crc32 (const char *fname, const char *base_fname, uint32_t *crcp)
+       error (0, errno, _("cannot open \"%s\""), debugname);
+       return false;
+     }
+-  off64_t size = lseek64 (fd, 0, SEEK_END);
++  off_t size = lseek (fd, 0, SEEK_END);
+   if (size == -1)
+     {
+       error (0, errno, _("cannot get size of \"%s\""), debugname);
+@@ -289,7 +289,7 @@ process (Elf *elf, int fd, const char *fname)
+ 	  return true;
+ 	}
+       updated_count++;
+-      off64_t seekto = (shdr->sh_offset + data->d_off
++      off_t seekto = (shdr->sh_offset + data->d_off
+ 			+ (crcp - (const uint8_t *) data->d_buf));
+       uint32_t crc_targetendian = (ehdr->e_ident[EI_DATA] == ELFDATA2LSB
+ 				   ? htole32 (crc) : htobe32 (crc));
+@@ -361,7 +361,7 @@ main (int argc, char **argv)
+ 	error (0, errno, _("cannot chmod \"%s\" to make sure we can read and write"), fname);
+ 
+       bool failed = false;
+-      int fd = open64 (fname, O_RDWR);
++      int fd = open (fname, O_RDWR);
+       if (fd == -1)
+ 	{
+ 	  error (0, errno, _("cannot open \"%s\""), fname);
+-- 
+2.41.0
+


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/
@ 2024-01-28 15:35 Sam James
  0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2024-01-28 15:35 UTC (permalink / raw
  To: gentoo-commits

commit:     b16960beaa13970e77667497eeeccb13c7fba6a9
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Sun Jan 28 14:49:52 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 28 15:32:34 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b16960be

dev-util/debugedit: fix error "Unknown DWARF DW_FORM_0x25 (DW_FORM_strx1)"

This fixes builds with FEATURES="installsources" when compiled with Clang,
allowing to set correct sources path with debugedit for binaries, created with Clang.
The issue was caused by switch from DWARF4 to DWARF5 (by default) in Clang 14.
The patch is taken from upstream commits and repeats fix from Fedora.

Upstream bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28728
See Also: https://bugzilla.redhat.com/show_bug.cgi?id=2064052
Closes: https://bugs.gentoo.org/911306
Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/35054
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/debugedit/debugedit-5.0-r3.ebuild         |  48 +++
 .../files/debugedit-5.0-dw-form-strx-support.patch | 390 +++++++++++++++++++++
 2 files changed, 438 insertions(+)

diff --git a/dev-util/debugedit/debugedit-5.0-r3.ebuild b/dev-util/debugedit/debugedit-5.0-r3.ebuild
new file mode 100644
index 000000000000..465054197278
--- /dev/null
+++ b/dev-util/debugedit/debugedit-5.0-r3.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2024 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
+	verify-sig? ( https://sourceware.org/ftp/debugedit/${PV}/${P}.tar.xz.sig )
+"
+
+LICENSE="GPL-2+ LGPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
+
+RDEPEND="
+	>=dev-libs/elfutils-0.176-r1
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	sys-apps/help2man
+	virtual/pkgconfig
+	verify-sig? (
+		sec-keys/openpgp-keys-debugedit
+	)
+"
+
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/debugedit.gpg
+
+PATCHES=(
+	"${FILESDIR}"/${P}-readelf.patch
+	"${FILESDIR}"/${P}-zero-dir-entry.patch
+	"${FILESDIR}"/${P}-hppa.patch
+	"${FILESDIR}"/${P}-musl-error.h-fix.patch
+
+	# Upstreamed, remove next release
+	"${FILESDIR}"/${P}-musl-1.2.4.patch
+	# From upstream, remove next release
+	"${FILESDIR}"/${P}-dw-form-strx-support.patch
+)
+
+src_prepare() {
+	default
+	eautoreconf
+}

diff --git a/dev-util/debugedit/files/debugedit-5.0-dw-form-strx-support.patch b/dev-util/debugedit/files/debugedit-5.0-dw-form-strx-support.patch
new file mode 100644
index 000000000000..3edc77e8e5ab
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.0-dw-form-strx-support.patch
@@ -0,0 +1,390 @@
+Fixes "Unknown DWARF DW_FORM_0x25" for clang DWARF5 output
+Bug: https://bugs.gentoo.org/911306
+Upstream bug: https://sourceware.org/PR28728
+Source: https://src.fedoraproject.org/rpms/debugedit/blob/rawhide/f/0001-debugedit-Add-support-for-.debug_str_offsets-DW_FORM.patch
+--- a/tools/debugedit.c
++++ b/tools/debugedit.c
+@@ -1,4 +1,5 @@
+ /* Copyright (C) 2001-2003, 2005, 2007, 2009-2011, 2016, 2017 Red Hat, Inc.
++   Copyright (C) 2022, 2023 Mark J. Wielaard <mark@klomp.org>
+    Written by Alexander Larsson <alexl@redhat.com>, 2002
+    Based on code by Jakub Jelinek <jakub@redhat.com>, 2001.
+    String/Line table rewriting by Mark Wielaard <mjw@redhat.com>, 2017.
+@@ -264,6 +264,7 @@ typedef struct
+ })
+ 
+ static uint16_t (*do_read_16) (unsigned char *ptr);
++static uint32_t (*do_read_24) (unsigned char *ptr);
+ static uint32_t (*do_read_32) (unsigned char *ptr);
+ static void (*do_write_16) (unsigned char *ptr, uint16_t val);
+ static void (*do_write_32) (unsigned char *ptr, uint32_t val);
+@@ -271,6 +272,9 @@ static void (*do_write_32) (unsigned char *ptr, uint32_t val);
+ static int ptr_size;
+ static int cu_version;
+ 
++/* The offset into the .debug_str_offsets section for the current CU.  */
++static uint32_t str_offsets_base;
++
+ static inline uint16_t
+ buf_read_ule16 (unsigned char *data)
+ {
+@@ -283,6 +287,18 @@ buf_read_ube16 (unsigned char *data)
+   return data[1] | (data[0] << 8);
+ }
+ 
++static inline uint32_t
++buf_read_ule24 (unsigned char *data)
++{
++  return data[0] | (data[1] << 8) | (data[2] << 16);
++}
++
++static inline uint32_t
++buf_read_ube24 (unsigned char *data)
++{
++  return data[2] | (data[1] << 8) | (data[0] << 16);
++}
++
+ static inline uint32_t
+ buf_read_ule32 (unsigned char *data)
+ {
+@@ -544,10 +560,12 @@ setup_relbuf (DSO *dso, debug_section *sec, int *reltype)
+       /* Relocations against section symbols are uninteresting in REL.  */
+       if (dso->shdr[i].sh_type == SHT_REL && sym.st_value == 0)
+ 	continue;
+-      /* Only consider relocations against .debug_str, .debug_line,
+-	 .debug_line_str, and .debug_abbrev.  */
++      /* Only consider relocations against .debug_str,
++	 .debug_str_offsets, .debug_line, .debug_line_str, and
++	 .debug_abbrev.  */
+       if (sym.st_shndx == 0 ||
+ 	  (sym.st_shndx != debug_sections[DEBUG_STR].sec
++	   && sym.st_shndx != debug_sections[DEBUG_STR_OFFSETS].sec
+ 	   && sym.st_shndx != debug_sections[DEBUG_LINE].sec
+ 	   && sym.st_shndx != debug_sections[DEBUG_LINE_STR].sec
+ 	   && sym.st_shndx != debug_sections[DEBUG_ABBREV].sec))
+@@ -684,6 +702,59 @@ update_rela_data (DSO *dso, struct debug_section *sec)
+   free (sec->relbuf);
+ }
+ 
++static inline uint32_t
++do_read_uleb128 (unsigned char *ptr)
++{
++  unsigned char *uleb_ptr = ptr;
++  return read_uleb128 (uleb_ptr);
++}
++
++static inline uint32_t
++do_read_str_form_relocated (DSO *dso, uint32_t form, unsigned char *ptr)
++{
++  uint32_t idx;
++  switch (form)
++    {
++    case DW_FORM_strp:
++    case DW_FORM_line_strp:
++      return do_read_32_relocated (ptr);
++
++    case DW_FORM_strx1:
++      idx = *ptr;
++      break;
++    case DW_FORM_strx2:
++      idx = do_read_16 (ptr);
++      break;
++    case DW_FORM_strx3:
++      idx = do_read_24 (ptr);
++      break;
++    case DW_FORM_strx4:
++      idx = do_read_32 (ptr);
++      break;
++    case DW_FORM_strx:
++      idx = do_read_uleb128 (ptr);
++      break;
++    default:
++      error (1, 0, "Unhandled string form DW_FORM_0x%x", form);
++      return -1;
++    }
++
++  unsigned char *str_off_ptr = debug_sections[DEBUG_STR_OFFSETS].data;
++  str_off_ptr += str_offsets_base;
++  str_off_ptr += idx * 4;
++
++  /* Switch rel reading... */
++  REL *old_relptr = relptr;
++  REL *old_relend = relend;
++  setup_relbuf(dso, &debug_sections[DEBUG_STR_OFFSETS], &reltype);
++
++  uint32_t str_off = do_read_32_relocated (str_off_ptr);
++
++  relptr = old_relptr;
++  relend = old_relend;
++  return str_off;
++}
++
+ struct abbrev_attr
+   {
+     unsigned int attr;
+@@ -789,7 +860,12 @@ no_memory:
+ 		       || form == DW_FORM_addrx1
+ 		       || form == DW_FORM_addrx2
+ 		       || form == DW_FORM_addrx3
+-		       || form == DW_FORM_addrx4)))
++		       || form == DW_FORM_addrx4
++		       || form == DW_FORM_strx
++		       || form == DW_FORM_strx1
++		       || form == DW_FORM_strx2
++		       || form == DW_FORM_strx3
++		       || form == DW_FORM_strx4)))
+ 	    {
+ 	      error (0, 0, "%s: Unknown DWARF DW_FORM_0x%x", dso->filename,
+ 		     form);
+@@ -1520,9 +1596,10 @@ edit_dwarf2_line (DSO *dso)
+     }
+ }
+ 
+-/* Record or adjust (according to phase) DW_FORM_strp or DW_FORM_line_strp.  */
++/* Record or adjust (according to phase) DW_FORM_strp or DW_FORM_line_strp.
++   Also handles DW_FORM_strx, but just for recording the (indexed) string.  */
+ static void
+-edit_strp (DSO *dso, bool line_strp, unsigned char *ptr, int phase,
++edit_strp (DSO *dso, uint32_t form, unsigned char *ptr, int phase,
+ 	   bool handled_strp)
+ {
+   unsigned char *ptr_orig = ptr;
+@@ -1537,16 +1614,19 @@ edit_strp (DSO *dso, bool line_strp, unsigned char *ptr, int phase,
+ 	 recorded. */
+       if (! handled_strp)
+ 	{
+-	  size_t idx = do_read_32_relocated (ptr);
+-	  record_existing_string_entry_idx (line_strp, dso, idx);
++	  size_t idx = do_read_str_form_relocated (dso, form, ptr);
++	  record_existing_string_entry_idx (form == DW_FORM_line_strp,
++					    dso, idx);
+ 	}
+     }
+-  else if (line_strp
+-	   ? need_line_strp_update : need_strp_update) /* && phase == 1 */
++  else if ((form == DW_FORM_strp
++	    || form == DW_FORM_line_strp) /* DW_FORM_strx stays the same.  */
++	   && (form == DW_FORM_line_strp
++	       ? need_line_strp_update : need_strp_update)) /* && phase == 1 */
+     {
+       struct stridxentry *entry;
+       size_t idx, new_idx;
+-      struct strings *strings = (line_strp
++      struct strings *strings = (form == DW_FORM_line_strp
+ 				 ? &dso->debug_line_str : &dso->debug_str);
+       idx = do_read_32_relocated (ptr);
+       entry = string_find_entry (strings, idx);
+@@ -1926,9 +2006,10 @@ read_dwarf5_line_entries (DSO *dso, unsigned char **ptrp,
+ 
+ 	  switch (form)
+ 	    {
++	    /* Note we don't expect DW_FORM_strx in the line table.  */
+ 	    case DW_FORM_strp:
+ 	    case DW_FORM_line_strp:
+-	      edit_strp (dso, line_strp, *ptrp, phase, handled_strp);
++	      edit_strp (dso, form, *ptrp, phase, handled_strp);
+ 	      break;
+ 	    }
+ 
+@@ -2110,11 +2191,12 @@ find_new_list_offs (struct debug_lines *lines, size_t idx)
+ 
+ /* Read DW_FORM_strp or DW_FORM_line_strp collecting compilation directory.  */
+ static void
+-edit_attributes_str_comp_dir (bool line_strp, DSO *dso, unsigned char **ptrp,
++edit_attributes_str_comp_dir (uint32_t form, DSO *dso, unsigned char **ptrp,
+ 			      int phase, char **comp_dirp, bool *handled_strpp)
+ {
+   const char *dir;
+-  size_t idx = do_read_32_relocated (*ptrp);
++  size_t idx = do_read_str_form_relocated (dso, form, *ptrp);
++  bool line_strp = form == DW_FORM_line_strp;
+   /* In phase zero we collect the comp_dir.  */
+   if (phase == 0)
+     {
+@@ -2245,20 +2327,29 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase)
+ 			}
+ 		    }
+ 		}
+-	      else if (form == DW_FORM_strp)
+-		edit_attributes_str_comp_dir (false /* line_strp */, dso,
++	      else if (form == DW_FORM_strp
++		       || form == DW_FORM_line_strp
++		       || form == DW_FORM_strx
++		       || form == DW_FORM_strx1
++		       || form == DW_FORM_strx2
++		       || form == DW_FORM_strx3
++		       || form == DW_FORM_strx4)
++		edit_attributes_str_comp_dir (form, dso,
+ 					      &ptr, phase, &comp_dir,
+ 					      &handled_strp);
+-	      else if (form == DW_FORM_line_strp)
+-		edit_attributes_str_comp_dir (true /* line_strp */, dso, &ptr,
+-					      phase, &comp_dir, &handled_strp);
+ 	    }
+ 	  else if ((t->tag == DW_TAG_compile_unit
+ 		    || t->tag == DW_TAG_partial_unit)
+ 		   && ((form == DW_FORM_strp
+ 			&& debug_sections[DEBUG_STR].data)
+ 		       || (form == DW_FORM_line_strp
+-			   && debug_sections[DEBUG_LINE_STR].data))
++			   && debug_sections[DEBUG_LINE_STR].data)
++		       || ((form == DW_FORM_strx
++			    || form == DW_FORM_strx1
++			    || form == DW_FORM_strx2
++			    || form == DW_FORM_strx3
++			    || form == DW_FORM_strx4)
++			   && debug_sections[DEBUG_STR_OFFSETS].data))
+ 		   && t->attr[i].attr == DW_AT_name)
+ 	    {
+ 	      bool line_strp = form == DW_FORM_line_strp;
+@@ -2267,7 +2358,7 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase)
+ 		 unit. If starting with / it is a full path name.
+ 		 Note that we don't handle DW_FORM_string in this
+ 		 case.  */
+-	      size_t idx = do_read_32_relocated (ptr);
++	      size_t idx = do_read_str_form_relocated (dso, form, ptr);
+ 
+ 	      /* In phase zero we will look for a comp_dir to use.  */
+ 	      if (phase == 0)
+@@ -2314,10 +2405,13 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase)
+ 	  switch (form)
+ 	    {
+ 	    case DW_FORM_strp:
+-	      edit_strp (dso, false /* line_strp */, ptr, phase, handled_strp);
+-	      break;
+ 	    case DW_FORM_line_strp:
+-	      edit_strp (dso, true /* line_strp */, ptr, phase, handled_strp);
++	    case DW_FORM_strx:
++	    case DW_FORM_strx1:
++	    case DW_FORM_strx2:
++	    case DW_FORM_strx3:
++	    case DW_FORM_strx4:
++	      edit_strp (dso, form, ptr, phase, handled_strp);
+ 	      break;
+ 	    }
+ 
+@@ -2404,6 +2498,8 @@ edit_info (DSO *dso, int phase, struct debug_section *sec)
+   uint32_t value;
+   htab_t abbrev;
+   struct abbrev_tag tag, *t;
++  int i;
++  bool first;
+ 
+   ptr = sec->data;
+   if (ptr == NULL)
+@@ -2507,6 +2603,8 @@ edit_info (DSO *dso, int phase, struct debug_section *sec)
+       if (abbrev == NULL)
+ 	return 1;
+ 
++      first = true;
++      str_offsets_base = 0;
+       while (ptr < endcu)
+ 	{
+ 	  tag.entry = read_uleb128 (ptr);
+@@ -2521,6 +2619,30 @@ edit_info (DSO *dso, int phase, struct debug_section *sec)
+ 	      return 1;
+ 	    }
+ 
++	  /* We need str_offsets_base before processing the CU. */
++	  if (first)
++	    {
++	      first = false;
++	      if (cu_version >= 5)
++		{
++		  uint32_t form;
++		  unsigned char *fptr = ptr;
++		  // We will read this DIE again, save and reset rel reading
++		  REL *old_relptr = relptr;
++		  for (i = 0; i < t->nattr; ++i)
++		    {
++		      form = t->attr[i].form;
++		      if (t->attr[i].attr == DW_AT_str_offsets_base)
++			{
++			  str_offsets_base = do_read_32_relocated (fptr);
++			  break;
++			}
++		      skip_form (dso, &form, &fptr);
++		    }
++		  // Reset the rel reading...
++		  relptr = old_relptr;
++		}
++	    }
+ 	  ptr = edit_attributes (dso, ptr, t, phase);
+ 	  if (ptr == NULL)
+ 	    break;
+@@ -2554,6 +2676,41 @@ edit_dwarf2_any_str (DSO *dso, struct strings *strings, debug_section *secp)
+   strings->str_buf = strdata->d_buf;
+ }
+ 
++/* Rebuild .debug_str_offsets.  */
++static void
++update_str_offsets (DSO *dso)
++{
++  unsigned char *ptr = debug_sections[DEBUG_STR_OFFSETS].data;
++  unsigned char *endp = ptr + debug_sections[DEBUG_STR_OFFSETS].size;
++
++  while (ptr < endp)
++    {
++      /* Read header, unit_length, version and padding.  */
++      if (endp - ptr < 3 * 4)
++	break;
++      uint32_t unit_length = read_32 (ptr);
++      if (unit_length == 0xffffffff || endp - ptr < unit_length)
++	break;
++      unsigned char *endidxp = ptr + unit_length;
++      uint32_t version = read_32 (ptr);
++      if (version != 5)
++	break;
++      uint32_t padding = read_32 (ptr);
++      if (padding != 0)
++	break;
++
++      while (ptr < endidxp)
++	{
++	  struct stridxentry *entry;
++	  size_t idx, new_idx;
++	  idx = do_read_32_relocated (ptr);
++	  entry = string_find_entry (&dso->debug_str, idx);
++	  new_idx = strent_offset (entry->entry);
++	  write_32_relocated (ptr, new_idx);
++	}
++    }
++}
++
+ static int
+ edit_dwarf2 (DSO *dso)
+ {
+@@ -2675,6 +2832,7 @@ edit_dwarf2 (DSO *dso)
+   if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
+     {
+       do_read_16 = buf_read_ule16;
++      do_read_24 = buf_read_ule24;
+       do_read_32 = buf_read_ule32;
+       do_write_16 = dwarf2_write_le16;
+       do_write_32 = dwarf2_write_le32;
+@@ -2682,6 +2840,7 @@ edit_dwarf2 (DSO *dso)
+   else if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2MSB)
+     {
+       do_read_16 = buf_read_ube16;
++      do_read_24 = buf_read_ube24;
+       do_read_32 = buf_read_ube32;
+       do_write_16 = dwarf2_write_be16;
+       do_write_32 = dwarf2_write_be32;
+@@ -2997,6 +3156,15 @@ edit_dwarf2 (DSO *dso)
+     dirty_section (DEBUG_MACRO);
+   if (need_stmt_update || need_line_strp_update)
+     dirty_section (DEBUG_LINE);
++  if (need_strp_update && debug_sections[DEBUG_STR_OFFSETS].data != NULL)
++    {
++      setup_relbuf(dso, &debug_sections[DEBUG_STR_OFFSETS], &reltype);
++      rel_updated = false;
++      update_str_offsets (dso);
++      dirty_section (DEBUG_STR_OFFSETS);
++      if (rel_updated)
++	update_rela_data (dso, &debug_sections[DEBUG_STR_OFFSETS]);
++    }
+ 
+   /* Update any relocations addends we might have touched. */
+   if (info_rel_updated)
+-- 
+2.42.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-01-28 15:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-28 15:35 [gentoo-commits] repo/gentoo:master commit in: dev-util/debugedit/files/, dev-util/debugedit/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2023-09-18  9:01 Sam James
2022-07-18  0:26 Sam James
2022-02-02  6:14 Sam James
2021-09-03  6:53 Michał Górny
2019-09-08  6:43 Michał Górny
2019-06-20  8:01 Michał Górny
2019-03-14 12:24 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox