binutils currently builds gold dependent on the cxx USE flag. However, cxx is described in use.desc as "Build support for C++". While gold is apparently written in C++ (so it needs a C++-enabled gcc to build and this may be a reason not to want to build it in some cases), gold is perfectly usable for linking things that don't have anything to do with C++. I propose to use a different local USE flag for this (just enabling it unconditionally seems fine to me, too). diff --git a/sys-devel/binutils/binutils-2.31.1.ebuild b/sys-devel/binutils/binutils-2.31.1.ebuild index d28b62827bc..5869b772957 100644 --- a/sys-devel/binutils/binutils-2.31.1.ebuild +++ b/sys-devel/binutils/binutils-2.31.1.ebuild @@ -8,7 +8,7 @@ inherit eutils libtool flag-o-matic gnuconfig multilib versionator DESCRIPTION="Tools necessary to build programs" HOMEPAGE="https://sourceware.org/binutils/" LICENSE="GPL-3+" -IUSE="+cxx doc multitarget +nls static-libs test" +IUSE="doc +gold multitarget +nls static-libs test" # Variables that can be set here: # PATCH_VER - the patchset version @@ -181,7 +181,7 @@ src_configure() { local myconf=() # enable gold (installed as ld.gold) and ld's plugin architecture - if use cxx ; then + if use gold ; then myconf+=( --enable-gold ) myconf+=( --enable-plugins ) fi diff --git a/sys-devel/binutils/metadata.xml b/sys-devel/binutils/metadata.xml index 3b4e0782a80..79aeef2584d 100644 --- a/sys-devel/binutils/metadata.xml +++ b/sys-devel/binutils/metadata.xml @@ -6,6 +6,7 @@ <name>Gentoo Toolchain Project</name> </maintainer> <use> +<flag name="gold">Build the gold linker</flag> <flag name="multitarget">Adds support to binutils for cross compiling (does not work with gas)</flag> </use> <upstream> (I'm happy to commit this in a revbump if someone can sign off on it.)
Looks ok but you will need to coordinate with dependencies as well: profiles/arch/amd64-fbsd/clang/package.use.mask:sys-devel/binutils cxx sys-devel/llvm/llvm-3.7.1-r3.ebuild: gold? ( >=sys-devel/binutils-2.22:*[cxx] ) sys-devel/llvm/llvm-3.9.1-r1.ebuild: gold? ( >=sys-devel/binutils-2.22:*[cxx] ) sys-devel/llvm/llvm-4.0.1-r1.ebuild: gold? ( >=sys-devel/binutils-2.22:*[cxx] ) sys-devel/llvm/llvm-5.0.2.ebuild: gold? ( >=sys-devel/binutils-2.22:*[cxx] ) sys-devel/llvm/llvm-6.0.1.ebuild: gold? ( >=sys-devel/binutils-2.22:*[cxx] ) sys-devel/llvm/llvm-7.0.9999.ebuild: gold? ( >=sys-devel/binutils-2.22:*[cxx] ) sys-devel/llvm/llvm-9999.ebuild: gold? ( >=sys-devel/binutils-2.22:*[cxx] )
--enable-plugins option affects both ld.bfd and ld.gold: config/plugins.m4: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=config/plugins.m4;h=c6acebc1ca4b4e0df8c7c863382e02860f29b9a6;hb=HEAD """ AC_DEFUN([AC_PLUGINS], [ ... AC_ARG_ENABLE([plugins], AS_HELP_STRING([--enable-plugins], [Enable support for plugins]), """ config/largefile.m4: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=config/largefile.m4;h=4a88fd738fd05d1e9a5cfad3394adf1374dae630;hb=HEAD """ # As the $enable_largefile decision depends on --enable-plugins we must set it # even in directories otherwise not depending on the $plugins option. AC_PLUGINS """ bfd/configure.ac: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/configure.ac;h=787ac7fa658350168dffb069f0b9fa03143d10b2;hb=HEAD """ # AC_PLUGINS setting $plugins is called by ACX_LARGEFILE. ACX_LARGEFILE AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes") if test "$plugins" = "yes"; then enable_targets="$enable_targets plugin" fi """ gold/configure.ac: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gold/configure.ac;h=d9a1869070ebecd6b365724f24d32bbb67485f56;hb=HEAD """ AC_PLUGINS if test "$plugins" = "yes"; then AC_DEFINE(ENABLE_PLUGINS, 1, [Define to enable linker plugins]) fi AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes") """ I suggest that passing of --enable-plugins option be controlled by a separate "plugins" USE flag (enabled by default) or unconditionally.
The same changes should be made in sys-devel/binutils-hppa64.
So what's the recommended way to move this forward? Just a revbump for binutils on latest unstable and then revbumps on its reverse deps to that have that revbump as a lower bound with the new USE flag? Renaming all the old USE flags seems like a drag, but if people prefer that I can do it. It seems to make sense to spin cxx out into separate gold and plugins USE flags.
Simple revbump is ok for toolchain ebuilds (binutils, binutils-hppa64)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2daa70b566d006aa2cfba6e20842b7287766f5e5 commit 2daa70b566d006aa2cfba6e20842b7287766f5e5 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2019-02-12 23:31:18 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2019-02-12 23:31:18 +0000 sys-devel/binutils: split USE="cxx" into USE="gold plugins" Reported-by: Dirkjan Ochtman Bug: https://bugs.gentoo.org/663776 Package-Manager: Portage-2.3.60, Repoman-2.3.12 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/binutils/binutils-2.31.1-r4.ebuild | 432 +++++++++++++++++++++++++++ sys-devel/binutils/binutils-9999.ebuild | 9 +- sys-devel/binutils/metadata.xml | 2 + 3 files changed, 440 insertions(+), 3 deletions(-)
>=binutils-2.31.1-r4 will use USE="gold plugins" instead of USE="cxx". We''l backfill it into binutils-hppa64 at some point later.
this change breaks sys-devel/llvm ebuild, see https://bugs.gentoo.org/677888
(In reply to Johannes Hirte from comment #8) > this change breaks sys-devel/llvm ebuild, see https://bugs.gentoo.org/677888 Thanks for filing the bug! It does not break though. It should just prevent binutils from upgrading, which is a safe (but a bit annoying) state. Breakage would be llvm build failure or runtime failure. If that is thre case please clarify it in original bug report.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39d937a0feb6af576c2c751e44afce92452960d7 commit 39d937a0feb6af576c2c751e44afce92452960d7 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2019-02-14 22:17:29 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2019-02-14 22:17:29 +0000 sys-devel/binutils: temporary restore transitional IUSE=+cxx flag Temporary restore IUSE=+cxx to help llvm. IUSE=+cxx will still go away soon. Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/677888 Bug: https://bugs.gentoo.org/663776 Package-Manager: Portage-2.3.60, Repoman-2.3.12 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/binutils/binutils-2.31.1-r4.ebuild | 6 ++++-- sys-devel/binutils/binutils-9999.ebuild | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f709b636e948552d72c4a94cd632bfa30f97e3a commit 9f709b636e948552d72c4a94cd632bfa30f97e3a Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2019-02-28 20:16:58 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2019-02-28 20:33:57 +0000 profiles/base/make.defaults: drop IUSE=cxx from BOOTSTRAP_USE IUSE=cxx was removed from binutils in bug #663776 in favour of IUSE="gold plugins." USE=cxx is a no-op for non-cross gcc. And binutils's gold and plugin support should not be needed to bootstrap a toolchain. Reported-by: Alexis Lahouze Tested-by: Alexis Lahouze Reviewed-by: Jorge Manuel B. S. Vicetto Bug: https://bugs.gentoo.org/663776 Closes: https://bugs.gentoo.org/678766#c8 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> profiles/base/make.defaults | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=48f035ccb412623089cb32fa503f783a9c232a2b commit 48f035ccb412623089cb32fa503f783a9c232a2b Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2019-05-16 22:41:37 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2019-05-16 22:41:52 +0000 sys-devel/binutils: drop USE="cxx" for USE="gold plugins" Change live ebuild only to pick it for next binutils release. Reported-by: Dirkjan Ochtman Bug: https://bugs.gentoo.org/663776 Package-Manager: Portage-2.3.66, Repoman-2.3.12 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/binutils/binutils-9999.ebuild | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)