public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/, sys-devel/binutils-config/
@ 2016-02-14 14:56 Fabian Groffen
  0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2016-02-14 14:56 UTC (permalink / raw
  To: gentoo-commits

commit:     72ebd34b9821ad0b04bc98b7decf07c9588c7191
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 14 13:48:51 2016 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Feb 14 13:48:51 2016 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=72ebd34b

sys-devel/binutils-config: first version of rewritten ldwrapper, bug #572390

Package-Manager: portage-2.2.20-prefix

 .../binutils-config/binutils-config-5-r2.ebuild    |  40 ++--
 .../files/binutils-config-5-ldwrapper.patch        |  22 ++
 sys-devel/binutils-config/files/ldwrapper.c        | 252 +++++++++++++++++++++
 3 files changed, 297 insertions(+), 17 deletions(-)

diff --git a/sys-devel/binutils-config/binutils-config-5-r2.ebuild b/sys-devel/binutils-config/binutils-config-5-r2.ebuild
index 3af562d..60c601e 100644
--- a/sys-devel/binutils-config/binutils-config-5-r2.ebuild
+++ b/sys-devel/binutils-config/binutils-config-5-r2.ebuild
@@ -8,49 +8,55 @@ inherit eutils prefix
 
 DESCRIPTION="Utility to change the binutils version being used"
 HOMEPAGE="https://www.gentoo.org/"
-W_VER="0.3.1723"
-SRC_URI="http://dev.gentoo.org/~grobian/distfiles/toolchain-prefix-wrapper-${W_VER}.tar.xz"
 
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="sunld"
 
 # We also RDEPEND on sys-apps/findutils which is in base @system
 RDEPEND="sys-apps/gentoo-functions
 	!<app-admin/eselect-1.4.5"
 
-S=${WORKDIR}/toolchain-prefix-wrapper-${W_VER}
+S=${WORKDIR}
 
 # NOTE: the ld wrapper is only enabled on rpath versions of prefix.
 src_prepare() {
 	cp "${FILESDIR}"/${PN}-${PV} ./${PN} || die
 	if use prefix-guest; then
-		epatch "${FILESDIR}/${PN}-4-ldwrapper.patch"
+		epatch "${FILESDIR}/${PN}-5-ldwrapper.patch"
 	fi
 	eprefixify ${PN}
 
-	# fix configure stupidity, until next release
-	sed -i -e 's/x10\.\[3456789\]/x10.*/' configure
-	epatch "${FILESDIR}"/${PN}-4-no-macosx-version-min.patch
-	epatch "${FILESDIR}"/${PN}-4-aix-ld-svr4.patch
+	cp "${FILESDIR}"/ldwrapper.c . || die
 }
 
 src_configure() {
-	if use prefix-guest; then
-		econf --with-macosx-version-min=${MACOSX_DEPLOYMENT_TARGET} \
-			$(use_with sunld native-ld)
-	fi
+	:
 }
 
-src_install() {
-	if use prefix-guest; then
-		emake install DESTDIR="${D}"
-	fi
+src_compile() {
+	use prefix-guest || return
+	local args=(
+		$(tc-getCC)
+		${CPPFLAGS}
+		${CFLAGS}
+		-o ldwrapper ldwrapper.c
+		-DEPREFIX=\"${EPREFIX}\"
+		-DCHOST=\"${CHOST}\"
+		$([[ ${CHOST} == *-darwin* ]] && echo -DTARGET_DARWIN)
+		${LDFLAGS}
+	)
+	echo ${args[*]}
+	"${args[@]}" || die
+}
 
+src_install() {
 	newbin "${S}"/${PN} ${PN}
 	doman "${FILESDIR}"/${PN}.8
 
+	dodir /usr/$(get_libdir)/misc/binutils-config
+	mv "${S}"/ldwrapper "${ED}"/usr/$(get_libdir)/misc/binutils-config/
+
 	insinto /usr/share/eselect/modules
 	doins "${FILESDIR}"/binutils.eselect
 }

diff --git a/sys-devel/binutils-config/files/binutils-config-5-ldwrapper.patch b/sys-devel/binutils-config/files/binutils-config-5-ldwrapper.patch
new file mode 100644
index 0000000..f184c20
--- /dev/null
+++ b/sys-devel/binutils-config/files/binutils-config-5-ldwrapper.patch
@@ -0,0 +1,22 @@
+diff --git a/binutils-config b/binutils-config
+index 7454527..570a6b0 100755
+--- a/binutils-config
++++ b/binutils-config
+@@ -121,7 +121,16 @@ switch_profile() {
+ 	cd "${ROOT}/${BINPATH}" || exit 1
+ 	mkdir -p "${ROOT}/${BINPATH_LINKS}" "${EROOT}/usr/bin"
+ 	for x in * ; do
+-		atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
++		case ${x} in
++			ld*)
++				# put ldwrapper in place
++				atomic_ln "${EROOT}/usr/lib/misc/binutils-config/ldwrapper" "${ROOT}/${BINPATH_LINKS}" "${x}"
++			;;
++			*)
++				atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
++			;;
++		esac
++		
+ 		atomic_ln "${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin" "${TARGET}-${x}"
+ 		if [[ ${TARGET} == ${HOST} ]] ; then
+ 			atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}"

