public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2017-11-03 21:08 Andreas Hüttel
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Hüttel @ 2017-11-03 21:08 UTC (permalink / raw
  To: gentoo-commits

commit:     a6dc051cd3b1dadb52d49133bdde51a04171aaf6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  3 21:08:15 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Nov  3 21:08:15 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6dc051c

sys-devel/binutils: Temporarily disable ld.gold test suite, bug 634348

The ld.gold test suite has problems with --enable-default-pie.
This is known upstream, but there's no activity on the bug, so
let's temporarily disable testing only for ld.gold.

The rest of the test suite (gas, ld, ...) works fine.

Bug: https://bugs.gentoo.org/634348
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21090
Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-devel/binutils/binutils-2.29.1-r1.ebuild       |  2 ++
 .../files/binutils-2.29.1-nogoldtest.patch         | 27 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/sys-devel/binutils/binutils-2.29.1-r1.ebuild b/sys-devel/binutils/binutils-2.29.1-r1.ebuild
index 89edaa6e995..b0f97883f2f 100644
--- a/sys-devel/binutils/binutils-2.29.1-r1.ebuild
+++ b/sys-devel/binutils/binutils-2.29.1-r1.ebuild
@@ -8,3 +8,5 @@ ELF2FLT_VER=""
 inherit toolchain-binutils
 
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd -sparc-fbsd ~x86-fbsd"
+
+PATCHES=( "${FILESDIR}/${P}-nogoldtest.patch" )

diff --git a/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch b/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch
new file mode 100644
index 00000000000..8e0669922d4
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch
@@ -0,0 +1,27 @@
+From 40f6e93e5078f16897f23856886566fe3b546206 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Fri, 3 Nov 2017 21:51:35 +0100
+Subject: [PATCH] Gentoo: Disable gold testsuite for users since it fails
+ upstream
+
+https://bugs.gentoo.org/634348
+https://sourceware.org/bugzilla/show_bug.cgi?id=21090
+---
+ Makefile.in | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 3acb83b8de..49de829bfa 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -2340,7 +2340,6 @@ check-host:  \
+     maybe-check-mpc \
+     maybe-check-isl \
+     maybe-check-libelf \
+-    maybe-check-gold \
+     maybe-check-gprof \
+     maybe-check-intl \
+     maybe-check-tcl \
+-- 
+2.15.0
+


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2020-05-01 21:44 Sergei Trofimovich
  0 siblings, 0 replies; 7+ messages in thread
From: Sergei Trofimovich @ 2020-05-01 21:44 UTC (permalink / raw
  To: gentoo-commits

commit:     de6868dc18e5f0a9471d357ab9906eef83a3149e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri May  1 21:43:42 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri May  1 21:43:58 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de6868dc

sys-devel/binutils: fix RISC-V ld crash, bug #720280

It's a direct backport of upstream's a2714d6cca1f1c7
("PR25900, RISC-V: null pointer dereference")

Reported-by: David Michael
Closes: https://bugs.gentoo.org/720280
Bug: https://sourceware.org/PR25900
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-devel/binutils/binutils-2.34.ebuild            |  1 +
 .../binutils/files/binutils-2.34-riscv-SEGV.patch  | 40 ++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/sys-devel/binutils/binutils-2.34.ebuild b/sys-devel/binutils/binutils-2.34.ebuild
index 805c709df2a..40a250edf7b 100644
--- a/sys-devel/binutils/binutils-2.34.ebuild
+++ b/sys-devel/binutils/binutils-2.34.ebuild
@@ -86,6 +86,7 @@ RESTRICT="!test? ( test )"
 
 PATCHES=(
 	"${FILESDIR}"/${PN}-2.33-gcc-10.patch
+	"${FILESDIR}"/${PN}-2.34-riscv-SEGV.patch
 )
 
 MY_BUILDDIR=${WORKDIR}/build

diff --git a/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch b/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch
new file mode 100644
index 00000000000..ac70e504918
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch
@@ -0,0 +1,40 @@
+https://sourceware.org/PR25900
+https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8
+
+From a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8 Mon Sep 17 00:00:00 2001
+From: Alan Modra <amodra@gmail.com>
+Date: Fri, 1 May 2020 15:32:00 +0930
+Subject: [PATCH] PR25900, RISC-V: null pointer dereference
+
+	PR 25900
+	* elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before
+	accessing root.u.def of symbols.  Also check root.u.def.section
+	is non-NULL.  Reverse tests so as to make the logic positive.
+
+--- a/bfd/elfnn-riscv.c
++++ b/bfd/elfnn-riscv.c
+@@ -4161,15 +4161,16 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec,
+ 	      symval = 0;
+ 	      sym_sec = bfd_und_section_ptr;
+ 	    }
+-	  else if (h->root.u.def.section->output_section == NULL
+-		   || (h->root.type != bfd_link_hash_defined
+-		       && h->root.type != bfd_link_hash_defweak))
+-	    continue;
+-	  else
++	  else if ((h->root.type == bfd_link_hash_defined
++		    || h->root.type == bfd_link_hash_defweak)
++		   && h->root.u.def.section != NULL
++		   && h->root.u.def.section->output_section != NULL)
+ 	    {
+ 	      symval = h->root.u.def.value;
+ 	      sym_sec = h->root.u.def.section;
+ 	    }
++	  else
++	    continue;
+ 
+ 	  if (h->type != STT_FUNC)
+ 	    reserve_size =
+-- 
+2.18.2
+


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2021-04-20  8:08 Sergei Trofimovich
  0 siblings, 0 replies; 7+ messages in thread
From: Sergei Trofimovich @ 2021-04-20  8:08 UTC (permalink / raw
  To: gentoo-commits

commit:     7dac8045b21d0f0539d929ef70c6905e0be6c16f
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 20 08:00:45 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Apr 20 08:08:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7dac8045

sys-devel/binutils: fix ctf/bfd relinking order

Before the change libctf could install before libbfd
into target location. That triggers libtool to link
against system's libbfd.

The change pulls in makefile depends to make sure
libbfd gets installed first for libtool to always
find a local copy.

Reported-by: Andreas K. Hüttel
Reported-by: Magnus Granberg
Bug: https://bugs.gentoo.org/783777
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-devel/binutils/binutils-2.36.1-r1.ebuild       | 454 +++++++++++++++++++++
 .../binutils/files/binutils-2.36.1-bfd-ctf.patch   |  68 +++
 .../binutils/files/binutils-2.36.1-ld-ctf.patch    |  48 +++
 3 files changed, 570 insertions(+)

diff --git a/sys-devel/binutils/binutils-2.36.1-r1.ebuild b/sys-devel/binutils/binutils-2.36.1-r1.ebuild
new file mode 100644
index 00000000000..9377abfc944
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.36.1-r1.ebuild
@@ -0,0 +1,454 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit eutils libtool flag-o-matic gnuconfig multilib toolchain-funcs
+
+DESCRIPTION="Tools necessary to build programs"
+HOMEPAGE="https://sourceware.org/binutils/"
+LICENSE="GPL-3+"
+IUSE="cet default-gold doc +gold multitarget +nls +plugins static-libs test vanilla"
+REQUIRED_USE="default-gold? ( gold )"
+
+# Variables that can be set here  (ignored for live ebuilds)
+# PATCH_VER          - the patchset version
+#                      Default: empty, no patching
+# PATCH_BINUTILS_VER - the binutils version in the patchset name
+#                    - Default: PV
+# PATCH_DEV          - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
+#                      for the patchsets
+
+PATCH_VER=1
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+	SLOT=${PV}
+else
+	PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
+	PATCH_DEV=${PATCH_DEV:-slyfox}
+	SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
+	[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
+		https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
+	SLOT=$(ver_cut 1-2)
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+fi
+
+#
+# The cross-compile logic
+#
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+#
+# The dependencies
+#
+RDEPEND="
+	>=sys-devel/binutils-config-3
+	sys-libs/zlib
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	doc? ( sys-apps/texinfo )
+	test? (
+		dev-util/dejagnu
+		sys-devel/bc
+	)
+	nls? ( sys-devel/gettext )
+	sys-devel/flex
+	virtual/yacc
+"
+
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.35.1-cet.patch
+	"${FILESDIR}"/${PN}-2.36.1-bfd-ctf.patch
+	"${FILESDIR}"/${PN}-2.36.1-ld-ctf.patch
+)
+
+MY_BUILDDIR=${WORKDIR}/build
+
+src_unpack() {
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patch || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
+		S=${WORKDIR}/binutils
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	mkdir -p "${MY_BUILDDIR}" || die
+}
+
+src_prepare() {
+	local patchsetname
+	if [[ ${PV} == 9999* ]] ; then
+		patchsetname="from git master"
+	else
+		patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}"
+	fi
+
+	if [[ ! -z ${PATCH_VER} ]] || [[ ${PV} == 9999* ]] ; then
+		if ! use vanilla; then
+			einfo "Applying binutils patchset ${patchsetname}"
+			eapply "${WORKDIR}/patch"
+			einfo "Done."
+		fi
+	fi
+
+	# This check should probably go somewhere else, like pkg_pretend.
+	if [[ ${CTARGET} == *-uclibc* ]] ; then
+		if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
+			die "sorry, but this binutils doesn't yet support uClibc :("
+		fi
+	fi
+
+	# Make sure our explicit libdir paths don't get clobbered. #562460
+	sed -i \
+		-e 's:@bfdlibdir@:@libdir@:g' \
+		-e 's:@bfdincludedir@:@includedir@:g' \
+		{bfd,opcodes}/Makefile.in || die
+
+	# Fix locale issues if possible #122216
+	if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
+		einfo "Fixing misc issues in configure files"
+		for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
+			ebegin "  Updating ${f/${S}\/}"
+			patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
+				|| eerror "Please file a bug about this"
+			eend $?
+		done
+	fi
+
+	# Fix conflicts with newer glibc #272594
+	if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
+		sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
+	fi
+
+	# Apply things from PATCHES and user dirs
+	default
+
+	# Run misc portage update scripts
+	gnuconfig_update
+	elibtoolize --portage --no-uclibc
+}
+
+toolchain-binutils_bugurl() {
+	printf "https://bugs.gentoo.org/"
+}
+toolchain-binutils_pkgversion() {
+	printf "Gentoo ${PV}"
+	[[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
+}
+
+src_configure() {
+	# Setup some paths
+	LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+	INCPATH=${LIBPATH}/include
+	DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+	if is_cross ; then
+		TOOLPATH=/usr/${CHOST}/${CTARGET}
+	else
+		TOOLPATH=/usr/${CTARGET}
+	fi
+	BINPATH=${TOOLPATH}/binutils-bin/${PV}
+
+	# Make sure we filter $LINGUAS so that only ones that
+	# actually work make it through #42033
+	strip-linguas -u */po
+
+	# Keep things sane
+	strip-flags
+
+	local x
+	echo
+	for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
+		einfo "$(printf '%10s' ${x}:) ${!x}"
+	done
+	echo
+
+	cd "${MY_BUILDDIR}"
+	local myconf=()
+
+	if use plugins ; then
+		myconf+=( --enable-plugins )
+	fi
+	# enable gold (installed as ld.gold) and ld's plugin architecture
+	if use gold ; then
+		myconf+=( --enable-gold )
+		if use default-gold; then
+			myconf+=( --enable-gold=default )
+		fi
+	fi
+
+	if use nls ; then
+		myconf+=( --without-included-gettext )
+	else
+		myconf+=( --disable-nls )
+	fi
+
+	myconf+=( --with-system-zlib )
+
+	# For bi-arch systems, enable a 64bit bfd.  This matches
+	# the bi-arch logic in toolchain.eclass. #446946
+	# We used to do it for everyone, but it's slow on 32bit arches. #438522
+	case $(tc-arch) in
+		ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
+	esac
+
+	use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
+
+	[[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
+
+	is_cross && myconf+=(
+		--with-sysroot="${EPREFIX}"/usr/${CTARGET}
+		--enable-poison-system-directories
+	)
+
+	# glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
+	# on everyone in alpha (for now), we'll just enable it when possible
+	has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
+	has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
+
+	# mips can't do hash-style=gnu ...
+	if [[ $(tc-arch) != mips ]] ; then
+		myconf+=( --enable-default-hash-style=gnu )
+	fi
+
+	myconf+=(
+		--prefix="${EPREFIX}"/usr
+		--host=${CHOST}
+		--target=${CTARGET}
+		--datadir="${EPREFIX}"${DATAPATH}
+		--datarootdir="${EPREFIX}"${DATAPATH}
+		--infodir="${EPREFIX}"${DATAPATH}/info
+		--mandir="${EPREFIX}"${DATAPATH}/man
+		--bindir="${EPREFIX}"${BINPATH}
+		--libdir="${EPREFIX}"${LIBPATH}
+		--libexecdir="${EPREFIX}"${LIBPATH}
+		--includedir="${EPREFIX}"${INCPATH}
+		--enable-obsolete
+		--enable-shared
+		--enable-threads
+		# Newer versions (>=2.27) offer a configure flag now.
+		--enable-relro
+		# Newer versions (>=2.24) make this an explicit option. #497268
+		--enable-install-libiberty
+		# Available from 2.35 on
+		--enable-textrel-check=warning
+		--disable-werror
+		--with-bugurl="$(toolchain-binutils_bugurl)"
+		--with-pkgversion="$(toolchain-binutils_pkgversion)"
+		$(use_enable static-libs static)
+		${EXTRA_ECONF}
+		# Disable modules that are in a combined binutils/gdb tree. #490566
+		--disable-{gdb,libdecnumber,readline,sim}
+		# Strip out broken static link flags.
+		# https://gcc.gnu.org/PR56750
+		--without-stage1-ldflags
+		# Change SONAME to avoid conflict across
+		# {native,cross}/binutils, binutils-libs. #666100
+		--with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
+
+		# avoid automagic dependency on (currently prefix) systems
+		# systems with debuginfod library, bug #754753
+		--without-debuginfod
+
+		# Allow user to opt into CET for host libraries.
+		# Ideally we would like automagic-or-disabled here.
+		# But the check does not quite work on i686: bug #760926.
+		$(use_enable cet)
+	)
+	echo ./configure "${myconf[@]}"
+	"${S}"/configure "${myconf[@]}" || die
+
+	# Prevent makeinfo from running if doc is unset.
+	if ! use doc ; then
+		sed -i \
+			-e '/^MAKEINFO/s:=.*:= true:' \
+			Makefile || die
+	fi
+}
+
+src_compile() {
+	cd "${MY_BUILDDIR}"
+	# see Note [tooldir hack for ldscripts]
+	emake tooldir="${EPREFIX}${TOOLPATH}" all
+
+	# only build info pages if the user wants them
+	if use doc ; then
+		emake info
+	fi
+
+	# we nuke the manpages when we're left with junk
+	# (like when we bootstrap, no perl -> no manpages)
+	find . -name '*.1' -a -size 0 -delete
+}
+
+src_test() {
+	cd "${MY_BUILDDIR}"
+
+	# bug 637066
+	filter-flags -Wall -Wreturn-type
+
+	emake -k check
+}
+
+src_install() {
+	local x d
+
+	cd "${MY_BUILDDIR}"
+	# see Note [tooldir hack for ldscripts]
+	emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
+	rm -rf "${ED}"/${LIBPATH}/bin
+	use static-libs || find "${ED}" -name '*.la' -delete
+
+	# Newer versions of binutils get fancy with ${LIBPATH} #171905
+	cd "${ED}"/${LIBPATH}
+	for d in ../* ; do
+		[[ ${d} == ../${PV} ]] && continue
+		mv ${d}/* . || die
+		rmdir ${d} || die
+	done
+
+	# Now we collect everything intp the proper SLOT-ed dirs
+	# When something is built to cross-compile, it installs into
+	# /usr/$CHOST/ by default ... we have to 'fix' that :)
+	if is_cross ; then
+		cd "${ED}"/${BINPATH}
+		for x in * ; do
+			mv ${x} ${x/${CTARGET}-}
+		done
+
+		if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
+			mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
+			mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
+			rm -r "${ED}"/usr/${CHOST}/{include,lib}
+		fi
+	fi
+	insinto ${INCPATH}
+	local libiberty_headers=(
+		# Not all the libiberty headers.  See libiberty/Makefile.in:install_to_libdir.
+		demangle.h
+		dyn-string.h
+		fibheap.h
+		hashtab.h
+		libiberty.h
+		objalloc.h
+		splay-tree.h
+	)
+	doins "${libiberty_headers[@]/#/${S}/include/}"
+	if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
+		mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
+		rm -r "${ED}"/${LIBPATH}/lib
+	fi
+
+	# Generate an env.d entry for this binutils
+	insinto /etc/env.d/binutils
+	cat <<-EOF > "${T}"/env.d
+		TARGET="${CTARGET}"
+		VER="${PV}"
+		LIBPATH="${EPREFIX}${LIBPATH}"
+	EOF
+	newins "${T}"/env.d ${CTARGET}-${PV}
+
+	# Handle documentation
+	if ! is_cross ; then
+		cd "${S}"
+		dodoc README
+		docinto bfd
+		dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
+		docinto binutils
+		dodoc binutils/ChangeLog binutils/NEWS binutils/README
+		docinto gas
+		dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
+		docinto gprof
+		dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
+		docinto ld
+		dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
+		docinto libiberty
+		dodoc libiberty/ChangeLog* libiberty/README
+		docinto opcodes
+		dodoc opcodes/ChangeLog*
+	fi
+
+	# Remove shared info pages
+	rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
+
+	# Trim all empty dirs
+	find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
+}
+
+pkg_postinst() {
+	# Make sure this ${CTARGET} has a binutils version selected
+	[[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
+	binutils-config ${CTARGET}-${PV}
+}
+
+pkg_postrm() {
+	local current_profile=$(binutils-config -c ${CTARGET})
+
+	# If no other versions exist, then uninstall for this
+	# target ... otherwise, switch to the newest version
+	# Note: only do this if this version is unmerged.  We
+	#       rerun binutils-config if this is a remerge, as
+	#       we want the mtimes on the symlinks updated (if
+	#       it is the same as the current selected profile)
+	if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
+		local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
+		choice=${choice//$'\n'/ }
+		choice=${choice/* }
+		if [[ -z ${choice} ]] ; then
+			binutils-config -u ${CTARGET}
+		else
+			binutils-config ${choice}
+		fi
+	elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
+		binutils-config ${CTARGET}-${PV}
+	fi
+}
+
+# Note [slotting support]
+# -----------------------
+# Gentoo's layout for binutils files is non-standard as Gentoo
+# supports slotted installation for binutils. Many tools
+# still expect binutils to reside in known locations.
+# binutils-config package restores symlinks into known locations,
+# like:
+#    /usr/bin/${CTARGET}-<tool>
+#    /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
+#    /usr/include/
+#
+# Note [tooldir hack for ldscripts]
+# ---------------------------------
+# Build system does not allow ./configure to tweak every location
+# we need for slotting binutils hence all the shuffling in
+# src_install(). This note is about SCRIPTDIR define handling.
+#
+# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
+# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
+# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
+# Thus we can't just move files around after compilation finished.
+#
+# Our goal is the following:
+# - at build-time set scriptdir to point to symlinked location:
+#   ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
+# - at install-time set scriptdir to point to slotted location:
+#   ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}

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
new file mode 100644
index 00000000000..d7daf683669
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.36.1-bfd-ctf.patch
@@ -0,0 +1,68 @@
+https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=755ba58ebef02e1be9fc6770d00243ba6ed0223c
+https://bugs.gentoo.org/783777
+
+From 755ba58ebef02e1be9fc6770d00243ba6ed0223c Mon Sep 17 00:00:00 2001
+From: Nick Alcock <nick.alcock@oracle.com>
+Date: Thu, 18 Mar 2021 12:37:52 +0000
+Subject: [PATCH] Add install dependencies for ld -> bfd and libctf -> bfd
+
+This stops problems parallel-installing if a relink of libctf is needed.
+
+Also adds corresponding install-strip dependencies.
+
+ChangeLog
+2021-03-18  Nick Alcock  <nick.alcock@oracle.com>
+
+	PR libctf/27482
+	* Makefile.def: Add install-bfd dependencies for install-libctf and
+	install-ld, and install-strip-bfd dependencies for
+	install-strip-libctf and install-strip-ld; move the install-ld
+	dependency on install-libctf to join it.
+	* Makefile.in: Regenerated.
+---
+--- a/Makefile.def
++++ b/Makefile.def
+@@ -448,7 +448,6 @@ dependencies = { module=all-binutils; on=all-intl; };
+ dependencies = { module=all-binutils; on=all-gas; };
+ dependencies = { module=all-binutils; on=all-libctf; };
+ dependencies = { module=all-ld; on=all-libctf; };
+-dependencies = { module=install-ld; on=install-libctf; };
+ 
+ // We put install-opcodes before install-binutils because the installed
+ // binutils might be on PATH, and they might need the shared opcodes
+@@ -456,6 +455,14 @@ dependencies = { module=install-ld; on=install-libctf; };
+ dependencies = { module=install-binutils; on=install-opcodes; };
+ dependencies = { module=install-strip-binutils; on=install-strip-opcodes; };
+ 
++// Likewise for ld, libctf, and bfd.
++dependencies = { module=install-libctf; on=install-bfd; };
++dependencies = { module=install-ld; on=install-bfd; };
++dependencies = { module=install-ld; on=install-libctf; };
++dependencies = { module=install-strip-libctf; on=install-strip-bfd; };
++dependencies = { module=install-strip-ld; on=install-strip-bfd; };
++dependencies = { module=install-strip-ld; on=install-strip-libctf; };
++
+ // libopcodes depends on libbfd
+ dependencies = { module=install-opcodes; on=install-bfd; };
+ dependencies = { module=install-strip-opcodes; on=install-strip-bfd; };
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -52170,9 +52170,14 @@ all-stage3-ld: maybe-all-stage3-libctf
+ all-stage4-ld: maybe-all-stage4-libctf
+ all-stageprofile-ld: maybe-all-stageprofile-libctf
+ all-stagefeedback-ld: maybe-all-stagefeedback-libctf
+-install-ld: maybe-install-libctf
+ install-binutils: maybe-install-opcodes
+ install-strip-binutils: maybe-install-strip-opcodes
++install-libctf: maybe-install-bfd
++install-ld: maybe-install-bfd
++install-ld: maybe-install-libctf
++install-strip-libctf: maybe-install-strip-bfd
++install-strip-ld: maybe-install-strip-bfd
++install-strip-ld: maybe-install-strip-libctf
+ install-opcodes: maybe-install-bfd
+ install-strip-opcodes: maybe-install-strip-bfd
+ configure-gas: maybe-configure-intl
+-- 
+2.27.0
+

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
new file mode 100644
index 00000000000..012df3aed81
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.36.1-ld-ctf.patch
@@ -0,0 +1,48 @@
+https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=f04ce15e831b691d7610dba284e266919e757b10
+https://bugs.gentoo.org/783777
+
+From f04ce15e831b691d7610dba284e266919e757b10 Mon Sep 17 00:00:00 2001
+From: Nick Alcock <nick.alcock@oracle.com>
+Date: Tue, 26 Jan 2021 16:05:17 +0000
+Subject: [PATCH] ld: depend on libctf
+
+Since ld may depend on libctf (if present), and libctf may be relinked
+by the installation process, libctf must be installed before ld is,
+or the relink may fail if it calls on symbols or symbol versions that do
+not exist in any libctf already present on the system.  (If none is
+present, the copy in the build tree will be automatically used, but
+if one *is* present, it may take precedence and break things.)
+
+(This is a maybe- dependency, so it will work even if libctf is
+disabled.)
+
+ChangeLog
+2021-01-26  Nick Alcock  <nick.alcock@oracle.com>
+
+	PR 27250
+	* Makefile.def: Add install-libctf dependency to install-ld.
+	* Makefile.in: Regenerated.
+---
+--- a/Makefile.def
++++ b/Makefile.def
+@@ -448,6 +448,7 @@ dependencies = { module=all-binutils; on=all-intl; };
+ dependencies = { module=all-binutils; on=all-gas; };
+ dependencies = { module=all-binutils; on=all-libctf; };
+ dependencies = { module=all-ld; on=all-libctf; };
++dependencies = { module=install-ld; on=install-libctf; };
+ 
+ // We put install-opcodes before install-binutils because the installed
+ // binutils might be on PATH, and they might need the shared opcodes
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -52170,6 +52170,7 @@ all-stage3-ld: maybe-all-stage3-libctf
+ all-stage4-ld: maybe-all-stage4-libctf
+ all-stageprofile-ld: maybe-all-stageprofile-libctf
+ all-stagefeedback-ld: maybe-all-stagefeedback-libctf
++install-ld: maybe-install-libctf
+ install-binutils: maybe-install-opcodes
+ install-strip-binutils: maybe-install-strip-opcodes
+ install-opcodes: maybe-install-bfd
+-- 
+2.27.0
+


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2021-05-15 22:31 Georgy Yakovlev
  0 siblings, 0 replies; 7+ messages in thread
From: Georgy Yakovlev @ 2021-05-15 22:31 UTC (permalink / raw
  To: gentoo-commits

commit:     f5037c69c46b9f592e409381a07c106024b86eb7
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Sat May 15 22:30:01 2021 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sat May 15 22:31:30 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f5037c69

sys-devel/binutils: add powerpc tests patch to 2.35.2

Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 sys-devel/binutils/binutils-2.35.2.ebuild          |   5 +-
 .../files/binutils-2.35.2-powerpc-tests.patch      | 136 +++++++++++++++++++++
 2 files changed, 140 insertions(+), 1 deletion(-)

diff --git a/sys-devel/binutils/binutils-2.35.2.ebuild b/sys-devel/binutils/binutils-2.35.2.ebuild
index 051e68de5e7..9b2a1db7bbf 100644
--- a/sys-devel/binutils/binutils-2.35.2.ebuild
+++ b/sys-devel/binutils/binutils-2.35.2.ebuild
@@ -67,7 +67,10 @@ BDEPEND="
 
 RESTRICT="!test? ( test )"
 
-PATCHES=("${FILESDIR}"/${PN}-2.35.1-cet.patch)
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.35.1-cet.patch
+	"${FILESDIR}"/${PN}-2.35.2-powerpc-tests.patch
+)
 
 MY_BUILDDIR=${WORKDIR}/build
 

diff --git a/sys-devel/binutils/files/binutils-2.35.2-powerpc-tests.patch b/sys-devel/binutils/files/binutils-2.35.2-powerpc-tests.patch
new file mode 100644
index 00000000000..711194b1eae
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.35.2-powerpc-tests.patch
@@ -0,0 +1,136 @@
+From: Alan Modra <amodra@gmail.com>
+Date: Mon, 16 Nov 2020 22:08:05 +0000 (+1030)
+Subject: PR26882, --enable-textrel-check=warning test failures on powerpc
+X-Git-Tag: binutils-2_36~578
+X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=7cc340055d3993a25ded914aef88f784f16d46bc;hp=6f2643dbd2192e6fff77a5e6fec5141d209fd7d0
+
+PR26882, --enable-textrel-check=warning test failures on powerpc
+
+	PR 26882
+	* testsuite/ld-powerpc/dotsym3.d: Add "-z notext" to ld options.
+	* testsuite/ld-powerpc/dotsym4.d: Likewise.
+	* testsuite/ld-powerpc/ppc476-shared.d: Likewise.
+	* testsuite/ld-powerpc/ppc476-shared2.d: Likewise.
+	* testsuite/ld-powerpc/powerpc.exp: Likewise for various tests.
+	* testsuite/ld-undefined/weak-fundef.s: Add BLPLT variant.
+	* testsuite/ld-undefined/weak-undef.exp: Define BLPLT for ppc32.
+---
+
+diff --git a/ld/testsuite/ld-powerpc/dotsym3.d b/ld/testsuite/ld-powerpc/dotsym3.d
+index fac2f8ec732..215a9c2a6c1 100644
+--- a/ld/testsuite/ld-powerpc/dotsym3.d
++++ b/ld/testsuite/ld-powerpc/dotsym3.d
+@@ -1,7 +1,7 @@
+ #source: nodotsym.s
+ #source: dotsymref.s
+ #as: -a64
+-#ld: -melf64ppc -Ttext=0x1000 -shared
++#ld: -melf64ppc -Ttext=0x1000 -shared -z notext
+ #objdump: -dR
+ 
+ .*:     file format .*
+diff --git a/ld/testsuite/ld-powerpc/dotsym4.d b/ld/testsuite/ld-powerpc/dotsym4.d
+index fdd92f3da76..d774e83bcf6 100644
+--- a/ld/testsuite/ld-powerpc/dotsym4.d
++++ b/ld/testsuite/ld-powerpc/dotsym4.d
+@@ -1,7 +1,7 @@
+ #source: dotsymref.s
+ #source: nodotsym.s
+ #as: -a64
+-#ld: -melf64ppc -Ttext=0x1000 -shared
++#ld: -melf64ppc -Ttext=0x1000 -shared -z notext
+ #objdump: -dR
+ 
+ .*:     file format .*
+diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
+index 74af28d7421..2cbefb841c2 100644
+--- a/ld/testsuite/ld-powerpc/powerpc.exp
++++ b/ld/testsuite/ld-powerpc/powerpc.exp
+@@ -99,7 +99,7 @@ proc supports_ppc64 { } {
+ # readelf: Apply readelf options on result.  Compare with regex (last arg).
+ 
+ set ppcelftests {
+-    {"Reloc section order" "-melf32ppc -shared -z nocombreloc" "" "-a32" {reloc.s}
++    {"Reloc section order" "-melf32ppc -shared -z nocombreloc -z notext" "" "-a32" {reloc.s}
+      {{objdump -hw reloc.d}} "reloc.so"}
+     {"APUinfo section processing" "-melf32ppc" ""
+      "-a32 -me500" {apuinfo1.s apuinfo-nul.s apuinfo2.s}
+@@ -134,7 +134,7 @@ set ppcelftests {
+      {{readelf -WSsrl tlsexe32no.r} {objdump -dr tlsexe32no.d}
+       {objdump -sj.got tlsexe32no.g} {objdump -sj.tdata tlsexe32.t}}
+      "tlsexe32no"}
+-    {"TLS32 shared" "-shared -melf32ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o" "" "" {}
++    {"TLS32 shared" "-shared -melf32ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv -z notext tmpdir/tls32.o" "" "" {}
+      {{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
+       {objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
+      "tls32.so"}
+@@ -202,7 +202,7 @@ set ppc64elftests {
+      {{readelf -WSsrl tlsexeno.r} {objdump -dr tlsexeno.d}
+       {objdump -sj.got tlsexeno.g} {objdump -sj.tdata tlsexe.t}}
+      "tlsexeno"}
+-    {"TLS shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o" "" "" {}
++    {"TLS shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv -z notext tmpdir/tls.o" "" "" {}
+      {{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
+       {objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
+      "tls.so"}
+@@ -229,7 +229,7 @@ set ppc64elftests {
+      {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetocno.d}
+       {objdump -sj.got tlsexetocno.g} {objdump -sj.tdata tlsexetoc.t}}
+      "tlsexetocno"}
+-    {"TLSTOC shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o" "" "" {}
++    {"TLSTOC shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv -z notext tmpdir/tlstoc.o" "" "" {}
+      {{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
+       {objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
+      "tlstoc.so"}
+diff --git a/ld/testsuite/ld-powerpc/ppc476-shared.d b/ld/testsuite/ld-powerpc/ppc476-shared.d
+index 7953cb44e25..3b2cc8a155c 100644
+--- a/ld/testsuite/ld-powerpc/ppc476-shared.d
++++ b/ld/testsuite/ld-powerpc/ppc476-shared.d
+@@ -1,6 +1,6 @@
+ #source: ppc476-shared.s
+ #as: -a32
+-#ld: -melf32ppc -q -shared -z common-page-size=0x10000 --ppc476-workaround -T ppc476-shared.lnk
++#ld: -melf32ppc -q -shared -z common-page-size=0x10000 -z notext --ppc476-workaround -T ppc476-shared.lnk
+ #objdump: -dr
+ #target: powerpc*-*-*
+ 
+diff --git a/ld/testsuite/ld-powerpc/ppc476-shared2.d b/ld/testsuite/ld-powerpc/ppc476-shared2.d
+index 26a5c41f988..48917fd4d92 100644
+--- a/ld/testsuite/ld-powerpc/ppc476-shared2.d
++++ b/ld/testsuite/ld-powerpc/ppc476-shared2.d
+@@ -1,6 +1,6 @@
+ #source: ppc476-shared.s
+ #as: -a32
+-#ld: -melf32ppc -shared -z common-page-size=0x10000 --ppc476-workaround -T ppc476-shared.lnk
++#ld: -melf32ppc -shared -z common-page-size=0x10000 -z notext --ppc476-workaround -T ppc476-shared.lnk
+ #objdump: -R
+ #target: powerpc*-*-*
+ 
+diff --git a/ld/testsuite/ld-undefined/weak-fundef.s b/ld/testsuite/ld-undefined/weak-fundef.s
+index 2c20f799417..de8f641b6c2 100644
+--- a/ld/testsuite/ld-undefined/weak-fundef.s
++++ b/ld/testsuite/ld-undefined/weak-fundef.s
+@@ -5,6 +5,9 @@
+ 	bl undef_weak_fun
+ 	nop
+  .endif
++ .ifdef BLPLT
++	bl undef_weak_fun@plt
++ .endif
+  .ifdef CALLPLT
+ 	call undef_weak_fun@plt
+  .endif
+diff --git a/ld/testsuite/ld-undefined/weak-undef.exp b/ld/testsuite/ld-undefined/weak-undef.exp
+index 50c8e1483e3..14b6774c5bc 100644
+--- a/ld/testsuite/ld-undefined/weak-undef.exp
++++ b/ld/testsuite/ld-undefined/weak-undef.exp
+@@ -105,7 +105,8 @@ set asflags ""
+ switch -glob $target_triplet {
+     aarch64* -
+     arm* -
+-    powerpc* { set asflags "--defsym BL=1" }
++    powerpc64* { set asflags "--defsym BL=1" }
++    powerpc* { set asflags "--defsym BLPLT=1" }
+     hppa* { set asflags "--defsym HPPA=1" }
+     i\[3-7\]86* -
+     x86_64* { set asflags "--defsym CALLPLT=1" }


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2023-10-01 14:09 James Le Cuirot
  0 siblings, 0 replies; 7+ messages in thread
From: James Le Cuirot @ 2023-10-01 14:09 UTC (permalink / raw
  To: gentoo-commits

commit:     6010348df47c9b5bb8e2f3305b35f82f789aca36
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  1 14:07:46 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Oct  1 14:08:05 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6010348d

sys-devel/binutils: Drop ld.so.conf prefix patch and enable -L patch for cross

The ld.so.conf prefix patch didn't work in all the cases we needed it to. We'll
fix the issue with /usr/etc/ld.so.conf via env-update instead.

The -L patch was previously only applied to prefixed systems, but it's needed to
fix crossdev environments too. We should probably just take it into the general
patchset.

Bug: https://bugs.gentoo.org/892549
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 ...tils-2.40-r8.ebuild => binutils-2.40-r9.ebuild} |  4 ++-
 ...tils-2.41-r1.ebuild => binutils-2.41-r2.ebuild} |  4 ++-
 sys-devel/binutils/binutils-9999.ebuild            |  4 ++-
 .../files/binutils-2.40-linker-search-path.patch   | 36 ----------------------
 4 files changed, 9 insertions(+), 39 deletions(-)

diff --git a/sys-devel/binutils/binutils-2.40-r8.ebuild b/sys-devel/binutils/binutils-2.40-r9.ebuild
similarity index 99%
rename from sys-devel/binutils/binutils-2.40-r8.ebuild
rename to sys-devel/binutils/binutils-2.40-r9.ebuild
index 789ad23b059c..b7fac9c0e71c 100644
--- a/sys-devel/binutils/binutils-2.40-r8.ebuild
+++ b/sys-devel/binutils/binutils-2.40-r9.ebuild
@@ -118,7 +118,9 @@ src_prepare() {
 
 			# This is applied conditionally for now just out of caution.
 			# It should be okay on non-prefix systems though. See bug #892549.
-			use prefix && eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch
+			if is_cross || use prefix; then
+				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch
+			fi
 		fi
 	fi
 

diff --git a/sys-devel/binutils/binutils-2.41-r1.ebuild b/sys-devel/binutils/binutils-2.41-r2.ebuild
similarity index 99%
rename from sys-devel/binutils/binutils-2.41-r1.ebuild
rename to sys-devel/binutils/binutils-2.41-r2.ebuild
index eec1ecb1e001..de4cbac1dadd 100644
--- a/sys-devel/binutils/binutils-2.41-r1.ebuild
+++ b/sys-devel/binutils/binutils-2.41-r2.ebuild
@@ -118,7 +118,9 @@ src_prepare() {
 
 			# This is applied conditionally for now just out of caution.
 			# It should be okay on non-prefix systems though. See bug #892549.
-			use prefix && eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch
+			if is_cross || use prefix; then
+				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch
+			fi
 		fi
 	fi
 

diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-9999.ebuild
index 11e84c53af1c..5d9cedc9c2b5 100644
--- a/sys-devel/binutils/binutils-9999.ebuild
+++ b/sys-devel/binutils/binutils-9999.ebuild
@@ -118,7 +118,9 @@ src_prepare() {
 
 			# This is applied conditionally for now just out of caution.
 			# It should be okay on non-prefix systems though. See bug #892549.
-			use prefix && eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch
+			if is_cross || use prefix; then
+				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch
+			fi
 		fi
 	fi
 

diff --git a/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch b/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch
index 7423f8d70556..bddfa1ec6eb5 100644
--- a/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch
+++ b/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch
@@ -36,39 +36,3 @@ libstdc++.so.6, while other linkers do not use this file at all.
  	      sprintf (filename, "%s/%s", search->name, l->name);
  	      nn.name = filename;
  	      if (ldelf_try_needed (&nn, force, is_linux))
-
-From 8afc65c8d8c0fff2f686ddd8eb9023c7ebabcca9 Mon Sep 17 00:00:00 2001
-From: James Le Cuirot <chewi@gentoo.org>
-Date: Sat, 11 Feb 2023 15:18:58 +0000
-Subject: [PATCH 2/2] ldelf.c: Do not search for libraries using ld.so.conf
-
-Other linkers do not do this. It is problematic for Gentoo Linux,
-because crossdev installs libraries such as libstdc++.so.6 outside of
-the sysroot.
---- a/ld/ld.texi
-+++ b/ld/ld.texi
-@@ -2355,7 +2355,9 @@ For a linker for a Linux system, if the file @file{/etc/ld.so.conf}
- exists, the list of directories found in that file.  Note: the path
- to this file is prefixed with the @code{sysroot} value, if that is
- defined, and then any @code{prefix} string if the linker was
--configured with the @command{--prefix=<path>} option.
-+configured with the @command{--prefix=<path>} option. This has feature has
-+been disabled on Gentoo Linux to make it consistent with the other
-+linkers, which do not do this.
- @item
- For a native linker on a FreeBSD system, any directories specified by
- the @code{_PATH_ELF_HINTS} macro defined in the @file{elf-hints.h}
---- a/ld/ldelf.c
-+++ b/ld/ldelf.c
-@@ -1156,10 +1156,6 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
- 	      if (is_freebsd
- 		  && ldelf_check_ld_elf_hints (l, force, elfsize))
- 		break;
--
--	      if (is_linux
--		  && ldelf_check_ld_so_conf (l, force, elfsize, prefix))
--		break;
- 	    }
- 
- 	  len = strlen (l->name);
-


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2024-01-06 11:48 James Le Cuirot
  0 siblings, 0 replies; 7+ messages in thread
From: James Le Cuirot @ 2024-01-06 11:48 UTC (permalink / raw
  To: gentoo-commits

commit:     5d9341ed5b240e838abea81a582717aa92381dc6
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 23 14:50:47 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat Jan  6 11:47:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d9341ed

sys-devel/binutils: Add conditional patch to fix ld.bfd prefix handling

As before, this may make it into our patchset once it's been proven to work. Our
track record here hasn't been great so far!

Closes: https://bugs.gentoo.org/892549
Closes: https://github.com/gentoo/gentoo/pull/34446
Bug: https://github.com/gentoo/binutils-gdb/pull/5
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 ...inutils-9999.ebuild => binutils-2.41-r4.ebuild} | 22 ++++++---
 sys-devel/binutils/binutils-9999.ebuild            |  9 +++-
 .../files/binutils-2.41-linker-prefix.patch        | 56 ++++++++++++++++++++++
 3 files changed, 79 insertions(+), 8 deletions(-)

diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-2.41-r4.ebuild
similarity index 95%
copy from sys-devel/binutils/binutils-9999.ebuild
copy to sys-devel/binutils/binutils-2.41-r4.ebuild
index 71f57af9f840..0fe91dacf35e 100644
--- a/sys-devel/binutils/binutils-9999.ebuild
+++ b/sys-devel/binutils/binutils-2.41-r4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -19,7 +19,7 @@ IUSE="cet debuginfod doc gold gprofng hardened multitarget +nls pgo +plugins sta
 # PATCH_DEV          - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
 #                      for the patchsets
 
-PATCH_VER=1
+PATCH_VER=4
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then
@@ -32,7 +32,7 @@ else
 	[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
 		https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
 	SLOT=$(ver_cut 1-2)
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 fi
 
 #
@@ -119,7 +119,8 @@ src_prepare() {
 			# This is applied conditionally for now just out of caution.
 			# It should be okay on non-prefix systems though. See bug #892549.
 			if is_cross || use prefix; then
-				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch
+				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch \
+					   "${FILESDIR}"/binutils-2.41-linker-prefix.patch
 			fi
 		fi
 	fi
@@ -183,7 +184,12 @@ src_configure() {
 	use cet && filter-flags -mindirect-branch -mindirect-branch=*
 	use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152
 
-	append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
+	# ideally we want !tc-ld-is-bfd for best future-proofing, but it needs
+	# https://github.com/gentoo/gentoo/pull/28355
+	# mold needs this too but right now tc-ld-is-mold is also not available
+	if tc-ld-is-lld; then
+		append-ldflags -Wl,--undefined-version
+	fi
 
 	local x
 	echo
@@ -351,7 +357,11 @@ src_compile() {
 	cd "${MY_BUILDDIR}" || die
 
 	# see Note [tooldir hack for ldscripts]
-	emake tooldir="${EPREFIX}${TOOLPATH}" all
+	# see linker prefix patch
+	emake \
+		tooldir="${EPREFIX}${TOOLPATH}" \
+		gentoo_prefix=$(usex prefix-guest "${EPREFIX}"/usr /usr) \
+		all
 
 	# only build info pages if the user wants them
 	if use doc ; then

diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-9999.ebuild
index 71f57af9f840..f08bf54fb8ff 100644
--- a/sys-devel/binutils/binutils-9999.ebuild
+++ b/sys-devel/binutils/binutils-9999.ebuild
@@ -119,7 +119,8 @@ src_prepare() {
 			# This is applied conditionally for now just out of caution.
 			# It should be okay on non-prefix systems though. See bug #892549.
 			if is_cross || use prefix; then
-				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch
+				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch \
+					   "${FILESDIR}"/binutils-2.41-linker-prefix.patch
 			fi
 		fi
 	fi
@@ -351,7 +352,11 @@ src_compile() {
 	cd "${MY_BUILDDIR}" || die
 
 	# see Note [tooldir hack for ldscripts]
-	emake tooldir="${EPREFIX}${TOOLPATH}" all
+	# see linker prefix patch
+	emake \
+		tooldir="${EPREFIX}${TOOLPATH}" \
+		gentoo_prefix=$(usex prefix-guest "${EPREFIX}"/usr /usr) \
+		all
 
 	# only build info pages if the user wants them
 	if use doc ; then

diff --git a/sys-devel/binutils/files/binutils-2.41-linker-prefix.patch b/sys-devel/binutils/files/binutils-2.41-linker-prefix.patch
new file mode 100644
index 000000000000..d97a15599209
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.41-linker-prefix.patch
@@ -0,0 +1,56 @@
+https://bugs.gentoo.org/892549
+https://github.com/gentoo/binutils-gdb/pull/5
+
+From 531bc1536dfc3070c1f7d03e98fa14bcb81fdcd0 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 23 Dec 2023 13:48:10 +0000
+Subject: [PATCH 2/2] ld: Allow a Gentoo-specific prefix to override the prefix
+ used by ld.bfd
+
+This prefix is only used to locate $prefix/etc/ld.so.conf, with $prefix
+usually being /usr. This file is important on Gentoo Prefix systems,
+where the /usr prefix is within another directory. The problem is that
+Gentoo already passes the same directory as the sysroot, and ld.bfd
+therefore looks for /myprefix/myprefix/usr/etc/ld.so.conf.
+
+The sysroot is dynamic, while the prefix is hardcoded. A hardcoded
+prefix that isn't just /usr is unhelpful, not just because of the
+doubled prefix issue above, but also because it prevents ld.bfd from
+working effectively outside its native environment. We will therefore
+hardcode it to just /usr.
+
+This change does not simply do that though and sets up a $gentoo_prefix
+variable instead, with $prefix as a fallback. This is necessary because
+Gentoo prefix-guest systems, which use the host's libc, do not apply a
+sysroot like RAP prefix systems do. In that case, we must preserve the
+existing behaviour. The binutils ebuild will be responsible for setting
+this variable appropriately.
+---
+ ld/emultempl/elf.em | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
+index 3f67f8b09d9..78c8e909b6c 100644
+--- a/ld/emultempl/elf.em
++++ b/ld/emultempl/elf.em
+@@ -138,7 +138,7 @@ gld${EMULATION_NAME}_before_plugin_all_symbols_read (void)
+   ldelf_before_plugin_all_symbols_read ($IS_LIBPATH, $IS_NATIVE,
+ 				        $IS_LINUX_TARGET,
+ 					$IS_FREEBSD_TARGET,
+-					$ELFSIZE, "$prefix");
++					$ELFSIZE, "${gentoo_prefix-${prefix}}");
+ }
+ 
+ /* This is called after all the input files have been opened.  */
+@@ -147,7 +147,7 @@ static void
+ gld${EMULATION_NAME}_after_open (void)
+ {
+   ldelf_after_open ($IS_LIBPATH, $IS_NATIVE,
+-		    $IS_LINUX_TARGET, $IS_FREEBSD_TARGET, $ELFSIZE, "$prefix");
++		    $IS_LINUX_TARGET, $IS_FREEBSD_TARGET, $ELFSIZE, "${gentoo_prefix-${prefix}}");
+ }
+ 
+ EOF
+-- 
+2.43.0
+


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2024-08-05 22:21 James Le Cuirot
  0 siblings, 0 replies; 7+ messages in thread
From: James Le Cuirot @ 2024-08-05 22:21 UTC (permalink / raw
  To: gentoo-commits

commit:     5f9b32f028a31e544134077f5a3b6bd3d8c4230c
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  5 22:20:23 2024 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Mon Aug  5 22:20:23 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f9b32f0

sys-devel/binutils: Rebase cross/prefix linker patches for 2.43

Closes: https://bugs.gentoo.org/937381
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 sys-devel/binutils/binutils-2.43.ebuild            |  4 +-
 sys-devel/binutils/binutils-9999.ebuild            |  4 +-
 .../files/binutils-2.43-linker-prefix.patch        | 53 ++++++++++++++++++++++
 .../files/binutils-2.43-linker-search-path.patch   | 43 ++++++++++++++++++
 4 files changed, 100 insertions(+), 4 deletions(-)

diff --git a/sys-devel/binutils/binutils-2.43.ebuild b/sys-devel/binutils/binutils-2.43.ebuild
index a3e7c641ce6b..9407ec3c37ef 100644
--- a/sys-devel/binutils/binutils-2.43.ebuild
+++ b/sys-devel/binutils/binutils-2.43.ebuild
@@ -131,8 +131,8 @@ src_prepare() {
 			# This is applied conditionally for now just out of caution.
 			# It should be okay on non-prefix systems though. See bug #892549.
 			if is_cross || use prefix; then
-				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch \
-					   "${FILESDIR}"/binutils-2.41-linker-prefix.patch
+				eapply "${FILESDIR}"/binutils-2.43-linker-search-path.patch \
+					   "${FILESDIR}"/binutils-2.43-linker-prefix.patch
 			fi
 		fi
 	fi

diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-9999.ebuild
index c05f1529d8c1..44bb4c8c3e76 100644
--- a/sys-devel/binutils/binutils-9999.ebuild
+++ b/sys-devel/binutils/binutils-9999.ebuild
@@ -131,8 +131,8 @@ src_prepare() {
 			# This is applied conditionally for now just out of caution.
 			# It should be okay on non-prefix systems though. See bug #892549.
 			if is_cross || use prefix; then
-				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch \
-					   "${FILESDIR}"/binutils-2.41-linker-prefix.patch
+				eapply "${FILESDIR}"/binutils-2.43-linker-search-path.patch \
+					   "${FILESDIR}"/binutils-2.43-linker-prefix.patch
 			fi
 		fi
 	fi

diff --git a/sys-devel/binutils/files/binutils-2.43-linker-prefix.patch b/sys-devel/binutils/files/binutils-2.43-linker-prefix.patch
new file mode 100644
index 000000000000..79b30657014b
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.43-linker-prefix.patch
@@ -0,0 +1,53 @@
+https://bugs.gentoo.org/892549
+https://github.com/gentoo/binutils-gdb/pull/5
+
+From 302271b0baa52204fab58bd0b74e3919c0789f87 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 23 Dec 2023 13:48:10 +0000
+Subject: [PATCH] ld: Allow a Gentoo-specific prefix to override the prefix
+ used by ld.bfd
+
+This prefix is only used to locate $prefix/etc/ld.so.conf, with $prefix
+usually being /usr. This file is important on Gentoo Prefix systems,
+where the /usr prefix is within another directory. The problem is that
+Gentoo already passes the same directory as the sysroot, and ld.bfd
+therefore looks for /myprefix/myprefix/usr/etc/ld.so.conf.
+
+The sysroot is dynamic, while the prefix is hardcoded. A hardcoded
+prefix that isn't just /usr is unhelpful, not just because of the
+doubled prefix issue above, but also because it prevents ld.bfd from
+working effectively outside its native environment. We will therefore
+hardcode it to just /usr.
+
+This change does not simply do that though and sets up a $gentoo_prefix
+variable instead, with $prefix as a fallback. This is necessary because
+Gentoo prefix-guest systems, which use the host's libc, do not apply a
+sysroot like RAP prefix systems do. In that case, we must preserve the
+existing behaviour. The binutils ebuild will be responsible for setting
+this variable appropriately.
+---
+ ld/emultempl/elf.em | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
+index 863657e12f5..cf0204e9c76 100644
+--- a/ld/emultempl/elf.em
++++ b/ld/emultempl/elf.em
+@@ -142,7 +142,7 @@ gld${EMULATION_NAME}_before_plugin_all_symbols_read (void)
+   ldelf_before_plugin_all_symbols_read ($IS_LIBPATH, $IS_NATIVE,
+ 				        $IS_LINUX_TARGET,
+ 					$IS_FREEBSD_TARGET,
+-					$ELFSIZE, "$prefix");
++					$ELFSIZE, "${gentoo_prefix-${prefix}}");
+ }
+ 
+ /* This is called after all the input files have been opened.  */
+@@ -151,7 +151,7 @@ static void
+ gld${EMULATION_NAME}_after_open (void)
+ {
+   ldelf_after_open ($IS_LIBPATH, $IS_NATIVE,
+-		    $IS_LINUX_TARGET, $IS_FREEBSD_TARGET, $ELFSIZE, "$prefix");
++		    $IS_LINUX_TARGET, $IS_FREEBSD_TARGET, $ELFSIZE, "${gentoo_prefix-${prefix}}");
+ }
+ 
+ EOF

diff --git a/sys-devel/binutils/files/binutils-2.43-linker-search-path.patch b/sys-devel/binutils/files/binutils-2.43-linker-search-path.patch
new file mode 100644
index 000000000000..1dcb5e68702d
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.43-linker-search-path.patch
@@ -0,0 +1,43 @@
+https://bugs.gentoo.org/892549
+https://github.com/gentoo/binutils-gdb/pull/5
+
+From 470487917306e169fc3ca983c2edf2370b211861 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 11 Feb 2023 15:15:20 +0000
+Subject: [PATCH] ldelf.c: Always consider -L arguments when handling DT_NEEDED
+
+This is for consistency with other linkers, including gold. Without
+this, we typically rely on ld.so.conf to find libraries such as
+libstdc++.so.6, while other linkers do not use this file at all.
+---
+ ld/ldelf.c | 10 +++-------
+ 1 file changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/ld/ldelf.c b/ld/ldelf.c
+index 09691609fc0..11edff8c8ec 100644
+--- a/ld/ldelf.c
++++ b/ld/ldelf.c
+@@ -1093,8 +1093,8 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
+ 	 linker will search.  That means that we want to use
+ 	 rpath_link, rpath, then the environment variable
+ 	 LD_LIBRARY_PATH (native only), then the DT_RPATH/DT_RUNPATH
+-	 entries (native only), then the linker script LIB_SEARCH_DIRS.
+-	 We do not search using the -L arguments.
++	 entries (native only), then the linker script LIB_SEARCH_DIRS,
++	 then the -L arguments.
+ 
+ 	 We search twice.  The first time, we skip objects which may
+ 	 introduce version mismatches.  The second time, we force
+@@ -1168,11 +1168,7 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
+ 	  len = strlen (l->name);
+ 	  for (search = search_head; search != NULL; search = search->next)
+ 	    {
+-	      char *filename;
+-
+-	      if (search->source != search_dir_linker_script)
+-		continue;
+-	      filename = (char *) xmalloc (strlen (search->name) + len + 2);
++	      char *filename = (char *) xmalloc (strlen (search->name) + len + 2);
+ 	      sprintf (filename, "%s/%s", search->name, l->name);
+ 	      nn.name = filename;
+ 	      if (ldelf_try_needed (&nn, force, is_linux))


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-08-05 22:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-15 22:31 [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/, sys-devel/binutils/files/ Georgy Yakovlev
  -- strict thread matches above, loose matches on Subject: below --
2024-08-05 22:21 James Le Cuirot
2024-01-06 11:48 James Le Cuirot
2023-10-01 14:09 James Le Cuirot
2021-04-20  8:08 Sergei Trofimovich
2020-05-01 21:44 Sergei Trofimovich
2017-11-03 21:08 Andreas Hüttel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox