{sys-devel/gcc,dev-lang/gnat-gpl}: add a USE for building GCC with LTO
authorShane Peelar <lookatyouhacker@gmail.com>
Wed, 8 May 2019 18:55:53 +0000 (14:55 -0400)
committerSergei Trofimovich <slyfox@gentoo.org>
Mon, 13 May 2019 22:38:22 +0000 (23:38 +0100)
Bug: https://bugs.gentoo.org/685634

Signed-off-by: Shane Peelar <lookatyouhacker@gmail.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
eclass/toolchain.eclass
sys-devel/gcc/metadata.xml

index 17850db4304584d565f36733603ace1726c196cd..9df8ecf69beacdc2fd3da9d1d3ca6020ae98d407 100644 (file)
@@ -174,6 +174,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
        tc_version_is_at_least 8.0 &&
                IUSE+=" systemtap" TC_FEATURES+=(systemtap)
        tc_version_is_at_least 9.0 && IUSE+=" d"
+       tc_version_is_at_least 9.1 && IUSE+=" lto"
 fi
 
 SLOT="${GCC_CONFIG_VER}"
@@ -993,6 +994,11 @@ toolchain_src_configure() {
                confgcc+=( --enable-libstdcxx-time )
        fi
 
+       # Build compiler using LTO
+       if tc_version_is_at_least 9.1 && use_if_iuse lto ; then
+               confgcc+=( --with-build-config=bootstrap-lto )
+       fi
+
        # Support to disable pch when building libstdcxx
        if tc_version_is_at_least 6.0 && ! use_if_iuse pch ; then
                confgcc+=( --disable-libstdcxx-pch )
index d70e721314882bb2415edfc59d76227f05bcfbc6..1b47b03d910283b39fcbd5b3e90bb1444de9c574 100644 (file)
@@ -21,6 +21,7 @@
       This will slow down the compiler a bit as it forces all of the toolchain to be shared libs.</flag>
     <flag name="libssp">Build SSP support into a dedicated library rather than use the
       code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT DOES)</flag>
+    <flag name="lto">Build using Link Time Optimizations (LTO)</flag>
     <flag name="mpx">Enable support for Intel Memory Protection Extensions (MPX)</flag>
     <flag name="mudflap">Add support for mudflap, a pointer use checking library</flag>
     <flag name="nopie">Disable PIE support (NOT FOR GENERAL USE)</flag>