diff --git a/sys-devel/binutils-config/files/ldwrapper.c b/sys-devel/binutils-config/files/ldwrapper.c
new file mode 100644
index 0000000..355840f
--- /dev/null
+++ b/sys-devel/binutils-config/files/ldwrapper.c
@@ -0,0 +1,252 @@
+/*
+ * Copyright 1999-2013 Gentoo Foundation
+ * Distributed under the terms of the GNU General Public License v2
+ * Authors: Fabian Groffen <grobian@gentoo.org>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <strings.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+/**
+ * ldwrapper: Prefix helper to inject -L and -R flags to the invocation
+ * of ld.
+ *
+ * On Darwin it adds -search_path_first to make sure the given paths are
+ * searched before the default search path.
+ * The wrapper will inject -L entries for:
+ *   - EPREFIX/usr/CHOST/lib/gcc (when gcc)
+ *   - EPREFIX/usr/CHOST/lib     (when binutils)
+ *   - EPREFIX/usr/lib
+ *   - EPREFIX/lib 
+ * On ELF platforms, the wrapper will then add -R (-rpath) entries for
+ * all -L entries found in the invocation to ensure the libraries found
+ * at link time will be found at runtime too.
+ */
+
+#ifndef EPREFIX
+# error EPREFIX must be defined!
+#endif
+#ifndef CHOST
+# error CHOST must be defined!
+#endif
+
+
+static inline void
+find_real_ld(char **ld, char verbose, char *wrapper)
+{
+	FILE *f = NULL;
+	char *ldoveride;
+	char *path;
+#define ESIZ 1024
+	char *e;
+	struct stat lde;
+
+	/* respect the override in environment */
+	ldoveride = getenv("BINUTILS_CONFIG_LD");
+	if (ldoveride != NULL && *ldoveride != '\0') {
+		if (verbose)
+			fprintf(stdout, "%s: using BINUTILS_CONFIG_LD=%s "
+					"from environment\n", wrapper, ldoveride);
+		*ld = ldoveride;
+		return;
+	}
+	if (verbose)
+		fprintf(stdout, "%s: BINUTILS_CONFIG_LD not found in environment\n",
+				wrapper);
+	
+	if ((e = malloc(sizeof(char) * ESIZ)) == NULL) {
+		fprintf(stderr, "%s: out of memory allocating string for path to ld\n",
+				wrapper);
+		exit(1);
+	}
+
+	/* find ld in PATH, allowing easy PATH overrides */
+	path = getenv("PATH");
+	if (path != NULL && *path != '\0') {
+		char *p;
+		char *q;
+
+		for (p = path; (q = strchr(p, ':')) != NULL; p = q + 1) {
+			if (q)
+				*q = '\0';
+			if (strstr(p, "/" CHOST "/binutils-bin/") != NULL) {
+				snprintf(e, ESIZ, "%s/%s", p, wrapper);
+				if (stat(e, &lde) == 0) {
+					*ld = e;
+					return;
+				}
+			}
+			if (!q)
+				break;
+		}
+	}
+	if (verbose)
+		fprintf(stdout, "%s: linker not found in PATH\n", wrapper);
+
+	/* parse EPREFIX/etc/env.d/binutils/config-CHOST to get CURRENT, then
+	 * consider $EPREFIX/usr/CHOST/binutils-bin/CURRENT where we should
+	 * be able to find ld */
+	if ((f = fopen(EPREFIX "/etc/env.d/binutils/config-" CHOST, "r")) != NULL) {
+		char p[ESIZ];
+		while (fgets(p, ESIZ, f) != NULL) {
+			if (strncmp(p, "CURRENT=", strlen("CURRENT=")) == 0) {
+				char *q = p + strlen(p);
+				/* strip trailing whitespace (fgets at least includes
+				 * the \n) */
+				for (q--; isspace(*q); q--)
+					*q = '\0';
+					;
+				snprintf(e, ESIZ, EPREFIX "/usr/" CHOST "/binutils-bin/%s/%s",
+						p + strlen("CURRENT="), wrapper);
+				break;
+			}
+		}
+		fclose(f);
+		if (stat(e, &lde) == 0) {
+			*ld = e;
+			return;
+		}
+	}
+	if (verbose)
+		fprintf(stdout, "%s: linker not found via " EPREFIX
+				"/etc/env.d/binutils/config-" CHOST "\n", wrapper);
+	
+	/* last try, call binutils-config to tell us what the linker is
+	 * supposed to be */
+	if ((f = popen("binutils-config -c", "r")) != NULL) {
+		char p[ESIZ];
+		if (fgets(p, ESIZ, f) != NULL) {
+			snprintf(e, ESIZ, EPREFIX "/usr/" CHOST "/binutils-bin/%s/%s",
+					p, wrapper);
+		} else {
+			*p = '\0';
+		}
+		fclose(f);
+		if (*p && stat(e, &lde) == 0) {
+			*ld = e;
+			return;
+		}
+	}
+	if (verbose)
+		fprintf(stdout, "%s: linker not found via binutils-config -c\n",
+				wrapper);
+
+	/* we didn't succeed finding the linker */
+	*ld = NULL;
+}
+
+int
+main(int argc, char *argv[])
+{
+	char *ld = NULL;
+	int newargc = 0;
+	char **newargv = NULL;
+	char *wrapper = argc > 0 ? argv[0] : "ld-wrapper";
+	char verbose = getenv("BINUTILS_CONFIG_VERBOSE") != NULL;
+	char *p;
+	int i;
+	int j;
+
+	/* cannonicanise wrapper, stripping path and CHOST */
+	if ((p = strrchr(wrapper, '/')) != NULL) {
+		wrapper = p + 1;
+		p = CHOST "-";
+		if (strncmp(wrapper, p, strlen(p)) == 0)
+			wrapper += strlen(p);
+	}
+
+	/* walk over the arguments to see if there's anything interesting
+	 * for us and calculate the final number of arguments */
+	for (i = 1; i < argc; i++) {
+		/* -L: account space for the matching -R */
+		if (argv[i][0] == '-') {
+			if (argv[i][1] == 'L')
+				newargc++;
+			if (argv[i][1] == 'v' || argv[i][1] == 'V')
+				verbose = 1;
+		}
+	}
+	/* account the original arguments */
+	newargc += argc > 0 ? argc : 1;
+#ifdef TARGET_DARWIN
+	/* add the 2 prefix paths (-L), -search_paths_first and a
+	 * null-terminator */
+	newargc += 2 + 1 + 1;
+#else
+	/* add the 4 paths we want (-L + -R) and a null-terminator */
+	newargc += 8 + 1;
+#endif
+
+	/* let's first try to find the real ld */
+	find_real_ld(&ld, verbose, wrapper);
+	if (ld == NULL) {
+		fprintf(stderr, "%s: failed to locate the real ld!\n", wrapper);
+		exit(1);
+	}
+
+	newargv = malloc(sizeof(char *) * newargc);
+	if (newargv == NULL) {
+		fprintf(stderr, "%s: failed to allocate memory for new arguments\n",
+				wrapper);
+		exit(1);
+	}
+
+	/* construct the new argv */
+	j = 0;
+	if ((p = strrchr(ld, '/')) != NULL) {
+		newargv[j++] = p + 1;
+	} else {
+		newargv[j++] = ld;
+	}
+#ifdef TARGET_DARWIN
+	/* inject this first to make the intention clear */
+	newargv[j++] = "-search_paths_first";
+#endif
+	for (i = 1; i < argc; i++, j++) {
+		newargv[j] = argv[i];
+#ifndef TARGET_DARWIN
+		/* on ELF targets we add runpaths for all found search paths */
+		if (argv[i][0] == '-' && argv[i][1] == 'L') {
+			newargv[++j] = strdup(argv[i]);
+			if (newargv[j] == NULL) {
+				fprintf(stderr, "%s: failed to allocate memory for "
+						"'%s' -R argument\n", wrapper, argv[i]);
+				exit(1);
+			}
+			newargv[j][1] = 'R';
+		}
+#endif
+	}
+	/* add the custom paths */
+#ifdef TARGET_DARWIN
+	newargv[j++] = "-L" EPREFIX "/usr/lib";
+	newargv[j++] = "-L" EPREFIX "/lib";
+#else
+	newargv[j++] = "-L" EPREFIX "/usr/" CHOST "/lib/gcc";
+	newargv[j++] = "-R" EPREFIX "/usr/" CHOST "/lib/gcc";
+	newargv[j++] = "-L" EPREFIX "/usr/" CHOST "/lib";
+	newargv[j++] = "-R" EPREFIX "/usr/" CHOST "/lib";
+	newargv[j++] = "-L" EPREFIX "/usr/lib";
+	newargv[j++] = "-R" EPREFIX "/usr/lib";
+	newargv[j++] = "-L" EPREFIX "/lib";
+	newargv[j++] = "-R" EPREFIX "/lib";
+#endif
+	newargv[j] = NULL;
+
+	if (verbose) {
+		fprintf(stdout, "%s: invoking %s with arguments:\n", wrapper, ld);
+		for (j = 0; newargv[j] != NULL; j++)
+			fprintf(stdout, "  %s\n", newargv[j]);
+	}
+
+	/* finally, execute the real ld */
+	execv(ld, newargv);
+	fprintf(stderr, "%s: failed to execute %s: %s\n",
+			wrapper, ld, strerror(errno));
+	exit(1);
+}


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/, sys-devel/binutils-config/
@ 2017-11-25 18:33 Fabian Groffen
  0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2017-11-25 18:33 UTC (permalink / raw
  To: gentoo-commits

commit:     f1c2d739d6990e43502251afd7dcb6854abf8ce9
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 25 15:49:08 2017 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Nov 25 15:49:08 2017 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f1c2d739

sys-devel/binutils-config: cleanup

Package-Manager: Portage-2.3.13-prefix, Repoman-2.3.4

 sys-devel/binutils-config/Manifest                 |   1 -
 .../binutils-config/binutils-config-3-r03.1.ebuild |  46 --
 .../binutils-config/binutils-config-4-r01.1.ebuild |  59 ---
 .../binutils-config/binutils-config-4-r1.ebuild    |  58 ---
 sys-devel/binutils-config/files/binutils-config-3  | 534 ---------------------
 sys-devel/binutils-config/files/binutils-config-4  | 475 ------------------
 .../files/binutils-config-4-aix-ld-svr4.patch      |  89 ----
 .../files/binutils-config-4-ldwrapper.patch        |  32 --
 .../binutils-config-4-no-macosx-version-min.patch  |  16 -
 sys-devel/binutils-config/metadata.xml             |   7 +-
 10 files changed, 4 insertions(+), 1313 deletions(-)

diff --git a/sys-devel/binutils-config/Manifest b/sys-devel/binutils-config/Manifest
deleted file mode 100644
index fc2e289920..0000000000
--- a/sys-devel/binutils-config/Manifest
+++ /dev/null
@@ -1 +0,0 @@
-DIST toolchain-prefix-wrapper-0.3.1723.tar.xz 95352 SHA256 fdb4c2a82ddcee8330ea6274db02b78ddc921670f3184028f7bbc83b5054ea29 SHA512 308933057c0888bca929aedebae7b3a54cb355a31de2568ef59871d541440267c14815556b5d40e7049fc1e3d297a239dd247393248ff6413c7a8e189357ca27 WHIRLPOOL f04684e4c1717d2d2e5e3c1a86b3c68807047c83e35625bc3e99c1bc547c16b2e208a13a1e8bce5143ac2edc07b275439d0a61663ebab4e1437ea5d68d7a3db6

diff --git a/sys-devel/binutils-config/binutils-config-3-r03.1.ebuild b/sys-devel/binutils-config/binutils-config-3-r03.1.ebuild
deleted file mode 100644
index 69677ed667..0000000000
--- a/sys-devel/binutils-config/binutils-config-3-r03.1.ebuild
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/binutils-config-3-r3.ebuild,v 1.9 2012/07/29 18:36:13 armin76 Exp $
-
-EAPI=3
-
-inherit eutils toolchain-funcs prefix
-
-DESCRIPTION="Utility to change the binutils version being used - prefix version"
-HOMEPAGE="http://www.gentoo.org/"
-W_VER="0.3.1723"
-SRC_URI="http://dev.gentoo.org/~grobian/distfiles/toolchain-prefix-wrapper-${W_VER}.tar.xz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="sunld"
-
-RDEPEND="userland_GNU? ( !<sys-apps/findutils-4.2 )"
-
-S=${WORKDIR}/toolchain-prefix-wrapper-${W_VER}
-
-src_prepare() {
-	cp "${FILESDIR}"/${P} ./${PN} || die
-	eprefixify ${PN} || die "eprefixify failed."
-	# fix configure stupidity, until next release
-	sed -i -e 's/x10\.\[3456789\]/x10.*/' configure || die
-}
-
-src_configure() {
-	econf --with-macosx-version-min=${MACOSX_DEPLOYMENT_TARGET} \
-		$(use_with sunld native-ld)
-}
-
-src_install() {
-	emake install DESTDIR="${D}" || die "emake install failed."
-	dobin ${PN} || die "cannot install ${PN} script."
-}
-
-pkg_postinst() {
-	# refresh all links and the wrapper
-	if [[ ${ROOT%/} == "" ]] ; then
-		[[ -f ${EROOT}/etc/env.d/binutils/config-${CHOST} ]] \
-			&& binutils-config $(${EROOT}/usr/bin/binutils-config --get-current-profile)
-	fi
-}

diff --git a/sys-devel/binutils-config/binutils-config-4-r01.1.ebuild b/sys-devel/binutils-config/binutils-config-4-r01.1.ebuild
deleted file mode 100644
index 8ef953a5ad..0000000000
--- a/sys-devel/binutils-config/binutils-config-4-r01.1.ebuild
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/binutils-config-3-r3.ebuild,v 1.9 2012/07/29 18:36:13 armin76 Exp $
-
-EAPI=5
-
-inherit eutils toolchain-funcs prefix
-
-DESCRIPTION="Utility to change the binutils version being used - prefix version"
-HOMEPAGE="http://www.gentoo.org/"
-W_VER="0.3.1723"
-SRC_URI="http://dev.gentoo.org/~grobian/distfiles/toolchain-prefix-wrapper-${W_VER}.tar.xz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="sunld"
-
-S=${WORKDIR}/toolchain-prefix-wrapper-${W_VER}
-
-# NOTE: the ld wrapper is only enabled on rpath versions of prefix.
-
-src_prepare() {
-	cp "${FILESDIR}"/${P} ./${PN} || die
-	if use prefix-guest; then
-		epatch "${FILESDIR}/${P}-ldwrapper.patch"
-	fi
-	eprefixify ${PN}
-
-	# fix configure stupidity, until next release
-	sed -i -e 's/x10\.\[3456789\]/x10.*/' configure
-	epatch "${FILESDIR}"/${P}-no-macosx-version-min.patch
-	epatch "${FILESDIR}"/${P}-aix-ld-svr4.patch
-}
-
-src_configure() {
-	if use prefix-guest; then
-		econf --with-macosx-version-min=${MACOSX_DEPLOYMENT_TARGET} \
-			$(use_with sunld native-ld)
-	fi
-}
-
-src_install() {
-	if use prefix-guest; then
-		use prefix-guest && \
-			emake install DESTDIR="${D}"
-	fi
-
-	dobin ${PN}
-	doman "${FILESDIR}"/${PN}.8
-}
-
-pkg_postinst() {
-	# refresh all links and the wrapper
-	if [[ ${ROOT%/} == "" ]] ; then
-		[[ -f ${EROOT}/etc/env.d/binutils/config-${CHOST} ]] \
-			&& binutils-config $(binutils-config --get-current-profile)
-	fi
-}

diff --git a/sys-devel/binutils-config/binutils-config-4-r1.ebuild b/sys-devel/binutils-config/binutils-config-4-r1.ebuild
deleted file mode 100644
index b9720d00b8..0000000000
--- a/sys-devel/binutils-config/binutils-config-4-r1.ebuild
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/binutils-config-3-r3.ebuild,v 1.9 2012/07/29 18:36:13 armin76 Exp $
-
-EAPI=5
-
-inherit eutils toolchain-funcs prefix
-
-DESCRIPTION="Utility to change the binutils version being used - prefix version"
-HOMEPAGE="http://www.gentoo.org/"
-W_VER="0.3.1723"
-SRC_URI="http://dev.gentoo.org/~grobian/distfiles/toolchain-prefix-wrapper-${W_VER}.tar.xz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="sunld"
-
-S=${WORKDIR}/toolchain-prefix-wrapper-${W_VER}
-
-# NOTE: the ld wrapper is only enabled on rpath versions of prefix.
-
-src_prepare() {
-	cp "${FILESDIR}"/${P} ./${PN} || die
-	if use prefix-guest; then
-		epatch "${FILESDIR}/${P}-ldwrapper.patch"
-	fi
-	eprefixify ${PN}
-
-	# fix configure stupidity, until next release
-	sed -i -e 's/x10\.\[3456789\]/x10.*/' configure
-	epatch "${FILESDIR}"/${P}-no-macosx-version-min.patch
-}
-
-src_configure() {
-	if use prefix-guest; then
-		econf --with-macosx-version-min=${MACOSX_DEPLOYMENT_TARGET} \
-			$(use_with sunld native-ld)
-	fi
-}
-
-src_install() {
-	if use prefix-guest; then
-		use prefix-guest && \
-			emake install DESTDIR="${D}"
-	fi
-
-	dobin ${PN}
-	doman "${FILESDIR}"/${PN}.8
-}
-
-pkg_postinst() {
-	# refresh all links and the wrapper
-	if [[ ${ROOT%/} == "" ]] ; then
-		[[ -f ${EROOT}/etc/env.d/binutils/config-${CHOST} ]] \
-			&& binutils-config $(binutils-config --get-current-profile)
-	fi
-}

diff --git a/sys-devel/binutils-config/files/binutils-config-3 b/sys-devel/binutils-config/files/binutils-config-3
deleted file mode 100755
index f642381acd..0000000000
--- a/sys-devel/binutils-config/files/binutils-config-3
+++ /dev/null
@@ -1,534 +0,0 @@
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-3,v 1.9 2012/08/18 03:57:50 vapier Exp $
-
-# Format of /etc/env.d/binutils/:
-#  config-TARGET:	CURRENT=version for TARGET
-#  TARGET-VER:		has a TARGET and VER variable
-
-BPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-: ${EPREFIX:=${BPREFIX}}
-
-: ${ROOT:=/}
-[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
-[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
-EROOT="${ROOT%/}${EPREFIX}/"
-
-cd ${EPREFIX}
-
-trap ":" INT QUIT TSTP
-
-argv0=${0##*/}
-source "${BPREFIX}"/etc/init.d/functions.sh || {
-	echo "${argv0}: Could not source ${BPREFIX}/etc/init.d/functions.sh!" 1>&2
-	exit 1
-}
-esyslog() { :; }
-die() { eerror "${argv0}: $*"; exit 1; }
-umask 022
-
-usage() {
-cat << USAGE_END
-Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL}
-
-${HILITE}General Options:${NORMAL}
-  ${GOOD}-c, --get-current-profile${NORMAL}  Print current profile
-  ${GOOD}-l, --list-profiles${NORMAL}        Print a list of available profiles
-  ${GOOD}-u, --uninstall${NORMAL}            Remove all signs of specified target
-  ${GOOD}-d, --debug${NORMAL}                Execute with debug output
-
-${HILITE}General Cruft:${NORMAL}
-  ${GOOD}--linker${NORMAL} <linker>          Switch to specified linker (if supported)
-
-${HILITE}Arch Specific Cruft:${NORMAL}
-  ${GOOD}--amd64${NORMAL}                    Install extra amd64 links (x86_64)
-  ${GOOD}--arm${NORMAL}                      Install extra arm links (arm/armeb)
-  ${GOOD}--mips${NORMAL}                     Install extra mips links (mips/mipsel)
-  ${GOOD}--x86${NORMAL}                      Install extra x86 links (i[3-6]86)
-
-Profile names are of the form:  ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
-For example:                    ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
-
-For more info, please see ${HILITE}binutils-config${NORMAL}(8).
-USAGE_END
-
-	exit ${1:-1}
-}
-
-mv_if_diff() {
-	if cmp -s "$1" "$2" ; then
-		rm -f "$1"
-	else
-		mv -f "$1" "$2"
-	fi
-}
-atomic_ln() {
-	local target=$1 linkdir=$2 linkname=$3 linktmp linkfull
-	linktmp="${linkdir}/.binutils-config.tmp.${linkname}"
-	linkfull="${linkdir}/${linkname}"
-	if [[ -d ${linkfull} ]] ; then
-		# if linking to a dir, we need a little magic to
-		# make it atomic since `mv -T` is not portable
-		rm -rf "${linktmp}"
-		mkdir -p "${linktmp}"
-		ln -sf "${target}" "${linktmp}/${linkname}"
-		mv "${linktmp}/${linkname}" "${linktmp}/../"
-		rmdir "${linktmp}"
-	else
-		# `ln` will expand into unlink();symlink(); which
-		# is not atomic for a small amount of time, but
-		# `mv` is a single rename() call
-		ln -sf "${target}" "${linktmp}"
-		mv "${linktmp}" "${linkfull}"
-	fi
-}
-
-setup_env() {
-	unset TARGET VER LIBPATH FAKE_TARGETS
-	source "${ENV_D}/${PROFILE}"
-	if [[ -z ${TARGET} ]] ; then
-		eerror "${PROFILE} is invalid (no \$TARGET defined) :("
-		return 1
-	fi
-	if [[ -z ${VER} ]] ; then
-		eerror "${PROFILE} is invalid (no \$VER defined) :("
-		return 1
-	fi
-
-	#
-	# Older installs don't have 'FAKE_TARGETS' defined, so lets
-	# update these env.d entries so that we don't force the poor
-	# user to re-emerge their binutils just for 1 envvar :/
-	#
-	if [[ ${FAKE_TARGETS-poor user} == "poor user" ]] ; then
-		local targ=${TARGET/-*}
-		local FAKE_TARGETS=${TARGET}
-		case ${targ} in
-			mips|powerpc|sparc)
-				FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/-/64-}";;
-			mips64|powerpc64|sparc64)
-				FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/64-/-}";;
-		esac
-		echo "FAKE_TARGETS=\"${FAKE_TARGETS}\"" >> "${ENV_D}/${PROFILE}"
-	fi
-	local fake_targ_append="${TARGET#*-}"
-	FAKE_TARGETS="${FAKE_TARGETS} ${FAKE_TARGETS_USER// /-${fake_targ_append} }"
-
-	#
-	# Generate binary symlinks
-	# On systems that do 32bit/64bit, we need to fake an
-	# extra set of binary names (${FAKE_TARGETS})
-	#
-	BINPATH=""
-	BINPATH_LINKS=""
-	if [[ ${TARGET} != ${HOST} ]] ; then
-		#
-		# Newer paths: /usr/${HOST}/${TARGET}/...
-		# Older paths: /usr/${TARGET}/...
-		#
-		if [[ -d ${EROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
-			BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER}
-			BINPATH_LINKS=/usr/libexec/gcc/${TARGET}
-		fi
-	fi
-	if [[ -z ${BINPATH} ]] ; then
-		BINPATH=/usr/${TARGET}/binutils-bin/${VER}
-		BINPATH_LINKS=/usr/${TARGET}/bin
-	fi
-}
-
-switch_profile() {
-	ebegin "Switching to ${PROFILE}"
-
-	setup_env || return 1
-
-	cd "${EROOT}/${BINPATH}" || exit 1
-	mkdir -p "${EROOT}/${BINPATH_LINKS}" "${EROOT}/usr/bin"
-	for x in * ; do
-		case ${x} in
-			ld|ld64)
-				# recompile the wrapper for the desired target
-				# not a huge fan of it, never have been
-				"${BPREFIX}"/usr/lib/misc/binutils-config/create-ldwrapper \
-					--wrapper-name="${x}" \
-					--wrapper-source="${EROOT}usr/lib/misc/binutils-config" \
-					--output-file="${EROOT}/${BINPATH_LINKS}/${x}" \
-					--host="${HOST}" \
-					--target="${TARGET}" \
-					--binpath="${BINPATH}" \
-					--debug="${DEBUG}" \
-				|| return 1
-				touch -r "${EROOT}/${BINPATH}/${x}" "${EROOT}/${BINPATH_LINKS}/${x}"
-			;;
-			*)
-				atomic_ln "${EROOT}${BINPATH}/${x}" "${EROOT}/${BINPATH_LINKS}" "${x}"
-			;;
-		esac
-		atomic_ln "${EROOT}/${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin/" "${TARGET}-${x}"
-		for fake in ${FAKE_TARGETS} ; do
-			[[ -f ${ENV_D}/config-${fake} ]] && continue
-			atomic_ln "${EROOT}/${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin" "${fake}-${x}"
-		done
-		if [[ ${TARGET} == ${HOST} ]] ; then
-			atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}"
-		fi
-	done
-
-	#
-	# Generate library / ldscripts symlinks
-	#
-	: ${LIBPATH:=/usr/lib/binutils/${TARGET}/${VER}}
-	[[ ${LIBPATH} == ${EPREFIX}* ]] && LIBPATH=${LIBPATH#${EPREFIX}}
-	cd "${EROOT}/${LIBPATH}" || exit 1
-	if [[ ${TARGET} == ${HOST} ]] ; then
-		dstlib=${EROOT}/usr/${HOST}/lib
-	else
-		dstlib=${EROOT}/usr/${HOST}/${TARGET}/lib
-	fi
-	# When upgrading, we need to clean up ldscripts and libs
-	mkdir -p "${dstlib}"
-	rm -rf "${EROOT}/${BINPATH_LINKS}"/ldscripts
-	# avoid pointless warning about removing non-existant ldscripts dir
-	if [[ -d ${EROOT}/${LIBPATH}/ldscripts ]] ; then
-		atomic_ln "${EROOT}/${LIBPATH}/ldscripts" "${dstlib}" "ldscripts"
-		find -L "${dstlib}" -type l -exec rm -v {} +
-	fi
-	for x in lib* ; do
-		# avoid symlink 'lib*' -> '/...' when no libs (native/nongnu binutils)
-		[[ ${x} != 'lib*' ]] || continue
-		atomic_ln "${EROOT}/${LIBPATH}/${x}" "${dstlib}" "${x}"
-	done
-
-	#
-	# Generate include symlinks
-	#
-	INCPATH=${LIBPATH}/include
-	if [[ -d ${EROOT}/${INCPATH} ]] ; then
-		cd "${EROOT}/${INCPATH}" || exit 1
-		if [[ ${HOST} == ${TARGET} ]] ; then
-			mkdir -p "${EROOT}/usr/include"
-			for x in * ; do
-				atomic_ln "${EROOT}/${INCPATH}/${x}" "${EROOT}/usr/include" "${x}"
-			done
-		else
-			# Clean out old path -- cannot use '-exec {} +' syntax here
-			find . -type f -exec rm -f "${EROOT}/usr/${TARGET}/usr/include/{}" \;
-			rmdir "${EROOT}/usr/${TARGET}/usr/include" >& /dev/null
-			rmdir "${EROOT}/usr/${TARGET}/usr" >& /dev/null
-			rmdir "${EROOT}/usr/${TARGET}" >& /dev/null
-		fi
-	fi
-
-	#
-	# Make sure proper paths get updated
-	#
-	if [[ ${TARGET} == ${HOST} ]] ; then
-		DATAPATH=${EROOT}/usr/share/binutils-data/${TARGET}/${VER}
-		local e="${EROOT}"/etc/env.d/05binutils
-		local ee="${e}.tmp"
-		rm -f "${ee}"
-		[[ -d ${DATAPATH}/man  ]] && echo "MANPATH=${DATAPATH}/man"   >> "${ee}"
-		[[ -d ${DATAPATH}/info ]] && echo "INFOPATH=${DATAPATH}/info" >> "${ee}"
-		# hmm, `ld` has this in SEARCH_DIR(), but ld.so does not ...
-		if [[ -d ${EROOT}/etc/ld.so.conf.d ]] ; then
-			local l="${EROOT}"/etc/ld.so.conf.d/05binutils.conf
-			local ll="${l}.tmp"
-			echo "${EPREFIX}/usr/${TARGET}/lib" > "${ll}"
-			mv_if_diff "${ll}" "${l}"
-		else
-			echo "LDPATH=${EPREFIX}/usr/${TARGET}/lib" >> "${ee}"
-		fi
-		mv_if_diff "${ee}" "${e}"
-	fi
-
-	local c="${ENV_D}/config-${TARGET}"
-	local cc="${c}.tmp"
-	echo "CURRENT=${VER}" > "${cc}"
-	mv_if_diff "${cc}" "${c}"
-
-	eend 0
-
-	#
-	# Regen env.d if need/can be
-	#
-	if [[ ${ROOT} == / ]] && [[ ${TARGET} == ${HOST} ]] ; then
-		env-update
-		echo
-		ewarn "Please remember to run:"
-		echo
-		ewarn " (bash) # . ${EPREFIX}/etc/profile"
-		ewarn "or"
-		ewarn " (tcsh) # source ${EPREFIX}/etc/csh.login"
-		echo
-	fi
-
-	return 0
-}
-
-uninstall_target() {
-	: ${TARGET:=${UARG}}
-
-	if [[ ${TARGET} == ${HOST} ]] ; then
-		die "refusing to uninstall native binutils"
-	fi
-
-	shopt -s nullglob
-	PROFILE=""
-
-	for PROFILE in "${ENV_D}"/${TARGET}-* ; do
-		ewarn "Removing all signs of ${PROFILE##*/}"
-		rm -f "${ENV_D}"/${PROFILE}
-	done
-	if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then
-		die "no profiles exist for '${TARGET}'"
-	fi
-
-	rm -f "${ENV_D}"/config-${TARGET} "${ROOT}"/etc/ld.so.conf.d/05binutils.conf
-
-	# XXX: we still leave behind FAKE_TARGETS in /usr/bin ...
-	local x
-	for x in addr2line ar as c++filt elf2flt flthdr gprof ld ld.real \
-	         nm objcopy objdump ranlib readelf size strings strip ; do
-		x=(
-			"${EROOT}"/usr/bin/${TARGET}-${x}
-			"${EROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
-			"${EROOT}"/usr/libexec/gcc/${TARGET}/${x}
-		)
-		rm -f "${x[@]}"
-	done
-	for x in ansidecl.h bfd.h bfdlink.h dis-asm.h symcat.h ; do
-		rm -f "${EROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
-	done
-	for x in bfd iberty opcodes ; do
-		rm -f "${EROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
-	done
-	# Delete broken symlinks
-	local destdir="${EROOT}/usr/${HOST}/${TARGET}"
-	rm -f "${destdir}"/lib/ldscripts
-	find -L "${destdir}"/lib -type l -exec rm {} +
-	rmdir \
-		"${destdir}"/{bin,include,lib,usr} \
-		"${destdir}" \
-		"${EROOT}"/var/db/pkg/cross-${TARGET} \
-		2>/dev/null
-
-	rm -f "${ENV_D}"/${TARGET}-*
-}
-
-set_current_profile() {
-	if [[ ! -f ${ENV_D}/config-${TARGET} ]] ; then
-		eerror "${argv0}: unable to locate a profile for target: ${TARGET}"
-		return 1
-	fi
-
-	source "${ENV_D}/config-${TARGET}"
-
-	if [[ -z ${CURRENT} ]] ; then
-		eerror "${argv0}: no binutils profile is active!"
-		return 1
-	fi
-
-	echo "${TARGET}-${CURRENT}"
-
-	return 0
-}
-get_current_profile() { echo "${PROFILE}" ; }
-
-list_profiles() {
-	local x i target
-
-	if [[ ${ROOT} != / ]] ; then
-		echo "Using binutils-config info in ${ROOT}"
-	fi
-
-	set -- "${ENV_D}"/*
-	target=
-	i=1
-
-	for x ; do
-		# skip broken links and config files
-		[[ -f ${x} ]] || continue
-		[[ ${x} == */config-* ]] && continue
-
-		source "${x}"
-		if [[ ${target} != ${TARGET} ]] ; then
-			[[ -n ${target} ]] && echo
-			target=${TARGET}
-		fi
-
-		x=${x##*/}
-		if [[ -e ${ENV_D}/config-${TARGET} ]] ; then
-			source "${ENV_D}/config-${TARGET}"
-			if [[ ${VER} == ${CURRENT} ]] ; then
-				[[ ${TARGET} == ${HOST} ]] \
-					&& x="${x} ${GOOD}*${NORMAL}" \
-					|| x="${x} ${HILITE}*${NORMAL}"
-			fi
-		fi
-
-		# We would align the [...] field like so:
-		#printf ' [%*ss] %s\n' ${##} "${i}" "${x}"
-		# but this breaks simple scripting: `binutils -l | awk '{print $2}'`
-
-		# Or we could align the target col like so:
-		#printf ' [%s]%*s %s\n' "${i}" $(( ${##} - ${#i} )) "" "${x}"
-		# but i'm not sold that it looks better
-
-		# So keep it simple ... only makes a diff anyways for crazy people
-		# like me which have 100+ binutils packages installed ...
-		echo " [$i] ${x}"
-		((++i))
-	done
-}
-
-switch_linker() {
-	local bpath ld=$1
-
-	case ${ld} in
-	ld.*) ;;
-	*) die "not supported: linker must start with 'ld.'" ;;
-	esac
-
-	setup_env || return 1
-	bpath="${EROOT}/${BINPATH}"
-
-	# does this binutils even support the requested linker ?
-	if [[ ! -e ${bpath}/${ld} ]] ; then
-		die "sorry, but ${PROFILE} doesn't support the ${ld} linker"
-	fi
-
-	# switch it up
-	ebegin "Setting default linker to ${ld} for ${PROFILE}"
-	atomic_ln ${ld} "${bpath}" ld
-	eend $?
-}
-
-set_HOST() {
-	# Set HOST to CHOST if it isn't already set
-	: ${HOST:=${CHOST:-$(portageq envvar CHOST)}}
-}
-
-ENV_D="${EROOT}etc/env.d/binutils"
-
-DEBUG="no"
-NEED_ACTION="yes"
-DOIT="switch_profile"
-PROFILE="current"
-FAKE_TARGETS_USER=""
-HOST=""
-TARGET=""
-unset UARG
-
-select_action() {
-	if [[ ${NEED_ACTION} != "no" ]] ; then
-		NEED_ACTION="no"
-		DOIT=$1
-	else
-		die "one action at a time!"
-	fi
-}
-
-while [[ $# -gt 0 ]] ; do
-	x=$1
-	shift
-	case ${x} in
-		-c|--get-current-profile)  select_action get_current_profile ;;
-		-l|--list|--list-profiles) select_action list_profiles ;;
-		-u|--uninstall)            select_action uninstall_target ;;
-		--linker)                  select_action "switch_linker $1"; shift ;;
-		-d|--debug)                DEBUG="yes" ;;
-		-h|--help)                 usage 0 ;;
-		-V|--version)
-			unset Header
-			cvsver="$Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-3,v 1.9 2012/08/18 03:57:50 vapier Exp $"
-			cvsver=${cvsver##*binutils-config-}
-			bver=${cvsver%%,v *}
-			cvsver=${cvsver#* }
-			echo "binutils-config-${bver} (r${cvsver%% *})"
-			exit 0
-			;;
-		--amd64|--arm|--mips|--x86)
-			if [[ ${NEED_ACTION} == "yes" ]] ; then
-				# Make sure we have a space after each target
-				NEED_ACTION="no"
-				case ${x} in
-					--amd64) FAKE_TARGETS_USER="x86_64 ";;
-					--arm)   FAKE_TARGETS_USER="arm armeb ";;
-					--x86)   FAKE_TARGETS_USER="i386 i486 i586 i686 ";;
-					--mips)  FAKE_TARGETS_USER="mips mips64 mipsel mipsel64 ";;
-				esac
-			fi
-			;;
-		-*)
-			die "invalid switch!  Try '--help'."
-			;;
-		*)
-			if [[ ${UARG+set} == "set" ]] ; then
-				die "only one profile/target at a time please"
-			fi
-			NEED_ACTION="maybe"
-			UARG=${x}
-			;;
-	esac
-done
-
-[[ ${NEED_ACTION} == "yes" ]] && usage 1
-[[ ${DEBUG} == "yes" ]] && set -x
-
-# All operations need to know the current HOST to figure out
-# what is a native target and what is a cross target
-set_HOST
-
-# All operations need to know the profile the user wants
-case ${DOIT} in
-switch_profile|switch_linker_*)
-	# decode user's profile choice
-	x=${UARG:-$(TARGET=${HOST} set_current_profile)}
-	PROFILE=""
-	if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
-		# User gave us a # representing the profile
-		i=1
-		for y in "${ENV_D}"/* ; do
-			[[ ${y/config-} != ${y} ]] && continue
-
-			if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then
-				PROFILE=${y##*/}
-				break
-			fi
-			((++i))
-		done
-	fi
-
-	if [[ -z ${PROFILE} ]] ; then
-		# User gave us a full HOST-ver
-		x=${x##*/}
-		if [[ -f ${ENV_D}/${x} ]] ; then
-			# Valid HOST-ver yeah!
-			PROFILE=${x}
-		else
-			# Not a valid HOST-ver ...
-			if [[ ! -f ${ENV_D}/config-${x} ]] ; then
-				# Maybe they just gave us a ver ...
-				if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then
-					x=${HOST}-${x}
-				else
-					die "could not locate '$x' in '${ENV_D}/'!"
-				fi
-				PROFILE=${x}
-			else
-				# Maybe they just gave us a target ... pick active profile
-				PROFILE=$(TARGET=${x} set_current_profile)
-			fi
-		fi
-	fi
-	;;
-*)
-	# lookup current profile as the user gave us a target
-	PROFILE=$(TARGET=${UARG:-${HOST}} set_current_profile) || exit 1
-	;;
-esac
-
-eval ${DOIT}
-
-# vim:ts=4

