1 |
commit: 0e56e352403a2405a99465e68218e84a057933b4 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 13 18:07:16 2019 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Mar 14 12:23:41 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e56e352 |
7 |
|
8 |
dev-util/debugedit: Apply GCC breakage workaround |
9 |
|
10 |
Thanks to slyfox for the patch. |
11 |
|
12 |
Closes: https://bugs.gentoo.org/666954 |
13 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
14 |
|
15 |
dev-util/debugedit/debugedit-4.14.2-r1.ebuild | 92 ++++++++++++++++++++++ |
16 |
.../files/debugedit-4.14.2-no-reorder.patch | 57 ++++++++++++++ |
17 |
2 files changed, 149 insertions(+) |
18 |
|
19 |
diff --git a/dev-util/debugedit/debugedit-4.14.2-r1.ebuild b/dev-util/debugedit/debugedit-4.14.2-r1.ebuild |
20 |
new file mode 100644 |
21 |
index 00000000000..0aabb6cf18d |
22 |
--- /dev/null |
23 |
+++ b/dev-util/debugedit/debugedit-4.14.2-r1.ebuild |
24 |
@@ -0,0 +1,92 @@ |
25 |
+# Copyright 1999-2018 Gentoo Foundation |
26 |
+# Distributed under the terms of the GNU General Public License v2 |
27 |
+ |
28 |
+EAPI=7 |
29 |
+ |
30 |
+inherit flag-o-matic |
31 |
+ |
32 |
+MY_P=rpm-${PV} |
33 |
+DESCRIPTION="Stand-alone debugedit from RPM" |
34 |
+HOMEPAGE="http://www.rpm.org |
35 |
+ https://github.com/rpm-software-management/rpm" |
36 |
+SRC_URI="http://ftp.rpm.org/releases/rpm-$(ver_cut 1-2).x/${MY_P}.tar.bz2" |
37 |
+ |
38 |
+LICENSE="GPL-2+ LGPL-2+" |
39 |
+SLOT="0" |
40 |
+KEYWORDS="~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux" |
41 |
+IUSE="" |
42 |
+ |
43 |
+RDEPEND=" |
44 |
+ sys-libs/zlib:= |
45 |
+ >=dev-libs/popt-1.7 |
46 |
+ dev-libs/elfutils |
47 |
+ dev-libs/nss |
48 |
+" |
49 |
+DEPEND="${RDEPEND} |
50 |
+ virtual/pkgconfig |
51 |
+" |
52 |
+ |
53 |
+S=${WORKDIR}/${MY_P} |
54 |
+ |
55 |
+src_prepare() { |
56 |
+ # do not reorder sections, ever; otherwise it breaks gcc |
57 |
+ # https://bugs.gentoo.org/666954 |
58 |
+ eapply "${FILESDIR}"/debugedit-4.14.2-no-reorder.patch |
59 |
+ eapply_user |
60 |
+ |
61 |
+ # cheat it into believing we're bundling db |
62 |
+ mkdir -p db/dist || die |
63 |
+ touch db/dist/configure || die |
64 |
+ chmod +x db/dist/configure || die |
65 |
+ echo 'install:' > db3/Makefile || die |
66 |
+ |
67 |
+ # TODO: why do we need to do this? |
68 |
+ mkdir rpm || die |
69 |
+ find -name '*.h' -exec cp {} rpm/ ';' || die |
70 |
+} |
71 |
+ |
72 |
+src_configure() { |
73 |
+ append-cppflags -I"${EPREFIX}/usr/include/nss" -I"${EPREFIX}/usr/include/nspr" |
74 |
+ local myconf=( |
75 |
+ # force linking to static librpmio |
76 |
+ --disable-shared |
77 |
+ |
78 |
+ # disable linking compression libraries |
79 |
+ ac_cv_header_bzlib_h=no |
80 |
+ ac_cv_header_lzma_h=no |
81 |
+ --disable-zstd |
82 |
+ |
83 |
+ # fake some libraries we don't use |
84 |
+ ac_cv_header_magic_h=yes |
85 |
+ ac_cv_lib_magic_magic_open=yes |
86 |
+ |
87 |
+ # use nss as crypto provider |
88 |
+ --with-crypto=nss |
89 |
+ |
90 |
+ # disable other stuff irrelevant to debugedit |
91 |
+ --disable-nls |
92 |
+ --disable-python |
93 |
+ --without-acl |
94 |
+ --without-archive |
95 |
+ --without-cap |
96 |
+ --without-external-db |
97 |
+ --without-hackingdocs |
98 |
+ --without-lua |
99 |
+ --without-selinux |
100 |
+ ) |
101 |
+ econf "${myconf[@]}" |
102 |
+} |
103 |
+ |
104 |
+src_compile() { |
105 |
+ emake -C misc |
106 |
+ emake -C rpmio |
107 |
+ emake debugedit |
108 |
+} |
109 |
+ |
110 |
+src_test() { |
111 |
+ : |
112 |
+} |
113 |
+ |
114 |
+src_install() { |
115 |
+ dobin debugedit |
116 |
+} |
117 |
|
118 |
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 |
119 |
new file mode 100644 |
120 |
index 00000000000..0c196a842b4 |
121 |
--- /dev/null |
122 |
+++ b/dev-util/debugedit/files/debugedit-4.14.2-no-reorder.patch |
123 |
@@ -0,0 +1,57 @@ |
124 |
+From 0779d60cb5941610dd1f31632aa1655bf2cc447a Mon Sep 17 00:00:00 2001 |
125 |
+From: Sergei Trofimovich <slyfox@g.o> |
126 |
+Date: Sat, 6 Oct 2018 17:56:00 +0100 |
127 |
+Subject: [PATCH] debugedit: don't reorder sections |
128 |
+ |
129 |
+In https://bugs.gentoo.org/666954 debugedit processed |
130 |
+crtbeginS.o from gcc-8.2.0 and turned into invalid ELF: |
131 |
+ |
132 |
+``` |
133 |
+$ cp crtbeginS-ok-7.3.0.o.back crtbeginS-ok-7.3.0.o |
134 |
+$ debugedit -i -b $(pwd) -d /usr/src/debug -l ./foo crtbeginS-ok-7.3.0.o |
135 |
+$ export LANG=C |
136 |
+$ readelf -a crtbeginS-ok-7.3.0.o.back >/dev/null && echo ok |
137 |
+readelf: Warning: [ 9]: Info field (8) should index a relocatable section. |
138 |
+ok |
139 |
+ |
140 |
+$ readelf -a crtbeginS-ok-7.3.0.o >/dev/null && echo ok |
141 |
+readelf: Warning: [ 9]: Info field (8) should index a relocatable section. |
142 |
+readelf: Error: bad symbol index: 54495f00 in reloc |
143 |
+readelf: Error: bad symbol index: 656c6261 in reloc |
144 |
+readelf: Error: bad symbol index: 62615465 in reloc |
145 |
+readelf: Error: bad symbol index: 69665f61 in reloc |
146 |
+readelf: Warning: local symbol 11 found at index >= symtab's sh_info value of 11 |
147 |
+readelf: Warning: local symbol 14 found at index >= symtab's sh_info value of 11 |
148 |
+readelf: Warning: local symbol 15 found at index >= symtab's sh_info value of 11 |
149 |
+``` |
150 |
+ |
151 |
+Ths fix is not to reorder sections as debugedit does not |
152 |
+account for offset change. |
153 |
+ |
154 |
+debugedit already does it for final executables and shared libraries. |
155 |
+ |
156 |
+Bug: https://bugs.gentoo.org/666954 |
157 |
+Closes: https://github.com/rpm-software-management/rpm/issues/423 |
158 |
+Signed-off-by: Sergei Trofimovich <slyfox@g.o> |
159 |
+--- |
160 |
+ tools/debugedit.c | 7 +++---- |
161 |
+ 1 file changed, 3 insertions(+), 4 deletions(-) |
162 |
+ |
163 |
+diff --git a/tools/debugedit.c b/tools/debugedit.c |
164 |
+index 84568dd29..a723283c0 100644 |
165 |
+--- a/tools/debugedit.c |
166 |
++++ b/tools/debugedit.c |
167 |
+@@ -2347,10 +2347,9 @@ fdopen_dso (int fd, const char *name) |
168 |
+ goto error_out; |
169 |
+ } |
170 |
+ |
171 |
+- /* If there are phdrs we want to maintain the layout of the |
172 |
+- allocated sections in the file. */ |
173 |
+- if (phnum != 0) |
174 |
+- elf_flagelf (elf, ELF_C_SET, ELF_F_LAYOUT); |
175 |
++ /* We maintain the layout of the allocated sections in the file: |
176 |
++ https://github.com/rpm-software-management/rpm/issues/423 */ |
177 |
++ elf_flagelf (elf, ELF_C_SET, ELF_F_LAYOUT); |
178 |
+ |
179 |
+ memset (dso, 0, sizeof(DSO)); |
180 |
+ dso->elf = elf; |