Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
Date: Tue, 20 Apr 2021 08:08:53
Message-Id: 1618906124.7dac8045b21d0f0539d929ef70c6905e0be6c16f.slyfox@gentoo
1 commit: 7dac8045b21d0f0539d929ef70c6905e0be6c16f
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Tue Apr 20 08:00:45 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=7dac8045
7
8 sys-devel/binutils: 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 sys-devel/binutils/binutils-2.36.1-r1.ebuild | 454 +++++++++++++++++++++
25 .../binutils/files/binutils-2.36.1-bfd-ctf.patch | 68 +++
26 .../binutils/files/binutils-2.36.1-ld-ctf.patch | 48 +++
27 3 files changed, 570 insertions(+)
28
29 diff --git a/sys-devel/binutils/binutils-2.36.1-r1.ebuild b/sys-devel/binutils/binutils-2.36.1-r1.ebuild
30 new file mode 100644
31 index 00000000000..9377abfc944
32 --- /dev/null
33 +++ b/sys-devel/binutils/binutils-2.36.1-r1.ebuild
34 @@ -0,0 +1,454 @@
35 +# Copyright 1999-2021 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=7
39 +
40 +inherit eutils libtool flag-o-matic gnuconfig multilib toolchain-funcs
41 +
42 +DESCRIPTION="Tools necessary to build programs"
43 +HOMEPAGE="https://sourceware.org/binutils/"
44 +LICENSE="GPL-3+"
45 +IUSE="cet default-gold doc +gold multitarget +nls +plugins static-libs test vanilla"
46 +REQUIRED_USE="default-gold? ( gold )"
47 +
48 +# Variables that can be set here (ignored for live ebuilds)
49 +# PATCH_VER - the patchset version
50 +# Default: empty, no patching
51 +# PATCH_BINUTILS_VER - the binutils version in the patchset name
52 +# - Default: PV
53 +# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
54 +# for the patchsets
55 +
56 +PATCH_VER=1
57 +PATCH_DEV=dilfridge
58 +
59 +if [[ ${PV} == 9999* ]]; then
60 + inherit git-r3
61 + SLOT=${PV}
62 +else
63 + PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
64 + PATCH_DEV=${PATCH_DEV:-slyfox}
65 + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
66 + [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
67 + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
68 + SLOT=$(ver_cut 1-2)
69 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
70 +fi
71 +
72 +#
73 +# The cross-compile logic
74 +#
75 +export CTARGET=${CTARGET:-${CHOST}}
76 +if [[ ${CTARGET} == ${CHOST} ]] ; then
77 + if [[ ${CATEGORY} == cross-* ]] ; then
78 + export CTARGET=${CATEGORY#cross-}
79 + fi
80 +fi
81 +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
82 +
83 +#
84 +# The dependencies
85 +#
86 +RDEPEND="
87 + >=sys-devel/binutils-config-3
88 + sys-libs/zlib
89 +"
90 +DEPEND="${RDEPEND}"
91 +BDEPEND="
92 + doc? ( sys-apps/texinfo )
93 + test? (
94 + dev-util/dejagnu
95 + sys-devel/bc
96 + )
97 + nls? ( sys-devel/gettext )
98 + sys-devel/flex
99 + virtual/yacc
100 +"
101 +
102 +RESTRICT="!test? ( test )"
103 +
104 +PATCHES=(
105 + "${FILESDIR}"/${PN}-2.35.1-cet.patch
106 + "${FILESDIR}"/${PN}-2.36.1-bfd-ctf.patch
107 + "${FILESDIR}"/${PN}-2.36.1-ld-ctf.patch
108 +)
109 +
110 +MY_BUILDDIR=${WORKDIR}/build
111 +
112 +src_unpack() {
113 + if [[ ${PV} == 9999* ]] ; then
114 + EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git"
115 + EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
116 + git-r3_src_unpack
117 + mv patches-git/9999 patch || die
118 +
119 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
120 + S=${WORKDIR}/binutils
121 + EGIT_CHECKOUT_DIR=${S}
122 + git-r3_src_unpack
123 + else
124 + unpack ${P}.tar.xz
125 +
126 + cd "${WORKDIR}" || die
127 + unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz
128 + fi
129 +
130 + cd "${WORKDIR}" || die
131 + mkdir -p "${MY_BUILDDIR}" || die
132 +}
133 +
134 +src_prepare() {
135 + local patchsetname
136 + if [[ ${PV} == 9999* ]] ; then
137 + patchsetname="from git master"
138 + else
139 + patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}"
140 + fi
141 +
142 + if [[ ! -z ${PATCH_VER} ]] || [[ ${PV} == 9999* ]] ; then
143 + if ! use vanilla; then
144 + einfo "Applying binutils patchset ${patchsetname}"
145 + eapply "${WORKDIR}/patch"
146 + einfo "Done."
147 + fi
148 + fi
149 +
150 + # This check should probably go somewhere else, like pkg_pretend.
151 + if [[ ${CTARGET} == *-uclibc* ]] ; then
152 + if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
153 + die "sorry, but this binutils doesn't yet support uClibc :("
154 + fi
155 + fi
156 +
157 + # Make sure our explicit libdir paths don't get clobbered. #562460
158 + sed -i \
159 + -e 's:@bfdlibdir@:@libdir@:g' \
160 + -e 's:@bfdincludedir@:@includedir@:g' \
161 + {bfd,opcodes}/Makefile.in || die
162 +
163 + # Fix locale issues if possible #122216
164 + if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
165 + einfo "Fixing misc issues in configure files"
166 + for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
167 + ebegin " Updating ${f/${S}\/}"
168 + patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
169 + || eerror "Please file a bug about this"
170 + eend $?
171 + done
172 + fi
173 +
174 + # Fix conflicts with newer glibc #272594
175 + if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
176 + sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
177 + fi
178 +
179 + # Apply things from PATCHES and user dirs
180 + default
181 +
182 + # Run misc portage update scripts
183 + gnuconfig_update
184 + elibtoolize --portage --no-uclibc
185 +}
186 +
187 +toolchain-binutils_bugurl() {
188 + printf "https://bugs.gentoo.org/"
189 +}
190 +toolchain-binutils_pkgversion() {
191 + printf "Gentoo ${PV}"
192 + [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
193 +}
194 +
195 +src_configure() {
196 + # Setup some paths
197 + LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
198 + INCPATH=${LIBPATH}/include
199 + DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
200 + if is_cross ; then
201 + TOOLPATH=/usr/${CHOST}/${CTARGET}
202 + else
203 + TOOLPATH=/usr/${CTARGET}
204 + fi
205 + BINPATH=${TOOLPATH}/binutils-bin/${PV}
206 +
207 + # Make sure we filter $LINGUAS so that only ones that
208 + # actually work make it through #42033
209 + strip-linguas -u */po
210 +
211 + # Keep things sane
212 + strip-flags
213 +
214 + local x
215 + echo
216 + for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
217 + einfo "$(printf '%10s' ${x}:) ${!x}"
218 + done
219 + echo
220 +
221 + cd "${MY_BUILDDIR}"
222 + local myconf=()
223 +
224 + if use plugins ; then
225 + myconf+=( --enable-plugins )
226 + fi
227 + # enable gold (installed as ld.gold) and ld's plugin architecture
228 + if use gold ; then
229 + myconf+=( --enable-gold )
230 + if use default-gold; then
231 + myconf+=( --enable-gold=default )
232 + fi
233 + fi
234 +
235 + if use nls ; then
236 + myconf+=( --without-included-gettext )
237 + else
238 + myconf+=( --disable-nls )
239 + fi
240 +
241 + myconf+=( --with-system-zlib )
242 +
243 + # For bi-arch systems, enable a 64bit bfd. This matches
244 + # the bi-arch logic in toolchain.eclass. #446946
245 + # We used to do it for everyone, but it's slow on 32bit arches. #438522
246 + case $(tc-arch) in
247 + ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
248 + esac
249 +
250 + use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
251 +
252 + [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
253 +
254 + is_cross && myconf+=(
255 + --with-sysroot="${EPREFIX}"/usr/${CTARGET}
256 + --enable-poison-system-directories
257 + )
258 +
259 + # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
260 + # on everyone in alpha (for now), we'll just enable it when possible
261 + has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
262 + has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
263 +
264 + # mips can't do hash-style=gnu ...
265 + if [[ $(tc-arch) != mips ]] ; then
266 + myconf+=( --enable-default-hash-style=gnu )
267 + fi
268 +
269 + myconf+=(
270 + --prefix="${EPREFIX}"/usr
271 + --host=${CHOST}
272 + --target=${CTARGET}
273 + --datadir="${EPREFIX}"${DATAPATH}
274 + --datarootdir="${EPREFIX}"${DATAPATH}
275 + --infodir="${EPREFIX}"${DATAPATH}/info
276 + --mandir="${EPREFIX}"${DATAPATH}/man
277 + --bindir="${EPREFIX}"${BINPATH}
278 + --libdir="${EPREFIX}"${LIBPATH}
279 + --libexecdir="${EPREFIX}"${LIBPATH}
280 + --includedir="${EPREFIX}"${INCPATH}
281 + --enable-obsolete
282 + --enable-shared
283 + --enable-threads
284 + # Newer versions (>=2.27) offer a configure flag now.
285 + --enable-relro
286 + # Newer versions (>=2.24) make this an explicit option. #497268
287 + --enable-install-libiberty
288 + # Available from 2.35 on
289 + --enable-textrel-check=warning
290 + --disable-werror
291 + --with-bugurl="$(toolchain-binutils_bugurl)"
292 + --with-pkgversion="$(toolchain-binutils_pkgversion)"
293 + $(use_enable static-libs static)
294 + ${EXTRA_ECONF}
295 + # Disable modules that are in a combined binutils/gdb tree. #490566
296 + --disable-{gdb,libdecnumber,readline,sim}
297 + # Strip out broken static link flags.
298 + # https://gcc.gnu.org/PR56750
299 + --without-stage1-ldflags
300 + # Change SONAME to avoid conflict across
301 + # {native,cross}/binutils, binutils-libs. #666100
302 + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
303 +
304 + # avoid automagic dependency on (currently prefix) systems
305 + # systems with debuginfod library, bug #754753
306 + --without-debuginfod
307 +
308 + # Allow user to opt into CET for host libraries.
309 + # Ideally we would like automagic-or-disabled here.
310 + # But the check does not quite work on i686: bug #760926.
311 + $(use_enable cet)
312 + )
313 + echo ./configure "${myconf[@]}"
314 + "${S}"/configure "${myconf[@]}" || die
315 +
316 + # Prevent makeinfo from running if doc is unset.
317 + if ! use doc ; then
318 + sed -i \
319 + -e '/^MAKEINFO/s:=.*:= true:' \
320 + Makefile || die
321 + fi
322 +}
323 +
324 +src_compile() {
325 + cd "${MY_BUILDDIR}"
326 + # see Note [tooldir hack for ldscripts]
327 + emake tooldir="${EPREFIX}${TOOLPATH}" all
328 +
329 + # only build info pages if the user wants them
330 + if use doc ; then
331 + emake info
332 + fi
333 +
334 + # we nuke the manpages when we're left with junk
335 + # (like when we bootstrap, no perl -> no manpages)
336 + find . -name '*.1' -a -size 0 -delete
337 +}
338 +
339 +src_test() {
340 + cd "${MY_BUILDDIR}"
341 +
342 + # bug 637066
343 + filter-flags -Wall -Wreturn-type
344 +
345 + emake -k check
346 +}
347 +
348 +src_install() {
349 + local x d
350 +
351 + cd "${MY_BUILDDIR}"
352 + # see Note [tooldir hack for ldscripts]
353 + emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
354 + rm -rf "${ED}"/${LIBPATH}/bin
355 + use static-libs || find "${ED}" -name '*.la' -delete
356 +
357 + # Newer versions of binutils get fancy with ${LIBPATH} #171905
358 + cd "${ED}"/${LIBPATH}
359 + for d in ../* ; do
360 + [[ ${d} == ../${PV} ]] && continue
361 + mv ${d}/* . || die
362 + rmdir ${d} || die
363 + done
364 +
365 + # Now we collect everything intp the proper SLOT-ed dirs
366 + # When something is built to cross-compile, it installs into
367 + # /usr/$CHOST/ by default ... we have to 'fix' that :)
368 + if is_cross ; then
369 + cd "${ED}"/${BINPATH}
370 + for x in * ; do
371 + mv ${x} ${x/${CTARGET}-}
372 + done
373 +
374 + if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
375 + mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
376 + mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
377 + rm -r "${ED}"/usr/${CHOST}/{include,lib}
378 + fi
379 + fi
380 + insinto ${INCPATH}
381 + local libiberty_headers=(
382 + # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
383 + demangle.h
384 + dyn-string.h
385 + fibheap.h
386 + hashtab.h
387 + libiberty.h
388 + objalloc.h
389 + splay-tree.h
390 + )
391 + doins "${libiberty_headers[@]/#/${S}/include/}"
392 + if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
393 + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
394 + rm -r "${ED}"/${LIBPATH}/lib
395 + fi
396 +
397 + # Generate an env.d entry for this binutils
398 + insinto /etc/env.d/binutils
399 + cat <<-EOF > "${T}"/env.d
400 + TARGET="${CTARGET}"
401 + VER="${PV}"
402 + LIBPATH="${EPREFIX}${LIBPATH}"
403 + EOF
404 + newins "${T}"/env.d ${CTARGET}-${PV}
405 +
406 + # Handle documentation
407 + if ! is_cross ; then
408 + cd "${S}"
409 + dodoc README
410 + docinto bfd
411 + dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
412 + docinto binutils
413 + dodoc binutils/ChangeLog binutils/NEWS binutils/README
414 + docinto gas
415 + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
416 + docinto gprof
417 + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
418 + docinto ld
419 + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
420 + docinto libiberty
421 + dodoc libiberty/ChangeLog* libiberty/README
422 + docinto opcodes
423 + dodoc opcodes/ChangeLog*
424 + fi
425 +
426 + # Remove shared info pages
427 + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
428 +
429 + # Trim all empty dirs
430 + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
431 +}
432 +
433 +pkg_postinst() {
434 + # Make sure this ${CTARGET} has a binutils version selected
435 + [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
436 + binutils-config ${CTARGET}-${PV}
437 +}
438 +
439 +pkg_postrm() {
440 + local current_profile=$(binutils-config -c ${CTARGET})
441 +
442 + # If no other versions exist, then uninstall for this
443 + # target ... otherwise, switch to the newest version
444 + # Note: only do this if this version is unmerged. We
445 + # rerun binutils-config if this is a remerge, as
446 + # we want the mtimes on the symlinks updated (if
447 + # it is the same as the current selected profile)
448 + if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
449 + local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
450 + choice=${choice//$'\n'/ }
451 + choice=${choice/* }
452 + if [[ -z ${choice} ]] ; then
453 + binutils-config -u ${CTARGET}
454 + else
455 + binutils-config ${choice}
456 + fi
457 + elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
458 + binutils-config ${CTARGET}-${PV}
459 + fi
460 +}
461 +
462 +# Note [slotting support]
463 +# -----------------------
464 +# Gentoo's layout for binutils files is non-standard as Gentoo
465 +# supports slotted installation for binutils. Many tools
466 +# still expect binutils to reside in known locations.
467 +# binutils-config package restores symlinks into known locations,
468 +# like:
469 +# /usr/bin/${CTARGET}-<tool>
470 +# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
471 +# /usr/include/
472 +#
473 +# Note [tooldir hack for ldscripts]
474 +# ---------------------------------
475 +# Build system does not allow ./configure to tweak every location
476 +# we need for slotting binutils hence all the shuffling in
477 +# src_install(). This note is about SCRIPTDIR define handling.
478 +#
479 +# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
480 +# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
481 +# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
482 +# Thus we can't just move files around after compilation finished.
483 +#
484 +# Our goal is the following:
485 +# - at build-time set scriptdir to point to symlinked location:
486 +# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
487 +# - at install-time set scriptdir to point to slotted location:
488 +# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}
489
490 diff --git a/sys-devel/binutils/files/binutils-2.36.1-bfd-ctf.patch b/sys-devel/binutils/files/binutils-2.36.1-bfd-ctf.patch
491 new file mode 100644
492 index 00000000000..d7daf683669
493 --- /dev/null
494 +++ b/sys-devel/binutils/files/binutils-2.36.1-bfd-ctf.patch
495 @@ -0,0 +1,68 @@
496 +https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=755ba58ebef02e1be9fc6770d00243ba6ed0223c
497 +https://bugs.gentoo.org/783777
498 +
499 +From 755ba58ebef02e1be9fc6770d00243ba6ed0223c Mon Sep 17 00:00:00 2001
500 +From: Nick Alcock <nick.alcock@××××××.com>
501 +Date: Thu, 18 Mar 2021 12:37:52 +0000
502 +Subject: [PATCH] Add install dependencies for ld -> bfd and libctf -> bfd
503 +
504 +This stops problems parallel-installing if a relink of libctf is needed.
505 +
506 +Also adds corresponding install-strip dependencies.
507 +
508 +ChangeLog
509 +2021-03-18 Nick Alcock <nick.alcock@××××××.com>
510 +
511 + PR libctf/27482
512 + * Makefile.def: Add install-bfd dependencies for install-libctf and
513 + install-ld, and install-strip-bfd dependencies for
514 + install-strip-libctf and install-strip-ld; move the install-ld
515 + dependency on install-libctf to join it.
516 + * Makefile.in: Regenerated.
517 +---
518 +--- a/Makefile.def
519 ++++ b/Makefile.def
520 +@@ -448,7 +448,6 @@ dependencies = { module=all-binutils; on=all-intl; };
521 + dependencies = { module=all-binutils; on=all-gas; };
522 + dependencies = { module=all-binutils; on=all-libctf; };
523 + dependencies = { module=all-ld; on=all-libctf; };
524 +-dependencies = { module=install-ld; on=install-libctf; };
525 +
526 + // We put install-opcodes before install-binutils because the installed
527 + // binutils might be on PATH, and they might need the shared opcodes
528 +@@ -456,6 +455,14 @@ dependencies = { module=install-ld; on=install-libctf; };
529 + dependencies = { module=install-binutils; on=install-opcodes; };
530 + dependencies = { module=install-strip-binutils; on=install-strip-opcodes; };
531 +
532 ++// Likewise for ld, libctf, and bfd.
533 ++dependencies = { module=install-libctf; on=install-bfd; };
534 ++dependencies = { module=install-ld; on=install-bfd; };
535 ++dependencies = { module=install-ld; on=install-libctf; };
536 ++dependencies = { module=install-strip-libctf; on=install-strip-bfd; };
537 ++dependencies = { module=install-strip-ld; on=install-strip-bfd; };
538 ++dependencies = { module=install-strip-ld; on=install-strip-libctf; };
539 ++
540 + // libopcodes depends on libbfd
541 + dependencies = { module=install-opcodes; on=install-bfd; };
542 + dependencies = { module=install-strip-opcodes; on=install-strip-bfd; };
543 +--- a/Makefile.in
544 ++++ b/Makefile.in
545 +@@ -52170,9 +52170,14 @@ all-stage3-ld: maybe-all-stage3-libctf
546 + all-stage4-ld: maybe-all-stage4-libctf
547 + all-stageprofile-ld: maybe-all-stageprofile-libctf
548 + all-stagefeedback-ld: maybe-all-stagefeedback-libctf
549 +-install-ld: maybe-install-libctf
550 + install-binutils: maybe-install-opcodes
551 + install-strip-binutils: maybe-install-strip-opcodes
552 ++install-libctf: maybe-install-bfd
553 ++install-ld: maybe-install-bfd
554 ++install-ld: maybe-install-libctf
555 ++install-strip-libctf: maybe-install-strip-bfd
556 ++install-strip-ld: maybe-install-strip-bfd
557 ++install-strip-ld: maybe-install-strip-libctf
558 + install-opcodes: maybe-install-bfd
559 + install-strip-opcodes: maybe-install-strip-bfd
560 + configure-gas: maybe-configure-intl
561 +--
562 +2.27.0
563 +
564
565 diff --git a/sys-devel/binutils/files/binutils-2.36.1-ld-ctf.patch b/sys-devel/binutils/files/binutils-2.36.1-ld-ctf.patch
566 new file mode 100644
567 index 00000000000..012df3aed81
568 --- /dev/null
569 +++ b/sys-devel/binutils/files/binutils-2.36.1-ld-ctf.patch
570 @@ -0,0 +1,48 @@
571 +https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=f04ce15e831b691d7610dba284e266919e757b10
572 +https://bugs.gentoo.org/783777
573 +
574 +From f04ce15e831b691d7610dba284e266919e757b10 Mon Sep 17 00:00:00 2001
575 +From: Nick Alcock <nick.alcock@××××××.com>
576 +Date: Tue, 26 Jan 2021 16:05:17 +0000
577 +Subject: [PATCH] ld: depend on libctf
578 +
579 +Since ld may depend on libctf (if present), and libctf may be relinked
580 +by the installation process, libctf must be installed before ld is,
581 +or the relink may fail if it calls on symbols or symbol versions that do
582 +not exist in any libctf already present on the system. (If none is
583 +present, the copy in the build tree will be automatically used, but
584 +if one *is* present, it may take precedence and break things.)
585 +
586 +(This is a maybe- dependency, so it will work even if libctf is
587 +disabled.)
588 +
589 +ChangeLog
590 +2021-01-26 Nick Alcock <nick.alcock@××××××.com>
591 +
592 + PR 27250
593 + * Makefile.def: Add install-libctf dependency to install-ld.
594 + * Makefile.in: Regenerated.
595 +---
596 +--- a/Makefile.def
597 ++++ b/Makefile.def
598 +@@ -448,6 +448,7 @@ dependencies = { module=all-binutils; on=all-intl; };
599 + dependencies = { module=all-binutils; on=all-gas; };
600 + dependencies = { module=all-binutils; on=all-libctf; };
601 + dependencies = { module=all-ld; on=all-libctf; };
602 ++dependencies = { module=install-ld; on=install-libctf; };
603 +
604 + // We put install-opcodes before install-binutils because the installed
605 + // binutils might be on PATH, and they might need the shared opcodes
606 +--- a/Makefile.in
607 ++++ b/Makefile.in
608 +@@ -52170,6 +52170,7 @@ all-stage3-ld: maybe-all-stage3-libctf
609 + all-stage4-ld: maybe-all-stage4-libctf
610 + all-stageprofile-ld: maybe-all-stageprofile-libctf
611 + all-stagefeedback-ld: maybe-all-stagefeedback-libctf
612 ++install-ld: maybe-install-libctf
613 + install-binutils: maybe-install-opcodes
614 + install-strip-binutils: maybe-install-strip-opcodes
615 + install-opcodes: maybe-install-bfd
616 +--
617 +2.27.0
618 +