sys-devel/gcc: add a USE for building GCC with PGO
authorShane Peelar <lookatyouhacker@gmail.com>
Wed, 20 Sep 2017 15:59:20 +0000 (11:59 -0400)
committerSergei Trofimovich <slyfox@gentoo.org>
Sun, 24 Sep 2017 18:06:15 +0000 (19:06 +0100)
Package-Manager: Portage-2.3.10, Repoman-2.3.3
Closes: https://github.com/gentoo/gentoo/pull/5741

dev-lang/gnat-gpl/metadata.xml
eclass/toolchain.eclass
sys-devel/gcc/metadata.xml

index 93f13769808b0adbc6a626d546e37c502c26f1ba..5018efb098acae10442900e6faa3b0a5579f6229 100644 (file)
@@ -26,6 +26,7 @@
                <flag name="objc++">Build support for the Objective C++ language</flag>
                <flag name="objc-gc">Build support for the Objective C code language
                        Garbage Collector</flag>
+               <flag name="pgo">Build GCC using Profile Guided Optimization (PGO)</flag>
                <flag name="regression-test">Run the testsuite and install the results
                        (requires FEATURES=test)</flag>
                <flag name="sanitize">Build support for various sanitizer functions (ASAN/TSAN/etc...)</flag>
index baffa39bda9b4791372c6c8882b07f07da3b43c2..a18e8042641c91908b46eb32f28a6dd1d023339c 100644 (file)
@@ -139,6 +139,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
        [[ -n ${D_VER}   ]] && IUSE+=" d"
        [[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
        tc_version_is_at_least 3 && IUSE+=" doc gcj awt hardened multilib objc"
+       tc_version_is_at_least 3.3 && IUSE+=" pgo"
        tc_version_is_at_least 4.0 && IUSE+=" objc-gc"
        tc_version_is_between 4.0 4.9 && IUSE+=" mudflap"
        tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
@@ -1569,7 +1570,11 @@ gcc_do_make() {
                # resulting binaries natively ^^;
                GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
        else
-               GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
+               if tc_version_is_at_least 3.3 && use pgo; then
+                       GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
+               else
+                       GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
+               fi
        fi
 
        # Older versions of GCC could not do profiledbootstrap in parallel due to
index 43abab038eb336fc7d88f24b56f04c4995e0707f..52748bc1ff6818979b27443b11242540b1116eda 100644 (file)
@@ -27,6 +27,7 @@
     <flag name="objc++">Build support for the Objective C++ language</flag>
     <flag name="objc-gc">Build support for the Objective C code language Garbage
       Collector</flag>
+    <flag name="pgo">Build GCC using Profile Guided Optimization (PGO)</flag>
     <flag name="regression-test">Run the testsuite and install the results (requires FEATURES=test)</flag>
     <flag name="sanitize">Build support for various sanitizer functions (ASAN/TSAN/etc...)</flag>
     <flag name="ssp">Build packages with stack smashing protector on by default</flag>