summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2021-04-20 09:07:43 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2021-04-20 09:08:44 +0100
commit3f6242408c1dc87441a96fcac14302ae14e02bef (patch)
tree8d96c175c25b5b963065d25f892f27c12af1a2ac
parentsys-devel/binutils-hppa64: fix ctf/bfd relinking order (diff)
downloadgentoo-3f6242408c1dc87441a96fcac14302ae14e02bef.tar.gz
gentoo-3f6242408c1dc87441a96fcac14302ae14e02bef.tar.bz2
gentoo-3f6242408c1dc87441a96fcac14302ae14e02bef.zip
sys-libs/binutils-libs: 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@gentoo.org>
-rw-r--r--sys-libs/binutils-libs/binutils-libs-2.36.1-r1.ebuild140
-rw-r--r--sys-libs/binutils-libs/files/binutils-libs-2.36.1-bfd-ctf.patch68
-rw-r--r--sys-libs/binutils-libs/files/binutils-libs-2.36.1-ld-ctf.patch48
3 files changed, 256 insertions, 0 deletions
diff --git a/sys-libs/binutils-libs/binutils-libs-2.36.1-r1.ebuild b/sys-libs/binutils-libs/binutils-libs-2.36.1-r1.ebuild
new file mode 100644
index 00000000000..ced73ffd868
--- /dev/null
+++ b/sys-libs/binutils-libs/binutils-libs-2.36.1-r1.ebuild
@@ -0,0 +1,140 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PATCH_VER=1
+PATCH_DEV=dilfridge
+
+inherit libtool toolchain-funcs multilib-minimal
+
+MY_PN="binutils"
+MY_P="${MY_PN}-${PV}"
+PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
+PATCH_DEV=${PATCH_DEV:-slyfox}
+
+DESCRIPTION="Core binutils libraries (libbfd, libopcodes, libiberty) for external packages"
+HOMEPAGE="https://sourceware.org/binutils/"
+SRC_URI="mirror://gnu/binutils/${MY_P}.tar.xz
+ https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${MY_PN}-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
+
+LICENSE="|| ( GPL-3 LGPL-3 )"
+SLOT="0/${PV}"
+IUSE="64-bit-bfd cet multitarget nls static-libs"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+
+BDEPEND="nls? ( sys-devel/gettext )"
+DEPEND="sys-libs/zlib[${MULTILIB_USEDEP}]"
+# Need a newer binutils-config that'll reset include/lib symlinks for us.
+RDEPEND="${DEPEND}
+ >=sys-devel/binutils-config-5
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.35.1-cet.patch
+ "${FILESDIR}"/${PN}-2.36.1-bfd-ctf.patch
+ "${FILESDIR}"/${PN}-2.36.1-ld-ctf.patch
+)
+
+S="${WORKDIR}/${MY_P}"
+
+MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/bfd.h
+)
+
+src_prepare() {
+ if [[ ! -z ${PATCH_VER} ]] ; then
+ einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}"
+ eapply "${WORKDIR}/patch"/*.patch
+ fi
+
+ # Fix cross-compile relinking issue, bug #626402
+ elibtoolize
+
+ default
+}
+
+pkgversion() {
+ printf "Gentoo ${PVR}"
+ [[ -n ${PATCHVER} ]] && printf " p${PATCHVER}"
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --enable-obsolete
+ --enable-shared
+ --enable-threads
+ # Newer versions (>=2.24) make this an explicit option. #497268
+ --enable-install-libiberty
+ --disable-werror
+ --with-bugurl="https://bugs.gentoo.org/"
+ --with-pkgversion="$(pkgversion)"
+ $(use_enable static-libs static)
+ # The binutils eclass enables this flag for all bi-arch builds,
+ # but other tools often don't care about that support. Put it
+ # beyond a flag if people really want it, but otherwise leave
+ # it disabled as it can slow things down on 32bit arches. #438522
+ $(use_enable 64-bit-bfd)
+ # This only disables building in the zlib subdir.
+ # For binutils itself, it'll use the system version. #591516
+ --without-zlib
+ --with-system-zlib
+ # We only care about the libs, so disable programs. #528088
+ --disable-{binutils,etc,ld,gas,gold,gprof}
+ # 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
+ # We pull in all USE-flags that change ABI in an incompatible
+ # way. #666100
+ # USE=multitarget change size of global arrays
+ # USE=64-bit-bfd changes data structures of exported API
+ --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)-$(usex 64-bit-bfd 64 def)
+
+ # 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)
+ )
+
+ # mips can't do hash-style=gnu ...
+ if [[ $(tc-arch) != mips ]] ; then
+ myconf+=( --enable-default-hash-style=gnu )
+ fi
+
+ use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
+
+ use nls \
+ && myconf+=( --without-included-gettext ) \
+ || myconf+=( --disable-nls )
+
+ if [[ ${CHOST} == *-darwin* ]] && use nls ; then
+ # fix underlinking in opcodes
+ sed -i -e 's/@SHARED_LDFLAGS@/@SHARED_LDFLAGS@ -lintl/' \
+ "${S}"/opcodes/Makefile.in || die
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+
+ # Prevent makeinfo from running as we don't build docs here.
+ # bug #622652
+ sed -i \
+ -e '/^MAKEINFO/s:=.*:= true:' \
+ Makefile || die
+}
+
+multilib_src_install() {
+ default
+ # Provide libiberty.h directly.
+ dosym libiberty/libiberty.h /usr/include/libiberty.h
+}
+
+multilib_src_install_all() {
+ use static-libs || find "${ED}"/usr -name '*.la' -delete
+}
diff --git a/sys-libs/binutils-libs/files/binutils-libs-2.36.1-bfd-ctf.patch b/sys-libs/binutils-libs/files/binutils-libs-2.36.1-bfd-ctf.patch
new file mode 100644
index 00000000000..d7daf683669
--- /dev/null
+++ b/sys-libs/binutils-libs/files/binutils-libs-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-libs/binutils-libs/files/binutils-libs-2.36.1-ld-ctf.patch b/sys-libs/binutils-libs/files/binutils-libs-2.36.1-ld-ctf.patch
new file mode 100644
index 00000000000..012df3aed81
--- /dev/null
+++ b/sys-libs/binutils-libs/files/binutils-libs-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
+