summaryrefslogtreecommitdiff
path: root/dev-util/debugedit
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/debugedit')
-rw-r--r--dev-util/debugedit/Manifest2
-rw-r--r--dev-util/debugedit/debugedit-4.14.2-r1.ebuild92
-rw-r--r--dev-util/debugedit/files/debugedit-4.14.2-no-reorder.patch57
3 files changed, 151 insertions, 0 deletions
diff --git a/dev-util/debugedit/Manifest b/dev-util/debugedit/Manifest
index a8e4db2dadc4..13b7b803daa2 100644
--- a/dev-util/debugedit/Manifest
+++ b/dev-util/debugedit/Manifest
@@ -1,3 +1,5 @@
+AUX debugedit-4.14.2-no-reorder.patch 2225 BLAKE2B 03bac95d316855a9a8e2b78cb7530c5de746b462a32a4fb0887bddf039b371198ea77a0b85b69b6501504e9583832a7f7b055b3c22e3e3b309ecaf995fb164d6 SHA512 7f665c8c985d622e52e87996f1719900131fa7d6455e548cb2cd00b2223231b54b4fc9c24ed3079c93dd5e3c287c03f37aa17072e2e1e5d4f0cd8ee695bf08bc
DIST rpm-4.14.2.tar.bz2 4151934 BLAKE2B eb7e32dd736a195f2e5effc184ee8f2c700dcaf80477574c2112b6c96504d86a67c81e611f82ea35ce244e95fad339bd262eb51c35ada5eeffa8d306b6938cb7 SHA512 22e309e8be936e6070430cedd6f5ea0c3871db4c6aadd0d567a9c418796c178c8dd45d44920d7eaa66681790cc2821347affe471cb215d7a490fe7947fbf291c
+EBUILD debugedit-4.14.2-r1.ebuild 1862 BLAKE2B 7298cef549ff97777f748cb871d01d959ed5b680cf693e4c42b0a7826c13d42df121243788f7c965cf56ef2297a00119dcab40a5914315cb1353bf587eb6971f SHA512 951edb87d4e6c55d73d3837140747ce098562787333198ee0cb35c06418b75d4f4e82b54bb6f23c01a0c98cb6999b402ec307fc35e7d78720713dc25d6df919a
EBUILD debugedit-4.14.2-r2.ebuild 1725 BLAKE2B 7897371964b247c6076d629b6ae6f01473c41d71356c1447bd6f991449320ccda71b6f86b42a3c82c491efec20d2ebf2e4ad559940ce748f4e40f3cd4dac86d9 SHA512 4e36e020e4aada2c378466818763c5b49d888f76627692bf40074ac154678225e77921627ccb2b398026603dfef403548657c1f0068508e309207f41ab097f79
MISC metadata.xml 247 BLAKE2B 1750cec57189e711ca5eba89a78e1d317f0839fa53564fbd39b4e955c28d98f4ae04caf9069afc20a18536cdc92b30fe7b15eb086767c742bad07d9980cfd24b SHA512 d6e2ea8a9d74791bcbf3d6311a66bafc20b8f4db3a576d9a8d54b86d7afb231122b8d87f71f3f46360980adf8d815c633b6d5041f9a30fc8656e8fb66057a282
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 000000000000..ad6b532ec6c8
--- /dev/null
+++ b/dev-util/debugedit/debugedit-4.14.2-r1.ebuild
@@ -0,0 +1,92 @@
+# 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
new file mode 100644
index 000000000000..0c196a842b4c
--- /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;