commit:     4e030d26df9349efddf8eb97d919911e593aaaa9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 21 20:19:29 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jan 21 20:29:13 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e030d26

sys-devel/binutils: add USE=pgo for 2.37_p1-r2

Added upstream in 2.37, actually, but we'd missed it! Realised after seeing
the sync commit for GCC.

Sets --enable-pgo-build=lto if USE=pgo is set.

Throws in LTO for the PGO build too given it's cleaner than
e.g. having a USE=lto which only works when USE=pgo is also set,
REQUIRED_USE, or other nonsense.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/binutils/binutils-2.37_p1-r2.ebuild | 4 +++-
 sys-devel/binutils/binutils-9999.ebuild       | 4 +++-
 sys-devel/binutils/metadata.xml               | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys-devel/binutils/binutils-2.37_p1-r2.ebuild 
b/sys-devel/binutils/binutils-2.37_p1-r2.ebuild
index cfdd2538eefe..c7c57aefb044 100644
--- a/sys-devel/binutils/binutils-2.37_p1-r2.ebuild
+++ b/sys-devel/binutils/binutils-2.37_p1-r2.ebuild
@@ -8,7 +8,7 @@ inherit libtool flag-o-matic gnuconfig strip-linguas 
toolchain-funcs
 DESCRIPTION="Tools necessary to build programs"
 HOMEPAGE="https://sourceware.org/binutils/";
 LICENSE="GPL-3+"
-IUSE="cet default-gold doc +gold multitarget +nls +plugins static-libs test 
vanilla"
+IUSE="cet default-gold doc +gold multitarget +nls pgo +plugins static-libs 
test vanilla"
 REQUIRED_USE="default-gold? ( gold )"
 
 # Variables that can be set here  (ignored for live ebuilds)
@@ -272,6 +272,8 @@ src_configure() {
                # Ideally we would like automagic-or-disabled here.
                # But the check does not quite work on i686: bug #760926.
                $(use_enable cet)
+
+               $(use_enable pgo pgo-build lto)
        )
        echo ./configure "${myconf[@]}"
        "${S}"/configure "${myconf[@]}" || die

diff --git a/sys-devel/binutils/binutils-9999.ebuild 
b/sys-devel/binutils/binutils-9999.ebuild
index 2609713b2a04..d53c8d446235 100644
--- a/sys-devel/binutils/binutils-9999.ebuild
+++ b/sys-devel/binutils/binutils-9999.ebuild
@@ -8,7 +8,7 @@ inherit libtool flag-o-matic gnuconfig strip-linguas 
toolchain-funcs
 DESCRIPTION="Tools necessary to build programs"
 HOMEPAGE="https://sourceware.org/binutils/";
 LICENSE="GPL-3+"
-IUSE="cet default-gold doc +gold multitarget +nls +plugins static-libs test 
vanilla"
+IUSE="cet default-gold doc +gold multitarget +nls pgo +plugins static-libs 
test vanilla"
 REQUIRED_USE="default-gold? ( gold )"
 
 # Variables that can be set here  (ignored for live ebuilds)
@@ -273,6 +273,8 @@ src_configure() {
                # Ideally we would like automagic-or-disabled here.
                # But the check does not quite work on i686: bug #760926.
                $(use_enable cet)
+
+               $(use_enable pgo pgo-build lto)
        )
        echo ./configure "${myconf[@]}"
        "${S}"/configure "${myconf[@]}" || die

diff --git a/sys-devel/binutils/metadata.xml b/sys-devel/binutils/metadata.xml
index 4f6990c6d6f9..e05bf0bdd552 100644
--- a/sys-devel/binutils/metadata.xml
+++ b/sys-devel/binutils/metadata.xml
@@ -9,6 +9,7 @@
                <flag name="cet">Enable Intel Control-flow Enforcement 
Technology.</flag>
                <flag name="default-gold">Set ld to point to ld.gold instead of 
ld.bfd</flag>
                <flag name="gold">Build ld.gold linker</flag>
+               <flag name="pgo">Build binutils with Profile Guided 
Optimization (PGO) and LTO</flag>
                <flag name="plugins">Enable plugin support in tools</flag>
                <flag name="multitarget">Adds support to binutils for cross 
compiling (does not work with gas)</flag>
        </use>

Reply via email to