diff --git a/sys-devel/binutils-config/files/binutils-config-4 b/sys-devel/binutils-config/files/binutils-config-4
deleted file mode 100755
index 7454527110..0000000000
--- a/sys-devel/binutils-config/files/binutils-config-4
+++ /dev/null
@@ -1,475 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-4,v 1.1 2014/07/29 11:15:38 vapier Exp $
-
-# Format of /etc/env.d/binutils/:
-#  config-TARGET:	CURRENT=version for TARGET
-#  TARGET-VER:		has a TARGET and VER variable
-
-: ${EPREFIX:="@GENTOO_PORTAGE_EPREFIX@"}
-[[ ${EPREFIX} = */ ]] && EPREFIX="${EPREFIX%/}"
-[[ -n ${EPREFIX} && ${EPREFIX} != /* ]] && EPREFIX="${PWD%/}/${EPREFIX}"
-
-: ${ROOT:=/}
-[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
-[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
-
-EROOT="${ROOT%/}${EPREFIX}/"
-
-cd "${EPREFIX}/"
-
-trap ":" INT QUIT TSTP
-
-argv0=${0##*/}
-source "@GENTOO_PORTAGE_EPREFIX@"/etc/init.d/functions.sh || {
-	echo "${argv0}: Could not source @GENTOO_PORTAGE_EPREFIX@/etc/init.d/functions.sh!" 1>&2
-	exit 1
-}
-esyslog() { :; }
-die() { eerror "${argv0}: $*"; exit 1; }
-umask 022
-
-usage() {
-cat << USAGE_END
-Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL}
-
-${HILITE}General Options:${NORMAL}
-  ${GOOD}-c, --get-current-profile${NORMAL}  Print current profile
-  ${GOOD}-l, --list-profiles${NORMAL}        Print a list of available profiles
-  ${GOOD}-u, --uninstall${NORMAL}            Remove all signs of specified target
-  ${GOOD}-d, --debug${NORMAL}                Execute with debug output
-
-${HILITE}General Cruft:${NORMAL}
-  ${GOOD}--linker${NORMAL} <linker>          Switch to specified linker (if supported)
-
-Profile names are of the form:  ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
-For example:                    ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
-
-For more info, please see ${HILITE}binutils-config${NORMAL}(8).
-USAGE_END
-
-	exit ${1:-1}
-}
-
-mv_if_diff() {
-	if cmp -s "$1" "$2" ; then
-		rm -f "$1"
-	else
-		mv -f "$1" "$2"
-	fi
-}
-atomic_ln() {
-	local target=$1 linkdir=$2 linkname=$3 linktmp linkfull
-	linktmp="${linkdir}/.binutils-config.tmp.${linkname}"
-	linkfull="${linkdir}/${linkname}"
-	if [[ -d ${linkfull} ]] ; then
-		# if linking to a dir, we need a little magic to
-		# make it atomic since `mv -T` is not portable
-		rm -rf "${linktmp}"
-		mkdir -p "${linktmp}"
-		ln -sf "${target}" "${linktmp}/${linkname}"
-		mv "${linktmp}/${linkname}" "${linktmp}/../"
-		rmdir "${linktmp}"
-	else
-		# `ln` will expand into unlink();symlink(); which
-		# is not atomic for a small amount of time, but
-		# `mv` is a single rename() call
-		ln -sf "${target}" "${linktmp}"
-		mv "${linktmp}" "${linkfull}"
-	fi
-}
-
-setup_env() {
-	unset TARGET VER LIBPATH
-	source "${ENV_D}/${PROFILE}"
-	if [[ -z ${TARGET} ]] ; then
-		eerror "${PROFILE} is invalid (no \$TARGET defined) :("
-		return 1
-	fi
-	if [[ -z ${VER} ]] ; then
-		eerror "${PROFILE} is invalid (no \$VER defined) :("
-		return 1
-	fi
-
-	#
-	# Generate binary symlinks
-	#
-	BINPATH=""
-	BINPATH_LINKS=""
-	if [[ ${TARGET} != ${HOST} ]] ; then
-		#
-		# Newer paths: /usr/${HOST}/${TARGET}/...
-		# Older paths: /usr/${TARGET}/...
-		#
-		if [[ -d ${ROOT}${EPREFIX}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
-			BINPATH="${EPREFIX}"/usr/${HOST}/${TARGET}/binutils-bin/${VER}
-			BINPATH_LINKS="${EPREFIX}"/usr/libexec/gcc/${TARGET}
-		fi
-	fi
-	if [[ -z ${BINPATH} ]] ; then
-		BINPATH="${EPREFIX}"/usr/${TARGET}/binutils-bin/${VER}
-		BINPATH_LINKS="${EPREFIX}"/usr/${TARGET}/bin
-	fi
-}
-
-switch_profile() {
-	ebegin "Switching to ${PROFILE}"
-
-	setup_env || return 1
-
-	cd "${ROOT}/${BINPATH}" || exit 1
-	mkdir -p "${ROOT}/${BINPATH_LINKS}" "${EROOT}/usr/bin"
-	for x in * ; do
-		atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
-		atomic_ln "${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin" "${TARGET}-${x}"
-		if [[ ${TARGET} == ${HOST} ]] ; then
-			atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}"
-		fi
-	done
-
-	#
-	# Generate library / ldscripts symlinks
-	#
-	: ${LIBPATH:=${EPREFIX}/usr/lib/binutils/${TARGET}/${VER}}
-	cd "${ROOT}/${LIBPATH}" || exit 1
-	if [[ ${TARGET} == ${HOST} ]] ; then
-		dstlib=${EROOT}/usr/${HOST}/lib
-	else
-		dstlib=${EROOT}/usr/${HOST}/${TARGET}/lib
-	fi
-	# When upgrading, we need to clean up ldscripts and libs
-	mkdir -p "${dstlib}"
-	rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts
-	# avoid pointless warning about removing non-existant ldscripts dir
-	if [[ -d ${ROOT}/${LIBPATH}/ldscripts ]] ; then
-		atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts"
-		find -L "${dstlib}" -type l -exec rm -v {} +
-	fi
-	for x in lib* ; do
-		# avoid symlink 'lib*' -> '/...' when no libs (native/nongnu binutils)
-		[[ ${x} != 'lib*' ]] || continue
-		atomic_ln "${LIBPATH}/${x}" "${dstlib}" "${x}"
-	done
-
-	#
-	# Generate include symlinks
-	#
-	INCPATH=${LIBPATH}/include
-	if [[ -d ${ROOT}/${INCPATH} ]] ; then
-		cd "${ROOT}/${INCPATH}" || exit 1
-		if [[ ${HOST} == ${TARGET} ]] ; then
-			mkdir -p "${EROOT}/usr/include"
-			for x in * ; do
-				atomic_ln "${INCPATH}/${x}" "${EROOT}/usr/include" "${x}"
-			done
-		else
-			# Clean out old path -- cannot use '-exec {} +' syntax here
-			find . -type f -exec rm -f "${EROOT}/usr/${TARGET}/usr/include/{}" \;
-			rmdir "${EROOT}/usr/${TARGET}/usr/include" >& /dev/null
-			rmdir "${EROOT}/usr/${TARGET}/usr" >& /dev/null
-			rmdir "${EROOT}/usr/${TARGET}" >& /dev/null
-		fi
-	fi
-
-	#
-	# Make sure proper paths get updated
-	#
-	if [[ ${TARGET} == ${HOST} ]] ; then
-		DATAPATH="${EPREFIX}"/usr/share/binutils-data/${TARGET}/${VER}
-		local e="${EROOT}"/etc/env.d/05binutils
-		local ee="${e}.tmp"
-		rm -f "${ee}"
-		[[ -d ${DATAPATH}/man  ]] && echo "MANPATH=${DATAPATH}/man"   >> "${ee}"
-		[[ -d ${DATAPATH}/info ]] && echo "INFOPATH=${DATAPATH}/info" >> "${ee}"
-		# hmm, `ld` has this in SEARCH_DIR(), but ld.so does not ...
-		if [[ -d ${EROOT}/etc/ld.so.conf.d ]] ; then
-			local l="${EROOT}"/etc/ld.so.conf.d/05binutils.conf
-			local ll="${l}.tmp"
-			echo "${EPREFIX}/usr/${TARGET}/lib" > "${ll}"
-			mv_if_diff "${ll}" "${l}"
-		else
-			echo "LDPATH=${EPREFIX}/usr/${TARGET}/lib" >> "${ee}"
-		fi
-		mv_if_diff "${ee}" "${e}"
-	fi
-
-	local c="${ENV_D}/config-${TARGET}"
-	local cc="${c}.tmp"
-	echo "CURRENT=${VER}" > "${cc}"
-	mv_if_diff "${cc}" "${c}"
-
-	eend 0
-
-	#
-	# Regen env.d if need/can be
-	#
-	if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then
-		env-update
-		echo
-		ewarn "Please remember to run:"
-		echo
-		ewarn "  # . ${EPREFIX}/etc/profile"
-		echo
-	fi
-
-	return 0
-}
-
-uninstall_target() {
-	: ${TARGET:=${UARG}}
-
-	if [[ ${TARGET} == ${HOST} ]] ; then
-		die "refusing to uninstall native binutils"
-	fi
-
-	shopt -s nullglob
-	PROFILE=""
-
-	for PROFILE in "${ENV_D}"/${TARGET}-* ; do
-		ewarn "Removing all signs of ${PROFILE##*/}"
-		rm -f "${ENV_D}"/${PROFILE}
-	done
-	if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then
-		die "no profiles exist for '${TARGET}'"
-	fi
-
-	rm -f "${ENV_D}"/config-${TARGET} "${EROOT}"/etc/ld.so.conf.d/05binutils.conf
-
-	local x
-	for x in \
-		addr2line ar as c++filt elf2flt elfedit flthdr gprof \
-		ld ld.{bfd,gold,real} \
-		nm objcopy objdump ranlib readelf size strings strip
-	do
-		x=(
-			"${EROOT}"/usr/bin/${TARGET}-${x}
-			"${EROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
-			"${EROOT}"/usr/libexec/gcc/${TARGET}/${x}
-		)
-		rm -f "${x[@]}"
-	done
-	for x in ansidecl.h bfd.h bfdlink.h dis-asm.h symcat.h ; do
-		rm -f "${EROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
-	done
-	for x in bfd iberty opcodes ; do
-		rm -f "${EROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
-	done
-	# Delete broken symlinks
-	local destdir="${EROOT}/usr/${HOST}/${TARGET}"
-	rm -f "${destdir}"/lib/ldscripts
-	find -L "${destdir}"/lib -type l -exec rm {} +
-	rmdir \
-		"${destdir}"/{bin,include,lib,usr} \
-		"${destdir}" \
-		"${EROOT}"/var/db/pkg/cross-${TARGET} \
-		"${EROOT}"/usr/{${HOST}/,}${TARGET}/bin \
-		"${EROOT}"/usr/libexec/gcc/${TARGET} \
-		2>/dev/null
-
-	rm -f "${ENV_D}"/${TARGET}-*
-}
-
-set_current_profile() {
-	if [[ ! -f ${ENV_D}/config-${TARGET} ]] ; then
-		eerror "${argv0}: unable to locate a profile for target: ${TARGET}"
-		return 1
-	fi
-
-	source "${ENV_D}/config-${TARGET}"
-
-	if [[ -z ${CURRENT} ]] ; then
-		eerror "${argv0}: no binutils profile is active!"
-		return 1
-	fi
-
-	echo "${TARGET}-${CURRENT}"
-
-	return 0
-}
-get_current_profile() { echo "${PROFILE}" ; }
-
-list_profiles() {
-	local x i target
-
-	if [[ ${ROOT} != / ]] ; then
-		echo "Using binutils-config info in ${ROOT}"
-	fi
-
-	set -- "${ENV_D}"/*
-	target=
-	i=1
-
-	for x ; do
-		# skip broken links and config files
-		[[ -f ${x} ]] || continue
-		[[ ${x} == */config-* ]] && continue
-
-		source "${x}"
-		if [[ ${target} != ${TARGET} ]] ; then
-			[[ -n ${target} ]] && echo
-			target=${TARGET}
-		fi
-
-		x=${x##*/}
-		if [[ -e ${ENV_D}/config-${TARGET} ]] ; then
-			source "${ENV_D}/config-${TARGET}"
-			if [[ ${VER} == ${CURRENT} ]] ; then
-				[[ ${TARGET} == ${HOST} ]] \
-					&& x="${x} ${GOOD}*${NORMAL}" \
-					|| x="${x} ${HILITE}*${NORMAL}"
-			fi
-		fi
-
-		# We would align the [...] field like so:
-		#printf ' [%*ss] %s\n' ${##} "${i}" "${x}"
-		# but this breaks simple scripting: `binutils -l | awk '{print $2}'`
-
-		# Or we could align the target col like so:
-		#printf ' [%s]%*s %s\n' "${i}" $(( ${##} - ${#i} )) "" "${x}"
-		# but i'm not sold that it looks better
-
-		# So keep it simple ... only makes a diff anyways for crazy people
-		# like me which have 100+ binutils packages installed ...
-		echo " [$i] ${x}"
-		((++i))
-	done
-}
-
-switch_linker() {
-	local bpath ld=$1
-
-	case ${ld} in
-	ld.*) ;;
-	*) die "not supported: linker must start with 'ld.'" ;;
-	esac
-
-	setup_env || return 1
-	bpath="${ROOT}/${BINPATH}"
-
-	# does this binutils even support the requested linker ?
-	if [[ ! -e ${bpath}/${ld} ]] ; then
-		die "sorry, but ${PROFILE} doesn't support the ${ld} linker"
-	fi
-
-	# switch it up
-	ebegin "Setting default linker to ${ld} for ${PROFILE}"
-	atomic_ln ${ld} "${bpath}" ld
-	eend $?
-}
-
-set_HOST() {
-	# Set HOST to CHOST if it isn't already set
-	: ${HOST:=${CHOST:-$(portageq envvar CHOST)}}
-}
-
-ENV_D="${EROOT}etc/env.d/binutils"
-
-DEBUG="no"
-NEED_ACTION="yes"
-DOIT="switch_profile"
-PROFILE="current"
-HOST=""
-TARGET=""
-unset UARG
-
-select_action() {
-	if [[ ${NEED_ACTION} != "no" ]] ; then
-		NEED_ACTION="no"
-		DOIT=$1
-	else
-		die "one action at a time!"
-	fi
-}
-
-while [[ $# -gt 0 ]] ; do
-	x=$1
-	shift
-	case ${x} in
-		-c|--get-current-profile)  select_action get_current_profile ;;
-		-l|--list|--list-profiles) select_action list_profiles ;;
-		-u|--uninstall)            select_action uninstall_target ;;
-		--linker)                  select_action "switch_linker $1"; shift ;;
-		-d|--debug)                DEBUG="yes" ;;
-		-h|--help)                 usage 0 ;;
-		-V|--version)
-			unset Header
-			cvsver="$Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-4,v 1.1 2014/07/29 11:15:38 vapier Exp $"
-			cvsver=${cvsver##*binutils-config-}
-			bver=${cvsver%%,v *}
-			cvsver=${cvsver#* }
-			echo "binutils-config-${bver} (r${cvsver%% *})"
-			exit 0
-			;;
-		-*)
-			die "invalid switch!  Try '--help'."
-			;;
-		*)
-			if [[ ${UARG+set} == "set" ]] ; then
-				die "only one profile/target at a time please"
-			fi
-			NEED_ACTION="maybe"
-			UARG=${x}
-			;;
-	esac
-done
-
-[[ ${NEED_ACTION} == "yes" ]] && usage 1
-[[ ${DEBUG} == "yes" ]] && set -x
-
-# All operations need to know the current HOST to figure out
-# what is a native target and what is a cross target
-set_HOST
-
-# All operations need to know the profile the user wants
-case ${DOIT} in
-switch_profile|switch_linker_*)
-	# decode user's profile choice
-	x=${UARG:-$(TARGET=${HOST} set_current_profile)}
-	PROFILE=""
-	if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
-		# User gave us a # representing the profile
-		i=1
-		for y in "${ENV_D}"/* ; do
-			[[ ${y/config-} != ${y} ]] && continue
-
-			if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then
-				PROFILE=${y##*/}
-				break
-			fi
-			((++i))
-		done
-	fi
-
-	if [[ -z ${PROFILE} ]] ; then
-		# User gave us a full HOST-ver
-		x=${x##*/}
-		if [[ -f ${ENV_D}/${x} ]] ; then
-			# Valid HOST-ver yeah!
-			PROFILE=${x}
-		else
-			# Not a valid HOST-ver ...
-			if [[ ! -f ${ENV_D}/config-${x} ]] ; then
-				# Maybe they just gave us a ver ...
-				if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then
-					x=${HOST}-${x}
-				else
-					die "could not locate '$x' in '${ENV_D}/'!"
-				fi
-				PROFILE=${x}
-			else
-				# Maybe they just gave us a target ... pick active profile
-				PROFILE=$(TARGET=${x} set_current_profile)
-			fi
-		fi
-	fi
-	;;
-*)
-	# lookup current profile as the user gave us a target
-	PROFILE=$(TARGET=${UARG:-${HOST}} set_current_profile) || exit 1
-	;;
-esac
-
-eval ${DOIT}
-
-# vim:ts=4

