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