1 |
commit: 3f6242408c1dc87441a96fcac14302ae14e02bef |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Apr 20 08:07:43 2021 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Apr 20 08:08:44 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f624240 |
7 |
|
8 |
sys-libs/binutils-libs: fix ctf/bfd relinking order |
9 |
|
10 |
Before the change libctf could install before libbfd |
11 |
into target location. That triggers libtool to link |
12 |
against system's libbfd. |
13 |
|
14 |
The change pulls in makefile depends to make sure |
15 |
libbfd gets installed first for libtool to always |
16 |
find a local copy. |
17 |
|
18 |
Reported-by: Andreas K. Hüttel |
19 |
Reported-by: Magnus Granberg |
20 |
Bug: https://bugs.gentoo.org/783777 |
21 |
Package-Manager: Portage-3.0.18, Repoman-3.0.3 |
22 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
23 |
|
24 |
.../binutils-libs/binutils-libs-2.36.1-r1.ebuild | 140 +++++++++++++++++++++ |
25 |
.../files/binutils-libs-2.36.1-bfd-ctf.patch | 68 ++++++++++ |
26 |
.../files/binutils-libs-2.36.1-ld-ctf.patch | 48 +++++++ |
27 |
3 files changed, 256 insertions(+) |
28 |
|
29 |
diff --git a/sys-libs/binutils-libs/binutils-libs-2.36.1-r1.ebuild b/sys-libs/binutils-libs/binutils-libs-2.36.1-r1.ebuild |
30 |
new file mode 100644 |
31 |
index 00000000000..ced73ffd868 |
32 |
--- /dev/null |
33 |
+++ b/sys-libs/binutils-libs/binutils-libs-2.36.1-r1.ebuild |
34 |
@@ -0,0 +1,140 @@ |
35 |
+# Copyright 1999-2021 Gentoo Authors |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI=7 |
39 |
+ |
40 |
+PATCH_VER=1 |
41 |
+PATCH_DEV=dilfridge |
42 |
+ |
43 |
+inherit libtool toolchain-funcs multilib-minimal |
44 |
+ |
45 |
+MY_PN="binutils" |
46 |
+MY_P="${MY_PN}-${PV}" |
47 |
+PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} |
48 |
+PATCH_DEV=${PATCH_DEV:-slyfox} |
49 |
+ |
50 |
+DESCRIPTION="Core binutils libraries (libbfd, libopcodes, libiberty) for external packages" |
51 |
+HOMEPAGE="https://sourceware.org/binutils/" |
52 |
+SRC_URI="mirror://gnu/binutils/${MY_P}.tar.xz |
53 |
+ https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${MY_PN}-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" |
54 |
+ |
55 |
+LICENSE="|| ( GPL-3 LGPL-3 )" |
56 |
+SLOT="0/${PV}" |
57 |
+IUSE="64-bit-bfd cet multitarget nls static-libs" |
58 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
59 |
+ |
60 |
+BDEPEND="nls? ( sys-devel/gettext )" |
61 |
+DEPEND="sys-libs/zlib[${MULTILIB_USEDEP}]" |
62 |
+# Need a newer binutils-config that'll reset include/lib symlinks for us. |
63 |
+RDEPEND="${DEPEND} |
64 |
+ >=sys-devel/binutils-config-5 |
65 |
+" |
66 |
+ |
67 |
+PATCHES=( |
68 |
+ "${FILESDIR}"/${PN}-2.35.1-cet.patch |
69 |
+ "${FILESDIR}"/${PN}-2.36.1-bfd-ctf.patch |
70 |
+ "${FILESDIR}"/${PN}-2.36.1-ld-ctf.patch |
71 |
+) |
72 |
+ |
73 |
+S="${WORKDIR}/${MY_P}" |
74 |
+ |
75 |
+MULTILIB_WRAPPED_HEADERS=( |
76 |
+ /usr/include/bfd.h |
77 |
+) |
78 |
+ |
79 |
+src_prepare() { |
80 |
+ if [[ ! -z ${PATCH_VER} ]] ; then |
81 |
+ einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}" |
82 |
+ eapply "${WORKDIR}/patch"/*.patch |
83 |
+ fi |
84 |
+ |
85 |
+ # Fix cross-compile relinking issue, bug #626402 |
86 |
+ elibtoolize |
87 |
+ |
88 |
+ default |
89 |
+} |
90 |
+ |
91 |
+pkgversion() { |
92 |
+ printf "Gentoo ${PVR}" |
93 |
+ [[ -n ${PATCHVER} ]] && printf " p${PATCHVER}" |
94 |
+} |
95 |
+ |
96 |
+multilib_src_configure() { |
97 |
+ local myconf=( |
98 |
+ --enable-obsolete |
99 |
+ --enable-shared |
100 |
+ --enable-threads |
101 |
+ # Newer versions (>=2.24) make this an explicit option. #497268 |
102 |
+ --enable-install-libiberty |
103 |
+ --disable-werror |
104 |
+ --with-bugurl="https://bugs.gentoo.org/" |
105 |
+ --with-pkgversion="$(pkgversion)" |
106 |
+ $(use_enable static-libs static) |
107 |
+ # The binutils eclass enables this flag for all bi-arch builds, |
108 |
+ # but other tools often don't care about that support. Put it |
109 |
+ # beyond a flag if people really want it, but otherwise leave |
110 |
+ # it disabled as it can slow things down on 32bit arches. #438522 |
111 |
+ $(use_enable 64-bit-bfd) |
112 |
+ # This only disables building in the zlib subdir. |
113 |
+ # For binutils itself, it'll use the system version. #591516 |
114 |
+ --without-zlib |
115 |
+ --with-system-zlib |
116 |
+ # We only care about the libs, so disable programs. #528088 |
117 |
+ --disable-{binutils,etc,ld,gas,gold,gprof} |
118 |
+ # Disable modules that are in a combined binutils/gdb tree. #490566 |
119 |
+ --disable-{gdb,libdecnumber,readline,sim} |
120 |
+ # Strip out broken static link flags. |
121 |
+ # https://gcc.gnu.org/PR56750 |
122 |
+ --without-stage1-ldflags |
123 |
+ # We pull in all USE-flags that change ABI in an incompatible |
124 |
+ # way. #666100 |
125 |
+ # USE=multitarget change size of global arrays |
126 |
+ # USE=64-bit-bfd changes data structures of exported API |
127 |
+ --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)-$(usex 64-bit-bfd 64 def) |
128 |
+ |
129 |
+ # avoid automagic dependency on (currently prefix) systems |
130 |
+ # systems with debuginfod library, bug #754753 |
131 |
+ --without-debuginfod |
132 |
+ |
133 |
+ # Allow user to opt into CET for host libraries. |
134 |
+ # Ideally we would like automagic-or-disabled here. |
135 |
+ # But the check does not quite work on i686: bug #760926. |
136 |
+ $(use_enable cet) |
137 |
+ ) |
138 |
+ |
139 |
+ # mips can't do hash-style=gnu ... |
140 |
+ if [[ $(tc-arch) != mips ]] ; then |
141 |
+ myconf+=( --enable-default-hash-style=gnu ) |
142 |
+ fi |
143 |
+ |
144 |
+ use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd ) |
145 |
+ |
146 |
+ use nls \ |
147 |
+ && myconf+=( --without-included-gettext ) \ |
148 |
+ || myconf+=( --disable-nls ) |
149 |
+ |
150 |
+ if [[ ${CHOST} == *-darwin* ]] && use nls ; then |
151 |
+ # fix underlinking in opcodes |
152 |
+ sed -i -e 's/@SHARED_LDFLAGS@/@SHARED_LDFLAGS@ -lintl/' \ |
153 |
+ "${S}"/opcodes/Makefile.in || die |
154 |
+ fi |
155 |
+ |
156 |
+ ECONF_SOURCE=${S} \ |
157 |
+ econf "${myconf[@]}" |
158 |
+ |
159 |
+ # Prevent makeinfo from running as we don't build docs here. |
160 |
+ # bug #622652 |
161 |
+ sed -i \ |
162 |
+ -e '/^MAKEINFO/s:=.*:= true:' \ |
163 |
+ Makefile || die |
164 |
+} |
165 |
+ |
166 |
+multilib_src_install() { |
167 |
+ default |
168 |
+ # Provide libiberty.h directly. |
169 |
+ dosym libiberty/libiberty.h /usr/include/libiberty.h |
170 |
+} |
171 |
+ |
172 |
+multilib_src_install_all() { |
173 |
+ use static-libs || find "${ED}"/usr -name '*.la' -delete |
174 |
+} |
175 |
|
176 |
diff --git a/sys-libs/binutils-libs/files/binutils-libs-2.36.1-bfd-ctf.patch b/sys-libs/binutils-libs/files/binutils-libs-2.36.1-bfd-ctf.patch |
177 |
new file mode 100644 |
178 |
index 00000000000..d7daf683669 |
179 |
--- /dev/null |
180 |
+++ b/sys-libs/binutils-libs/files/binutils-libs-2.36.1-bfd-ctf.patch |
181 |
@@ -0,0 +1,68 @@ |
182 |
+https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=755ba58ebef02e1be9fc6770d00243ba6ed0223c |
183 |
+https://bugs.gentoo.org/783777 |
184 |
+ |
185 |
+From 755ba58ebef02e1be9fc6770d00243ba6ed0223c Mon Sep 17 00:00:00 2001 |
186 |
+From: Nick Alcock <nick.alcock@××××××.com> |
187 |
+Date: Thu, 18 Mar 2021 12:37:52 +0000 |
188 |
+Subject: [PATCH] Add install dependencies for ld -> bfd and libctf -> bfd |
189 |
+ |
190 |
+This stops problems parallel-installing if a relink of libctf is needed. |
191 |
+ |
192 |
+Also adds corresponding install-strip dependencies. |
193 |
+ |
194 |
+ChangeLog |
195 |
+2021-03-18 Nick Alcock <nick.alcock@××××××.com> |
196 |
+ |
197 |
+ PR libctf/27482 |
198 |
+ * Makefile.def: Add install-bfd dependencies for install-libctf and |
199 |
+ install-ld, and install-strip-bfd dependencies for |
200 |
+ install-strip-libctf and install-strip-ld; move the install-ld |
201 |
+ dependency on install-libctf to join it. |
202 |
+ * Makefile.in: Regenerated. |
203 |
+--- |
204 |
+--- a/Makefile.def |
205 |
++++ b/Makefile.def |
206 |
+@@ -448,7 +448,6 @@ dependencies = { module=all-binutils; on=all-intl; }; |
207 |
+ dependencies = { module=all-binutils; on=all-gas; }; |
208 |
+ dependencies = { module=all-binutils; on=all-libctf; }; |
209 |
+ dependencies = { module=all-ld; on=all-libctf; }; |
210 |
+-dependencies = { module=install-ld; on=install-libctf; }; |
211 |
+ |
212 |
+ // We put install-opcodes before install-binutils because the installed |
213 |
+ // binutils might be on PATH, and they might need the shared opcodes |
214 |
+@@ -456,6 +455,14 @@ dependencies = { module=install-ld; on=install-libctf; }; |
215 |
+ dependencies = { module=install-binutils; on=install-opcodes; }; |
216 |
+ dependencies = { module=install-strip-binutils; on=install-strip-opcodes; }; |
217 |
+ |
218 |
++// Likewise for ld, libctf, and bfd. |
219 |
++dependencies = { module=install-libctf; on=install-bfd; }; |
220 |
++dependencies = { module=install-ld; on=install-bfd; }; |
221 |
++dependencies = { module=install-ld; on=install-libctf; }; |
222 |
++dependencies = { module=install-strip-libctf; on=install-strip-bfd; }; |
223 |
++dependencies = { module=install-strip-ld; on=install-strip-bfd; }; |
224 |
++dependencies = { module=install-strip-ld; on=install-strip-libctf; }; |
225 |
++ |
226 |
+ // libopcodes depends on libbfd |
227 |
+ dependencies = { module=install-opcodes; on=install-bfd; }; |
228 |
+ dependencies = { module=install-strip-opcodes; on=install-strip-bfd; }; |
229 |
+--- a/Makefile.in |
230 |
++++ b/Makefile.in |
231 |
+@@ -52170,9 +52170,14 @@ all-stage3-ld: maybe-all-stage3-libctf |
232 |
+ all-stage4-ld: maybe-all-stage4-libctf |
233 |
+ all-stageprofile-ld: maybe-all-stageprofile-libctf |
234 |
+ all-stagefeedback-ld: maybe-all-stagefeedback-libctf |
235 |
+-install-ld: maybe-install-libctf |
236 |
+ install-binutils: maybe-install-opcodes |
237 |
+ install-strip-binutils: maybe-install-strip-opcodes |
238 |
++install-libctf: maybe-install-bfd |
239 |
++install-ld: maybe-install-bfd |
240 |
++install-ld: maybe-install-libctf |
241 |
++install-strip-libctf: maybe-install-strip-bfd |
242 |
++install-strip-ld: maybe-install-strip-bfd |
243 |
++install-strip-ld: maybe-install-strip-libctf |
244 |
+ install-opcodes: maybe-install-bfd |
245 |
+ install-strip-opcodes: maybe-install-strip-bfd |
246 |
+ configure-gas: maybe-configure-intl |
247 |
+-- |
248 |
+2.27.0 |
249 |
+ |
250 |
|
251 |
diff --git a/sys-libs/binutils-libs/files/binutils-libs-2.36.1-ld-ctf.patch b/sys-libs/binutils-libs/files/binutils-libs-2.36.1-ld-ctf.patch |
252 |
new file mode 100644 |
253 |
index 00000000000..012df3aed81 |
254 |
--- /dev/null |
255 |
+++ b/sys-libs/binutils-libs/files/binutils-libs-2.36.1-ld-ctf.patch |
256 |
@@ -0,0 +1,48 @@ |
257 |
+https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=f04ce15e831b691d7610dba284e266919e757b10 |
258 |
+https://bugs.gentoo.org/783777 |
259 |
+ |
260 |
+From f04ce15e831b691d7610dba284e266919e757b10 Mon Sep 17 00:00:00 2001 |
261 |
+From: Nick Alcock <nick.alcock@××××××.com> |
262 |
+Date: Tue, 26 Jan 2021 16:05:17 +0000 |
263 |
+Subject: [PATCH] ld: depend on libctf |
264 |
+ |
265 |
+Since ld may depend on libctf (if present), and libctf may be relinked |
266 |
+by the installation process, libctf must be installed before ld is, |
267 |
+or the relink may fail if it calls on symbols or symbol versions that do |
268 |
+not exist in any libctf already present on the system. (If none is |
269 |
+present, the copy in the build tree will be automatically used, but |
270 |
+if one *is* present, it may take precedence and break things.) |
271 |
+ |
272 |
+(This is a maybe- dependency, so it will work even if libctf is |
273 |
+disabled.) |
274 |
+ |
275 |
+ChangeLog |
276 |
+2021-01-26 Nick Alcock <nick.alcock@××××××.com> |
277 |
+ |
278 |
+ PR 27250 |
279 |
+ * Makefile.def: Add install-libctf dependency to install-ld. |
280 |
+ * Makefile.in: Regenerated. |
281 |
+--- |
282 |
+--- a/Makefile.def |
283 |
++++ b/Makefile.def |
284 |
+@@ -448,6 +448,7 @@ dependencies = { module=all-binutils; on=all-intl; }; |
285 |
+ dependencies = { module=all-binutils; on=all-gas; }; |
286 |
+ dependencies = { module=all-binutils; on=all-libctf; }; |
287 |
+ dependencies = { module=all-ld; on=all-libctf; }; |
288 |
++dependencies = { module=install-ld; on=install-libctf; }; |
289 |
+ |
290 |
+ // We put install-opcodes before install-binutils because the installed |
291 |
+ // binutils might be on PATH, and they might need the shared opcodes |
292 |
+--- a/Makefile.in |
293 |
++++ b/Makefile.in |
294 |
+@@ -52170,6 +52170,7 @@ all-stage3-ld: maybe-all-stage3-libctf |
295 |
+ all-stage4-ld: maybe-all-stage4-libctf |
296 |
+ all-stageprofile-ld: maybe-all-stageprofile-libctf |
297 |
+ all-stagefeedback-ld: maybe-all-stagefeedback-libctf |
298 |
++install-ld: maybe-install-libctf |
299 |
+ install-binutils: maybe-install-opcodes |
300 |
+ install-strip-binutils: maybe-install-strip-opcodes |
301 |
+ install-opcodes: maybe-install-bfd |
302 |
+-- |
303 |
+2.27.0 |
304 |
+ |