diff --git a/sys-devel/binutils-config/files/binutils-config-4-aix-ld-svr4.patch b/sys-devel/binutils-config/files/binutils-config-4-aix-ld-svr4.patch
deleted file mode 100644
index f0f8a4392a..0000000000
--- a/sys-devel/binutils-config/files/binutils-config-4-aix-ld-svr4.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-Don't change ld behaviour by adding -brtl flag here.
-Work around ld bug with -bsvr4 -bnoentry -bE:file args.
---- ld/aixplugin.c.orig	2015-02-10 17:28:17 +0100
-+++ ld/aixplugin.c	2015-02-10 17:33:55 +0100
-@@ -32,7 +32,7 @@
- 	String const *argString;
- 	String *newString = NULL;
- 	char libpath2runpath = 1; /* whether to record -L as runpath */
--	char svr4mode = 0; /* whether we are in -bsvr4 mode */
-+	String const *svr4modeArg = NULL; /* whether we are in -bsvr4 mode */
- 	char const *argBuffer;
- 	int argBufferLength;
- 
-@@ -53,20 +53,22 @@
- 		 || StringListAppendConcat(aixRunpathList, "/lib", strlen("/lib"), NULL) < 0
- 		) break;
- 
--		/* always use runtime linking (-brtl) */
--		if (StringListAppendConcat(data->out->argList, "-brtl", strlen("-brtl"), NULL) < 0)
--			break;
--
- 		/* detect if we are in svr4 mode (-bsvr4).
- 		 * "-R runpath" is only accepted in svr4 mode,
- 		 * but we add "-R runpath" as extension in normal mode to add default runpath.
-+		 * Also, AIX ld has this problem:
-+		 *   $ /usr/ccs/bin/ld -bsvr4 -bE:xx.exp -bnoentry xx.o
-+		 *   ld: 0706-005 Cannot find or open file: l
-+		 *       ld:open(): No such file or directory
-+		 * Simplest workaround is to put -bsvr4 last.
- 		 */
- 		for(argc = 1; argc < StringListGetSize(data->in->argList); argc++) {
- 			argString = StringListGetString(data->in->argList, argc);
- 			argBuffer = StringGetBuffer(argString);
- 			if (strcmp(argBuffer, "-bsvr4") == 0) {
--				svr4mode = 1;
-+				svr4modeArg = argString;
- 				libpath2runpath = 0;
-+				break;
- 			}
- 		}
- 
-@@ -80,7 +82,7 @@
- 				libpath2runpath = 0;
- 				/* This also removes each runpath specified before. */
- 				StringListClear(runpathList);
--				if (svr4mode) {
-+				if (svr4modeArg) {
- 					StringListClear(defaultRunpathList);
- 				} /* else we accept -R as extension */
- 				continue;
-@@ -96,7 +98,7 @@
- 				/* '-blibpath:' kills previous '-blibpath:' */
- 				StringListClear(runpathList);
- 
--				if (svr4mode) {
-+				if (svr4modeArg) {
- 					/* it also kills previous '-Rrunpathlist' in svr4mode */
- 					StringListClear(defaultRunpathList);
- 				} /* else we accept -R as extension */
-@@ -125,7 +127,7 @@
- 				continue;
- 			} else
- 			if (strncmp(argBuffer, "-R", strlen("-R")) == 0) {
--				if (svr4mode) {
-+				if (svr4modeArg) {
- 					/* in svr4 mode, '-R' kills previous '-blibpath:' arguments.
- 					 * in normal mode, we implement '-R runpath' as an extension.
- 					 */
-@@ -150,6 +152,10 @@
- 					break;
- 
- 				continue;
-+			} else
-+			if (strcmp(argBuffer, "-bsvr4") == 0) {
-+				/* add -bsvr4 last */
-+				continue;
- 			}
- 
- 			/* keep other arguments */
-@@ -193,6 +199,9 @@
- 		if (StringListAppendListModify(data->out->argList, data->in->sysLibpath, 0, -1, "-L", 2, NULL, 0) < 0)
- 			break;
- 
-+		if (svr4modeArg && StringListAppendString(data->out->argList, svr4modeArg) < 0)
-+			break;
-+
- 		err = 0;
- 	} while(0);	/* end dummy loop */
- 

diff --git a/sys-devel/binutils-config/files/binutils-config-4-ldwrapper.patch b/sys-devel/binutils-config/files/binutils-config-4-ldwrapper.patch
deleted file mode 100644
index 98dd729d28..0000000000
--- a/sys-devel/binutils-config/files/binutils-config-4-ldwrapper.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff --git a/binutils-config b/binutils-config
-index 7454527..570a6b0 100755
---- a/binutils-config
-+++ b/binutils-config
-@@ -121,7 +121,26 @@ switch_profile() {
- 	cd "${ROOT}/${BINPATH}" || exit 1
- 	mkdir -p "${ROOT}/${BINPATH_LINKS}" "${EROOT}/usr/bin"
- 	for x in * ; do
--		atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
-+		case ${x} in
-+			ld|ld64)
-+				# recompile the wrapper for the desired target
-+				# not a huge fan of it, never have been
-+				"@GENTOO_PORTAGE_EPREFIX@"/usr/lib/misc/binutils-config/create-ldwrapper \
-+					--wrapper-name="${x}" \
-+					--wrapper-source="${EROOT}usr/lib/misc/binutils-config" \
-+					--output-file="${ROOT}/${BINPATH_LINKS}/${x}" \
-+					--host="${HOST}" \
-+					--target="${TARGET}" \
-+					--binpath="${BINPATH#${EPREFIX}}" \
-+					--debug="${DEBUG}" \
-+				|| return 1
-+				touch -r "${ROOT}/${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}/${x}"
-+			;;
-+			*)
-+				atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
-+			;;
-+		esac
-+		
- 		atomic_ln "${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin" "${TARGET}-${x}"
- 		if [[ ${TARGET} == ${HOST} ]] ; then
- 			atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}"

diff --git a/sys-devel/binutils-config/files/binutils-config-4-no-macosx-version-min.patch b/sys-devel/binutils-config/files/binutils-config-4-no-macosx-version-min.patch
deleted file mode 100644
index bde2dbf265..0000000000
--- a/sys-devel/binutils-config/files/binutils-config-4-no-macosx-version-min.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-https://bugs.gentoo.org/show_bug.cgi?id=537684
-Patch by Michael Weiser
-
-Stripped down to c-file part only to avoid autoreconf triggering.
-
---- ./toolchain-prefix-wrapper-0.3.1723/ld/darwinplugin.c.orig	2015-01-24 21:23:44.000000000 +0100
-+++ ./toolchain-prefix-wrapper-0.3.1723/ld/darwinplugin.c	2015-01-24 21:24:04.000000000 +0100
-@@ -22,8 +22,6 @@
- 		err = -1;
- 
- 		if (StringListAppendConcat(data->out->argList, "-search_paths_first", 19, NULL) < 0) break;
--		if (StringListAppendConcat(data->out->argList, "-macosx_version_min", 19, NULL) < 0) break;
--		if (StringListAppendConcat(data->out->argList, MIN_OSX_TARGET, sizeof(MIN_OSX_TARGET), NULL) < 0) break;
- 
- 
- 		/* keep argv[1] ... argv[n] */

diff --git a/sys-devel/binutils-config/metadata.xml b/sys-devel/binutils-config/metadata.xml
index 9b879b280b..b1f742a890 100644
--- a/sys-devel/binutils-config/metadata.xml
+++ b/sys-devel/binutils-config/metadata.xml
@@ -2,10 +2,11 @@
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
 <maintainer type="project">
+	<email>prefix@gentoo.org</email>
+	<name>Gentoo Prefix Project</name>
+</maintainer>
+<maintainer type="project">
 	<email>toolchain@gentoo.org</email>
 	<name>Gentoo Toolchain Project</name>
 </maintainer>
-  <use>
-	<flag name="sunld">Use Solaris linker instead of GNU binutils on Solaris</flag>
-  </use>
 </pkgmetadata>


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/, sys-devel/binutils-config/
@ 2018-04-07 19:43 Fabian Groffen
  0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2018-04-07 19:43 UTC (permalink / raw
  To: gentoo-commits

commit:     e3db9ab7035d02c9e902615b8745b86cd2360638
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  7 19:43:06 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Apr  7 19:43:06 2018 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=e3db9ab7

sys-devel/binutils-config: stop breaking our gcc installs

Package-Manager: Portage-2.3.18-prefix, Repoman-2.3.6

 sys-devel/binutils-config/Manifest                 |  2 -
 .../binutils-config/binutils-config-5-r03.1.ebuild | 78 ----------------------
 ...r03.2.ebuild => binutils-config-5-r03.5.ebuild} |  9 +--
 sys-devel/binutils-config/files/binutils-config-5  |  7 +-
 4 files changed, 10 insertions(+), 86 deletions(-)

diff --git a/sys-devel/binutils-config/Manifest b/sys-devel/binutils-config/Manifest
index 290abb8cfc..a28d45bba6 100644
--- a/sys-devel/binutils-config/Manifest
+++ b/sys-devel/binutils-config/Manifest
@@ -1,3 +1 @@
-DIST binutils-config-ldwrapper-5.3.1.c 8342 BLAKE2B 18658a8188acfcd7494981bd60f53590f5610c7ffd9173f223da740c09acd9ed40aaf911faa6f9a517e5e8779cbaaea9d4398679b7a3037655a7994d9c319345 SHA512 af21c1b9bb465990e8490641023403ec27e31bd69f94fc86572392285a540ddc25d59fd8f682c0cb2d2a84c5e33fea08bd0ec2cb52861147075ccfd5e18067b0
-DIST binutils-config-ldwrapper-5.3.2.c 11791 BLAKE2B 7284c1f201b581b87a3dccfd9c572e0e03fa81af1c72fcd4edce15c53c04329316aa20a1135f7b728e35b3551ebb418eacc599da6a4803924dfddf7fbccaf1be SHA512 5e0917d50ba1cb0daee71bdd225809579bfc0a129c7bed234346f17a21aec6a0cddde35d5bc598924e840c45d6f9e738fd09f969904ca5df6041d38e5e0f0c2e
 DIST binutils-config-ldwrapper-5.3.4.c 13467 BLAKE2B 132c497c59c1315c4d9e85c842fa5636aac5d96aa2db69e1f677c31cd8a509653589c178058285c4e2e72d5095734f6849969f9ff99edfe1794c69733b60047c SHA512 cd4f33e37b2cd9e66d2e80aec28bec56e3d5383f15018b20c1afccd00e74d5f8ac2c6c2d8dde0de4be36aeec1237e2cc9b07326bceb24b2ca819e54c65ae6478

diff --git a/sys-devel/binutils-config/binutils-config-5-r03.1.ebuild b/sys-devel/binutils-config/binutils-config-5-r03.1.ebuild
deleted file mode 100644
index c42663d6d1..0000000000
--- a/sys-devel/binutils-config/binutils-config-5-r03.1.ebuild
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit eutils prefix
-
-DESCRIPTION="Utility to change the binutils version being used"
-HOMEPAGE="https://www.gentoo.org/"
-GIT_REV="d469b099b5e8aed45ff2edf78f91822b805440d3"
-WRAPPER_REV="${PV}.3.1"
-SRC_URI="https://gitweb.gentoo.org/repo/proj/prefix.git/plain/sys-devel/binutils-config/files/ldwrapper.c?id=${GIT_REV} -> ${PN}-ldwrapper-${WRAPPER_REV}.c"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE=""
-
-# We also RDEPEND on sys-apps/findutils which is in base @system
-RDEPEND="sys-apps/gentoo-functions
-	!<app-admin/eselect-1.4.5"
-
-S=${WORKDIR}
-
-# NOTE: the ld wrapper is only enabled on rpath versions of prefix.
-src_prepare() {
-	cp "${FILESDIR}"/${PN}-${PV} ./${PN} || die
-	if use prefix-guest; then
-		epatch "${FILESDIR}/${PN}-5-ldwrapper.patch"
-	fi
-	eprefixify ${PN}
-}
-
-src_configure() {
-	:
-}
-
-src_compile() {
-	use prefix-guest || return
-	local args=(
-		$(tc-getCC)
-		${CPPFLAGS}
-		${CFLAGS}
-		-o ldwrapper "${DISTDIR}"/${PN}-ldwrapper-${WRAPPER_REV}.c
-		-DEPREFIX=\"${EPREFIX}\"
-		-DCHOST=\"${CHOST}\"
-		$([[ ${CHOST} == *-darwin* ]] && echo -DTARGET_DARWIN)
-		$([[ ${CHOST} == *-aix* ]] && echo -DTARGET_AIX)
-		${LDFLAGS}
-	)
-	echo ${args[*]}
-	"${args[@]}" || die
-}
-
-src_install() {
-	dobin ${PN}
-	use prefix && eprefixify "${ED}"/usr/bin/${PN}
-	sed -i "s:@PV@:${PVR}:g" "${ED}"/usr/bin/${PN} || die
-	doman "${FILESDIR}"/${PN}.8
-
-	dodir /usr/$(get_libdir)/misc/binutils-config
-	mv "${S}"/ldwrapper "${ED}"/usr/$(get_libdir)/misc/binutils-config/
-
-	insinto /usr/share/eselect/modules
-	doins "${FILESDIR}"/binutils.eselect
-}
-
-pkg_preinst() {
-	# Force a refresh when upgrading from an older version that symlinked
-	# in all the libs & includes that binutils-libs handles. #528088
-	if has_version "<${CATEGORY}/${PN}-5" ; then
-		local bc current
-		bc="${ED}/usr/bin/binutils-config"
-		if current=$("${bc}" -c) ; then
-			"${bc}" "${current}"
-		fi
-	fi
-}

diff --git a/sys-devel/binutils-config/binutils-config-5-r03.2.ebuild b/sys-devel/binutils-config/binutils-config-5-r03.5.ebuild
similarity index 93%
rename from sys-devel/binutils-config/binutils-config-5-r03.2.ebuild
rename to sys-devel/binutils-config/binutils-config-5-r03.5.ebuild
index f6ea065833..a00860e6b2 100644
--- a/sys-devel/binutils-config/binutils-config-5-r03.2.ebuild
+++ b/sys-devel/binutils-config/binutils-config-5-r03.5.ebuild
@@ -1,14 +1,14 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI="5"
+EAPI="6"
 
 inherit eutils prefix
 
 DESCRIPTION="Utility to change the binutils version being used"
 HOMEPAGE="https://www.gentoo.org/"
-GIT_REV="e30f557eb73bff37366a44ebbbf4efdc0c616c58"
-WRAPPER_REV="${PV}.3.2"
+GIT_REV="edc0d44f70c27daebcc080ac5d08e8e191bccd95"
+WRAPPER_REV="${PV}.3.4"
 SRC_URI="https://gitweb.gentoo.org/repo/proj/prefix.git/plain/sys-devel/binutils-config/files/ldwrapper.c?id=${GIT_REV} -> ${PN}-ldwrapper-${WRAPPER_REV}.c"
 
 LICENSE="GPL-2"
@@ -29,6 +29,7 @@ src_prepare() {
 		epatch "${FILESDIR}/${PN}-5-ldwrapper.patch"
 	fi
 	eprefixify ${PN}
+	eapply_user
 }
 
 src_configure() {

diff --git a/sys-devel/binutils-config/files/binutils-config-5 b/sys-devel/binutils-config/files/binutils-config-5
index e6c5fac002..46eb2b21c4 100755
--- a/sys-devel/binutils-config/files/binutils-config-5
+++ b/sys-devel/binutils-config/files/binutils-config-5
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # Format of /etc/env.d/binutils/:
@@ -159,7 +159,10 @@ switch_profile() {
 	mkdir -p "${dstlib}"
 	rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts
 	atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts"
-	find -L "${dstlib}" -xtype l -name 'lib*' -exec rm -f {} +
+	# PREFIX LOCAL: we have gcc under dstlib here, and wiping symlinks
+	# is a very bad idea there, or our symlinked sonames disappear!
+	find -L "${dstlib}"/ldscripts -xtype l -name 'lib*' -exec rm -f {} +
+	# END PREFIX LOCAL
 
 	#
 	# Clean out old generated include symlinks


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/, sys-devel/binutils-config/
@ 2019-10-13 18:12 Fabian Groffen
  0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2019-10-13 18:12 UTC (permalink / raw
  To: gentoo-commits

commit:     f1ad58d7b8db30325c5aa9bc89c130e26fbea594
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 18:11:54 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 18:11:54 2019 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f1ad58d7

sys-devel/binutils-config: experimental support for libmissing

Package-Manager: Portage-2.3.68-prefix, Repoman-2.3.17
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-devel/binutils-config/Manifest                 |  1 -
 ...5.1-r1.ebuild => binutils-config-5.1-r2.ebuild} |  5 ++-
 sys-devel/binutils-config/files/ldwrapper.c        | 51 +++++++++++++++++-----
 3 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/sys-devel/binutils-config/Manifest b/sys-devel/binutils-config/Manifest
deleted file mode 100644
index a28d45bba6..0000000000
--- a/sys-devel/binutils-config/Manifest
+++ /dev/null
@@ -1 +0,0 @@
-DIST binutils-config-ldwrapper-5.3.4.c 13467 BLAKE2B 132c497c59c1315c4d9e85c842fa5636aac5d96aa2db69e1f677c31cd8a509653589c178058285c4e2e72d5095734f6849969f9ff99edfe1794c69733b60047c SHA512 cd4f33e37b2cd9e66d2e80aec28bec56e3d5383f15018b20c1afccd00e74d5f8ac2c6c2d8dde0de4be36aeec1237e2cc9b07326bceb24b2ca819e54c65ae6478

diff --git a/sys-devel/binutils-config/binutils-config-5.1-r1.ebuild b/sys-devel/binutils-config/binutils-config-5.1-r2.ebuild
similarity index 86%
rename from sys-devel/binutils-config/binutils-config-5.1-r1.ebuild
rename to sys-devel/binutils-config/binutils-config-5.1-r2.ebuild
index 5cae4a9223..d104bf4fb7 100644
--- a/sys-devel/binutils-config/binutils-config-5.1-r1.ebuild
+++ b/sys-devel/binutils-config/binutils-config-5.1-r2.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="Utility to change the binutils version being used"
 HOMEPAGE="https://www.gentoo.org/"
 GIT_REV="edc0d44f70c27daebcc080ac5d08e8e191bccd95"
 WRAPPER_REV="${PV%%.*}.3.4"
-SRC_URI="https://gitweb.gentoo.org/repo/proj/prefix.git/plain/sys-devel/binutils-config/files/ldwrapper.c?id=${GIT_REV} -> ${PN}-ldwrapper-${WRAPPER_REV}.c"
+#SRC_URI="https://gitweb.gentoo.org/repo/proj/prefix.git/plain/sys-devel/binutils-config/files/ldwrapper.c?id=${GIT_REV} -> ${PN}-ldwrapper-${WRAPPER_REV}.c"
 
 LICENSE="GPL-2"
 SLOT="0"
@@ -25,6 +25,7 @@ S=${WORKDIR}
 # NOTE: the ld wrapper is only enabled on rpath versions of prefix.
 src_prepare() {
 	cp "${FILESDIR}"/${PN}-${PV} ./${PN} || die
+	cp "${FILESDIR}"/ldwrapper.c ./${PN}-ldwrapper-${WRAPPER_REV}.c || die
 	if use prefix-guest; then
 		epatch "${FILESDIR}/${PN}-5-ldwrapper.patch"
 	fi
@@ -42,7 +43,7 @@ src_compile() {
 		$(tc-getCC)
 		${CPPFLAGS}
 		${CFLAGS}
-		-o ldwrapper "${DISTDIR}"/${PN}-ldwrapper-${WRAPPER_REV}.c
+		-o ldwrapper ${PN}-ldwrapper-${WRAPPER_REV}.c
 		-DEPREFIX=\"${EPREFIX}\"
 		-DCHOST=\"${CHOST}\"
 		${LDFLAGS}

diff --git a/sys-devel/binutils-config/files/ldwrapper.c b/sys-devel/binutils-config/files/ldwrapper.c
index 3ff52acc60..07dc6ebf2a 100644
--- a/sys-devel/binutils-config/files/ldwrapper.c
+++ b/sys-devel/binutils-config/files/ldwrapper.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2017 Gentoo Foundation
+ * Copyright 1999-2019 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
  * Authors: Fabian Groffen <grobian@gentoo.org>
  *          Michael Haubenwallner <haubi@gentoo.org>
@@ -58,13 +58,13 @@ find_real_ld(char **ld, size_t ldlen, const char verbose, const char is_cross,
 	ldoverride = getenv("BINUTILS_CONFIG_LD");
 	if (ldoverride != NULL && *ldoverride != '\0') {
 		if (verbose)
-			fprintf(stdout, "%s: using BINUTILS_CONFIG_LD=%s "
+			fprintf(stderr, "%s: using BINUTILS_CONFIG_LD=%s "
 					"from environment\n", wrapper, ldoverride);
 		snprintf(*ld, ldlen, "%s", ldoverride);
 		return 0;
 	}
 	if (verbose)
-		fprintf(stdout, "%s: BINUTILS_CONFIG_LD not found in environment\n",
+		fprintf(stderr, "%s: BINUTILS_CONFIG_LD not found in environment\n",
 				wrapper);
 
 	/* Find ld in PATH, allowing easy PATH overrides.
@@ -94,14 +94,14 @@ find_real_ld(char **ld, size_t ldlen, const char verbose, const char is_cross,
 			/* glue it together */
 			snprintf(*ld, ldlen, "%.*s/%s", (int)(q - p), p, wrapper);
 			if (verbose)
-				fprintf(stdout, "%s: trying from PATH: %s\n",
+				fprintf(stderr, "%s: trying from PATH: %s\n",
 						wrapper, *ld);
 			if (stat(*ld, &lde) == 0)
 				return 0;
 		}
 	}
 	if (verbose)
-		fprintf(stdout, "%s: linker not found in PATH\n", wrapper);
+		fprintf(stderr, "%s: linker not found in PATH\n", wrapper);
 
 	/* parse EPREFIX/etc/env.d/binutils/config-CTARGET to get CURRENT, then
 	 * consider $EPREFIX/usr/CTARGET/binutils-bin/CURRENT where we should
@@ -123,7 +123,7 @@ find_real_ld(char **ld, size_t ldlen, const char verbose, const char is_cross,
 
 			q = p + len;
 			if (verbose)
-				fprintf(stdout, "%s: %s defines CURRENT=%s\n",
+				fprintf(stderr, "%s: %s defines CURRENT=%s\n",
 						wrapper, config, q);
 			if (is_cross) {
 				snprintf(*ld, ldlen,
@@ -138,13 +138,13 @@ find_real_ld(char **ld, size_t ldlen, const char verbose, const char is_cross,
 		}
 		fclose(f);
 		if (verbose)
-			fprintf(stdout, "%s: trying from %s: %s\n",
+			fprintf(stderr, "%s: trying from %s: %s\n",
 					wrapper, config, *ld);
 		if (stat(*ld, &lde) == 0)
 			return 0;
 	}
 	if (verbose)
-		fprintf(stdout, "%s: linker not found via %s\n", wrapper, config);
+		fprintf(stderr, "%s: linker not found via %s\n", wrapper, config);
 
 	/* last try, shell out to binutils-config to tell us what the linker
 	 * is supposed to be */
@@ -178,7 +178,7 @@ find_real_ld(char **ld, size_t ldlen, const char verbose, const char is_cross,
 				}
 
 				if (verbose)
-					fprintf(stdout, "%s: trying from %s: %s\n",
+					fprintf(stderr, "%s: trying from %s: %s\n",
 							wrapper, config, *ld);
 				if (stat(*ld, &lde) == 0)
 					return 0;
@@ -186,7 +186,7 @@ find_real_ld(char **ld, size_t ldlen, const char verbose, const char is_cross,
 		}
 	}
 	if (verbose)
-		fprintf(stdout, "%s: linker not found via %s\n",
+		fprintf(stderr, "%s: linker not found via %s\n",
 				wrapper, config);
 
 	/* we didn't succeed finding the linker */
@@ -210,6 +210,7 @@ main(int argc, char *argv[])
 	char is_darwin = 0;
 	char darwin_use_rpath = 1;
 	char is_aix = 0;
+	char has_missing = getenv("BINUTILS_CONFIG_DISABLE_MISSING") == NULL;
 	char *p;
 	size_t len;
 	int i;
@@ -308,6 +309,8 @@ main(int argc, char *argv[])
 	 * non-cross-compilable on any platform, prefix or no prefix. So no
 	 * need to add PREFIX- or CTARGET-aware libdirs. */
 	if (!is_cross) {
+		struct stat st;
+
 		if (is_darwin) {
 			/* check deployment target if nothing prevents us from
 			 * using -rpath as of yet
@@ -346,6 +349,14 @@ main(int argc, char *argv[])
 			/* AIX ld accepts -R only with -bsvr4 */
 			newargc++; /* -bsvr4 */
 		}
+
+		/* BINUTILS_CONFIG_DISABLE_MISSING overrides this such that we
+		 * can disable this behaviour */
+		if (has_missing && stat(EPREFIX "/usr/lib/libmissing.a", &st) == 0) {
+			newargc++; /* -lmissing */
+		} else {
+			has_missing = 0;
+		}
 	}
 
 	/* account the original arguments */
@@ -397,6 +408,20 @@ main(int argc, char *argv[])
 			}
 		}
 
+		if (!is_cross && is_darwin && has_missing) {
+			if (argv[i][0] == '-' && argv[i][1] == 'l' &&
+					(strcmp(&argv[i][2], "System") == 0 ||
+					 strcmp(&argv[i][2], "SystemStubs") == 0))
+			{
+				/* inject -lmissing before -lSystem or -lSystemStubs */
+				memmove(&newargv[j + 1], &newargv[j],
+						sizeof(newargv[j]) * (k - j));
+				newargv[j++] = "-lmissing";
+				k++;
+				has_missing = 0;  /* avoid duplicate insertion */
+			}
+		}
+
 		newargv[j] = argv[i];
 
 		if (is_cross || (is_darwin && !darwin_use_rpath))
@@ -473,15 +498,17 @@ main(int argc, char *argv[])
 			newargv[k++] = "-R" EPREFIX "/lib";
 		}
 
+		if (has_missing)
+			newargv[k++] = "-lmissing";
 		if (is_aix)
 			newargv[k++] = "-bsvr4"; /* last one, see above */
 	}
 	newargv[k] = NULL;
 
 	if (verbose) {
-		fprintf(stdout, "%s: invoking %s with arguments:\n", wrapper, ld);
+		fprintf(stderr, "%s: invoking %s with arguments:\n", wrapper, ld);
 		for (j = 0; newargv[j] != NULL; j++)
-			fprintf(stdout, "  %s\n", newargv[j]);
+			fprintf(stderr, "  %s\n", newargv[j]);
 	}
 
 	/* finally, execute the real ld */


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/, sys-devel/binutils-config/
@ 2020-11-27 13:39 Fabian Groffen
  0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2020-11-27 13:39 UTC (permalink / raw
  To: gentoo-commits

commit:     4b52e188057a6b59d3e48983f351bf44ae080081
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 27 13:29:28 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Nov 27 13:38:59 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=4b52e188

sys-devel/binutils-config-5.1-r3: revbump for libsysroot support

Big Sur (11.0) needs libsysroot support from the linker, so allow
activating it.

Package-Manager: Portage-3.0.8-prefix, Repoman-3.0.2
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 ...-config-5.1-r2.ebuild => binutils-config-5.1-r3.ebuild} | 10 +++++++++-
 sys-devel/binutils-config/files/ldwrapper.c                | 14 ++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/sys-devel/binutils-config/binutils-config-5.1-r2.ebuild b/sys-devel/binutils-config/binutils-config-5.1-r3.ebuild
similarity index 84%
rename from sys-devel/binutils-config/binutils-config-5.1-r2.ebuild
rename to sys-devel/binutils-config/binutils-config-5.1-r3.ebuild
index d104bf4fb7..fd26184271 100644
--- a/sys-devel/binutils-config/binutils-config-5.1-r2.ebuild
+++ b/sys-devel/binutils-config/binutils-config-5.1-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -39,6 +39,13 @@ src_configure() {
 
 src_compile() {
 	use prefix-guest || return
+	local extraargs=( )
+	if [[ ${CHOST} == *-darwin* && ${CHOST##*-darwin} -ge 20 ]] ; then
+		# macOS Big Sur has an empty /usr/lib, so the linker really has
+		# to look into the SDK, for which it needs to be told where it
+		# is (symlinked right into our EPREFIX root as MacOSX.sdk)
+		extraargs+=( -DDARWIN_LD_SYSLIBROOT=1 )
+	fi
 	local args=(
 		$(tc-getCC)
 		${CPPFLAGS}
@@ -46,6 +53,7 @@ src_compile() {
 		-o ldwrapper ${PN}-ldwrapper-${WRAPPER_REV}.c
 		-DEPREFIX=\"${EPREFIX}\"
 		-DCHOST=\"${CHOST}\"
+		"${extraargs[@]}"
 		${LDFLAGS}
 	)
 	echo ${args[*]}

diff --git a/sys-devel/binutils-config/files/ldwrapper.c b/sys-devel/binutils-config/files/ldwrapper.c
index 216747da5c..75575f31f6 100644
--- a/sys-devel/binutils-config/files/ldwrapper.c
+++ b/sys-devel/binutils-config/files/ldwrapper.c
@@ -20,8 +20,9 @@
  * ldwrapper: Prefix helper to inject -L and -R flags to the invocation
  * of ld.
  *
- * On Darwin it adds -search_path_first to make sure the given paths are
- * searched before the default search path.
+ * On Darwin it adds -search_paths_first to make sure the given paths are
+ * searched before the default search path, and sets -syslibroot
+ * starting from Big Sur 11.0.
  * On AIX it ensures -bsvr4 is the last argument.
  * The wrapper will inject -L entries for:
  *   - EPREFIX/usr/CHOST/lib/gcc (when gcc)
@@ -339,6 +340,11 @@ main(int argc, char *argv[])
 
 			/* add the 2 prefix paths (-L) and -search_paths_first */
 			newargc += 2 + 1;
+
+#ifdef DARWIN_LD_SYSLIBROOT
+			/* add -syslibroot <path> */
+			newargc += 2;
+#endif
 		} else {
 			/* add the 4 paths we want (-L + -R) */
 			newargc += 8;
@@ -380,6 +386,10 @@ main(int argc, char *argv[])
 
 	if (!is_cross && is_darwin) {
 		/* inject this first to make the intention clear */
+#ifdef DARWIN_LD_SYSLIBROOT
+		newargv[j++] = "-syslibroot";
+		newargv[j++] = EPREFIX "/MacOSX.sdk"
+#endif
 		newargv[j++] = "-search_paths_first";
 	}
 


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/, sys-devel/binutils-config/
@ 2020-12-22 21:30 Fabian Groffen
  0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2020-12-22 21:30 UTC (permalink / raw
  To: gentoo-commits

commit:     48b366594ab49dd0be7a6807561f31e82d0d82d0
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 22 21:17:02 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Dec 22 21:17:02 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=48b36659

sys-devel/binutils-config: drop ~ppc-aix

Bug: https://bugs.gentoo.org/760057
Package-Manager: Portage-3.0.12-prefix, Repoman-3.0.2
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 .../binutils-config/binutils-config-5.1-r3.ebuild  |  2 +-
 sys-devel/binutils-config/files/ldwrapper.c        | 23 ----------------------
 2 files changed, 1 insertion(+), 24 deletions(-)

diff --git a/sys-devel/binutils-config/binutils-config-5.1-r3.ebuild b/sys-devel/binutils-config/binutils-config-5.1-r3.ebuild
index fd26184271..dc28f6c5a4 100644
--- a/sys-devel/binutils-config/binutils-config-5.1-r3.ebuild
+++ b/sys-devel/binutils-config/binutils-config-5.1-r3.ebuild
@@ -13,7 +13,7 @@ WRAPPER_REV="${PV%%.*}.3.4"
 
 LICENSE="GPL-2"
 SLOT="0"
-KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
 IUSE=""
 
 # We also RDEPEND on sys-apps/findutils which is in base @system

diff --git a/sys-devel/binutils-config/files/ldwrapper.c b/sys-devel/binutils-config/files/ldwrapper.c
index 3ff5a0bc3e..7410afd334 100644
--- a/sys-devel/binutils-config/files/ldwrapper.c
+++ b/sys-devel/binutils-config/files/ldwrapper.c
@@ -210,7 +210,6 @@ main(int argc, char *argv[])
 	char is_cross = 0;
 	char is_darwin = 0;
 	char darwin_use_rpath = 1;
-	char is_aix = 0;
 	char *p;
 	size_t len;
 	int i;
@@ -269,7 +268,6 @@ main(int argc, char *argv[])
 		snprintf(ctarget, sizeof(ctarget), "%s", CHOST);
 
 	is_darwin = strstr(ctarget, "-darwin") != NULL;
-	is_aix = strstr(ctarget, "-aix") != NULL;
 
 	/* cannonicanise wrapper step2: strip CTARGET from wrapper */
 	len = strlen(ctarget);
@@ -349,11 +347,6 @@ main(int argc, char *argv[])
 			/* add the 4 paths we want (-L + -R) */
 			newargc += 8;
 		}
-
-		if (is_aix) {
-			/* AIX ld accepts -R only with -bsvr4 */
-			newargc++; /* -bsvr4 */
-		}
 	}
 
 	/* account the original arguments */
@@ -396,19 +389,6 @@ main(int argc, char *argv[])
 	/* position k right after the original arguments */
 	k = j - 1 + argc;
 	for (i = 1; i < argc; i++, j++) {
-		if (is_aix) {
-			/* AIX ld has this problem:
-			 *   $ /usr/ccs/bin/ld -bsvr4 -bE:xx.exp -bnoentry xx.o
-			 *   ld: 0706-005 Cannot find or open file: l
-			 *       ld:open(): No such file or directory
-			 * Simplest workaround is to put -bsvr4 last.
-			 */
-			if (strcmp(argv[i], "-bsvr4") == 0) {
-				--j; --k;
-				continue;
-			}
-		}
-
 		newargv[j] = argv[i];
 
 		if (is_cross || (is_darwin && !darwin_use_rpath))
@@ -484,9 +464,6 @@ main(int argc, char *argv[])
 			newargv[k++] = "-L" EPREFIX "/lib";
 			newargv[k++] = "-R" EPREFIX "/lib";
 		}
-
-		if (is_aix)
-			newargv[k++] = "-bsvr4"; /* last one, see above */
 	}
 	newargv[k] = NULL;
 


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/, sys-devel/binutils-config/
@ 2024-01-21  9:46 Fabian Groffen
  0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2024-01-21  9:46 UTC (permalink / raw
  To: gentoo-commits

commit:     70384d5c6846998d8cb6bcc2ddfcf0830c13c6fa
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 09:45:17 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 09:45:17 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=70384d5c

sys-devel/binutils-config: more macOS linker tweaks

This time tested with native linkers on platforms which are seen during
stage2 bootstraps:

Darwin 23 with dyld-1022.1
Darwin 17 with ld64-409.12
Darwin  9 with ld64-85.2.1

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 ...5.1-r8.ebuild => binutils-config-5.1-r9.ebuild} |  0
 sys-devel/binutils-config/files/ldwrapper.c        | 27 +++++++++++++++++-----
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/sys-devel/binutils-config/binutils-config-5.1-r8.ebuild b/sys-devel/binutils-config/binutils-config-5.1-r9.ebuild
similarity index 100%
rename from sys-devel/binutils-config/binutils-config-5.1-r8.ebuild
rename to sys-devel/binutils-config/binutils-config-5.1-r9.ebuild

diff --git a/sys-devel/binutils-config/files/ldwrapper.c b/sys-devel/binutils-config/files/ldwrapper.c
index c9fe7e4bb3..00d4a69f73 100644
--- a/sys-devel/binutils-config/files/ldwrapper.c
+++ b/sys-devel/binutils-config/files/ldwrapper.c
@@ -392,18 +392,28 @@ main(int argc, char *argv[])
 
 		/* call the linker to figure out what options we can use :(
 		 * some Developer Tools ld64 versions:
-		 * 12.0:   609      Big Sur, requirement for sdk_version
+		 * Xcode   ld64   dyld
+		 * 3.1.1:  85.2.1        Leopard 10.5, sdk_version unknown,
+		 *                                     need macosx_version_min
+		 * 8.2.1:  274.2         xtools-2.2.4, sdk_version plus
+		 *                                     macosx_version_min
+		 * 10.0:   409.12        High Sierra 10.13 like above
+		 * 12.0:   609           Big Sur 11, sdk_version only
 		 * 13.0:   711
 		 * 13.3.1: 762
 		 * 14.0:   819.6
 		 * 14.2:   820.1
 		 * 14.3.1: 857.1
-		 * 15.0:   907      Sanoma, platform_version argument
-		 * all to be found from the PROJECT:ld64-650.9 bit from 1st line
+		 * 15.0:   907   1022.1  Sanoma 23, platform_version iso sdk_version
+		 * all to be found from the PROJECT:ld64-650.9 or
+		 * PROJECT:dyld-1022.1 bit from the first line
 		 * NOTE: e.g. my Sanoma mac with CommandLineTools has 650.9
 		 *       which is not a version from any Developer Tools ?!?
 		 * Currently we need to distinguish XCode 15 according to
 		 * bug #910277, so we look for 907 and old targets before 12 */
+#define LD64_3_1    8500
+#define LD64_8_2   27400
+#define LD64_10_0  40900
 #define LD64_12_0  60900
 #define LD64_15_0  90700
 		snprintf(target, sizeof(target), "%s -v 2>&1", ld);
@@ -412,8 +422,11 @@ main(int argc, char *argv[])
 			char *proj;
 			long  comp;
 			if (fgets(target, sizeof(target), ld64out) != 0 &&
-				(proj = strstr(target, "PROJECT:ld64-")) != NULL)
+				((proj = strstr(target, "PROJECT:ld64-")) != NULL ||
+				 (proj = strstr(target, "PROJECT:dyld-")) != NULL))
 			{
+				/* we don't distinguish between ld64 and dyld here, for
+				 * now it seems the numbers line up for our logic */
 				proj += sizeof("PROJECT:ld64-") - 1;
 				comp  = strtol(proj, &proj, 10);
 				/* we currently have no need to parse fractions, the
@@ -446,10 +459,12 @@ main(int argc, char *argv[])
 			newargv[j++] = "macos";
 			newargv[j++] = darwin_dt;
 			newargv[j++] = "0.0";
-		} else if (ld64ver >= LD64_12_0) {
+		} else if (ld64ver >= LD64_8_2) {
 			newargv[j++] = "-sdk_version";
 			newargv[j++] = darwin_dt;
-		} else {
+		}
+
+		if (ld64ver < LD64_12_0) {
 			newargv[j++] = "-macosx_version_min";
 			newargv[j++] = darwin_dt;
 		}


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/, sys-devel/binutils-config/
@ 2024-04-06 14:36 Fabian Groffen
  0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2024-04-06 14:36 UTC (permalink / raw
  To: gentoo-commits

commit:     1e8c1aa5752b38209bb521578377cd2025773e62
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  6 14:34:38 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Apr  6 14:34:38 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=1e8c1aa5

sys-devel/binutils-config: fix -rpath and -L <arg> handling

A thinko broke skipping of arguments consisting of two entries,
resulting in very weird command lines.  Not noticed on Darwin because
for some odd reason.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 ...1-r11.ebuild => binutils-config-5.1-r12.ebuild} |  0
 sys-devel/binutils-config/files/ldwrapper.c        | 22 +++++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/sys-devel/binutils-config/binutils-config-5.1-r11.ebuild b/sys-devel/binutils-config/binutils-config-5.1-r12.ebuild
similarity index 100%
rename from sys-devel/binutils-config/binutils-config-5.1-r11.ebuild
rename to sys-devel/binutils-config/binutils-config-5.1-r12.ebuild

diff --git a/sys-devel/binutils-config/files/ldwrapper.c b/sys-devel/binutils-config/files/ldwrapper.c
index 22fbf9aba8..1aa96537d0 100644
--- a/sys-devel/binutils-config/files/ldwrapper.c
+++ b/sys-devel/binutils-config/files/ldwrapper.c
@@ -530,7 +530,7 @@ main(int argc, char *argv[])
 			char *path;
 			int pth;
 			char duplicate;
-			int before = j - 1;
+			int nexti = i;
 
 			/* arguments can be in many ways here:
 			 * -L<path>
@@ -541,10 +541,11 @@ main(int argc, char *argv[])
 			while (*path != '\0' && isspace(*path))
 				path++;
 			if (*path == '\0') {
+				nexti++;
 				/* no more arguments?!? skip */
-				if (i + 1 >= argc)
+				if (nexti >= argc)
 					continue;
-				path = argv[i + 1];
+				path = argv[nexti];
 				while (*path != '\0' && isspace(*path))
 					path++;
 			}
@@ -570,7 +571,8 @@ main(int argc, char *argv[])
 					}
 				}
 				if (duplicate) {
-					j = before;
+					i = nexti;
+					j--;
 					continue;
 				}
 				/* record path */
@@ -584,7 +586,8 @@ main(int argc, char *argv[])
 					}
 				}
 				if (duplicate) {
-					j = before;
+					i = nexti;
+					j--;
 					continue;
 				}
 				/* record path */
@@ -597,8 +600,12 @@ main(int argc, char *argv[])
 			char *path;
 			int pth;
 			char duplicate;
+			int nexti = i + 1;
 
-			path = argv[i + 1];
+			/* no more arguments?!? skip */
+			if (nexti >= argc)
+				continue;
+			path = argv[nexti];
 			while (*path != '\0' && isspace(*path))
 				path++;
 			/* not absolute (or empty)?!? skip */
@@ -617,7 +624,8 @@ main(int argc, char *argv[])
 				}
 			}
 			if (duplicate) {
-				j -= 2;
+				j--;
+				i = nexti;
 				continue;
 			}
 			/* record path */


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

end of thread, other threads:[~2024-04-06 14:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-07 19:43 [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/, sys-devel/binutils-config/ Fabian Groffen
  -- strict thread matches above, loose matches on Subject: below --
2024-04-06 14:36 Fabian Groffen
2024-01-21  9:46 Fabian Groffen
2020-12-22 21:30 Fabian Groffen
2020-11-27 13:39 Fabian Groffen
2019-10-13 18:12 Fabian Groffen
2017-11-25 18:33 Fabian Groffen
2016-02-14 14:56 Fabian Groffen

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