commit:     9655793b0f9a93d99d562d5cecae589deed0e1ba
Author:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 27 04:33:01 2024 +0000
Commit:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
CommitDate: Tue Aug 27 06:52:13 2024 +0000
URL:        https://gitweb.gentoo.org/proj/binhost.git/commit/?id=9655793b

start implementing LTO; activate PGO builds

We run one builder with USE="lto pgo" and the rest without, because we
want to also build packages for the default USE flags (no lto/pgo).
Although USE=lto is being phased out, the GCC package in particular
hasn't migrated.

Start opting a few packages in to LTO via *FLAGS as well. Remaining
sys-devel packages are a good target for this.

Note: xorg-server must be built with xvfb support for firefox to do PGO.
It otherwise uses the same config for gnome/kde anyway.

Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>

 builders/milou/gnome-23/portage/env/lto.conf        |  5 +++++
 builders/milou/gnome-23/portage/make.conf           | 10 +++++++---
 builders/milou/gnome-23/portage/package.env/lto     |  2 ++
 builders/milou/gnome-23/portage/package.use/pgo     |  2 ++
 builders/milou/gnome-v3-23/portage/env/lto.conf     |  5 +++++
 builders/milou/gnome-v3-23/portage/make.conf        |  9 +++++++--
 builders/milou/gnome-v3-23/portage/package.env/lto  |  2 ++
 builders/milou/gnome-v3-23/portage/package.use/pgo  |  2 ++
 builders/milou/kde-23/portage/env/lto.conf          |  5 +++++
 builders/milou/kde-23/portage/make.conf             |  8 ++++++--
 builders/milou/kde-23/portage/package.env/lto       |  2 ++
 builders/milou/kde-v3-23/portage/env/lto.conf       |  5 +++++
 builders/milou/kde-v3-23/portage/make.conf          |  7 ++++++-
 builders/milou/kde-v3-23/portage/package.env/lto    |  2 ++
 builders/milou/openrc-23/portage/env/lto.conf       |  5 +++++
 builders/milou/openrc-23/portage/make.conf          |  8 ++++++--
 builders/milou/openrc-23/portage/package.env/lto    |  2 ++
 builders/milou/openrc-v3-23/portage/env/lto.conf    |  5 +++++
 builders/milou/openrc-v3-23/portage/make.conf       |  7 ++++++-
 builders/milou/openrc-v3-23/portage/package.env/lto |  2 ++
 builders/milou/server-23/portage/env/lto.conf       |  5 +++++
 builders/milou/server-23/portage/make.conf          |  8 ++++++--
 builders/milou/server-23/portage/package.env/lto    |  2 ++
 builders/milou/server-v3-23/portage/env/lto.conf    |  5 +++++
 builders/milou/server-v3-23/portage/make.conf       |  7 ++++++-
 builders/milou/server-v3-23/portage/package.env/lto |  2 ++
 26 files changed, 110 insertions(+), 14 deletions(-)

diff --git a/builders/milou/gnome-23/portage/env/lto.conf 
b/builders/milou/gnome-23/portage/env/lto.conf
new file mode 100644
index 0000000..37647dd
--- /dev/null
+++ b/builders/milou/gnome-23/portage/env/lto.conf
@@ -0,0 +1,5 @@
+CFLAGS="${CFLAGS} -flto"
+CXXFLAGS="${CXXFLAGS} -flto"
+FCFLAGS="${FCFLAGS} -flto"
+FFLAGS="${FFLAGS} -flto"
+LDFLAGS="${LDFLAGS} -flto"

diff --git a/builders/milou/gnome-23/portage/make.conf 
b/builders/milou/gnome-23/portage/make.conf
index 537f5b4..787eb6f 100644
--- a/builders/milou/gnome-23/portage/make.conf
+++ b/builders/milou/gnome-23/portage/make.conf
@@ -2,12 +2,17 @@
 # built this stage.
 # Please consult /usr/share/portage/config/make.conf.example for a more
 # detailed example.
-COMMON_FLAGS="-O2 -pipe -march=x86-64 -mtune=generic"
+
+# For now, we enforce LTO warnings but only enable LTO for certain packages.
+LTOFLAGS="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
+COMMON_FLAGS="-O2 -pipe -march=x86-64 -mtune=generic ${LTOFLAGS}"
 CFLAGS="${COMMON_FLAGS}"
 CXXFLAGS="${COMMON_FLAGS}"
 FCFLAGS="${COMMON_FLAGS}"
 FFLAGS="${COMMON_FLAGS}"
 
+LDFLAGS="${LDFLAGS} ${LTOFLAGS}"
+
 # NOTE: This stage was built with the bindist Use flag enabled
 PORTDIR="/var/db/repos/gentoo"
 DISTDIR="/var/cache/distfiles"
@@ -26,11 +31,10 @@ FEATURES="binpkg-multi-instance buildpkg compress-index 
-network-sandbox"
 BINPKG_FORMAT="gpkg"
 BINPKG_COMPRESS="xz"
 
-USE="bindist cet"
+USE="bindist cet lto pgo"
 
 ACCEPT_RESTRICT="* -bindist"
 
 ACCEPT_LICENSE="@FREE MPEG-4"
 
 LC_ALL="en_US.utf8"
-

diff --git a/builders/milou/gnome-23/portage/package.env/lto 
b/builders/milou/gnome-23/portage/package.env/lto
new file mode 100644
index 0000000..91d5f6b
--- /dev/null
+++ b/builders/milou/gnome-23/portage/package.env/lto
@@ -0,0 +1,2 @@
+dev-lang/python lto.conf
+sys-devel/* lto.conf

diff --git a/builders/milou/gnome-23/portage/package.use/pgo 
b/builders/milou/gnome-23/portage/package.use/pgo
new file mode 100644
index 0000000..07b62df
--- /dev/null
+++ b/builders/milou/gnome-23/portage/package.use/pgo
@@ -0,0 +1,2 @@
+# needed by firefox
+x11-base/xorg-server xvfb

diff --git a/builders/milou/gnome-v3-23/portage/env/lto.conf 
b/builders/milou/gnome-v3-23/portage/env/lto.conf
new file mode 100644
index 0000000..37647dd
--- /dev/null
+++ b/builders/milou/gnome-v3-23/portage/env/lto.conf
@@ -0,0 +1,5 @@
+CFLAGS="${CFLAGS} -flto"
+CXXFLAGS="${CXXFLAGS} -flto"
+FCFLAGS="${FCFLAGS} -flto"
+FFLAGS="${FFLAGS} -flto"
+LDFLAGS="${LDFLAGS} -flto"

diff --git a/builders/milou/gnome-v3-23/portage/make.conf 
b/builders/milou/gnome-v3-23/portage/make.conf
index 18a732c..a33e112 100644
--- a/builders/milou/gnome-v3-23/portage/make.conf
+++ b/builders/milou/gnome-v3-23/portage/make.conf
@@ -2,12 +2,17 @@
 # built this stage.
 # Please consult /usr/share/portage/config/make.conf.example for a more
 # detailed example.
-COMMON_FLAGS="-O2 -pipe -march=x86-64-v3"
+
+# For now, we enforce LTO warnings but only enable LTO for certain packages.
+LTOFLAGS="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
+COMMON_FLAGS="-O2 -pipe -march=x86-64-v3 ${LTOFLAGS}"
 CFLAGS="${COMMON_FLAGS}"
 CXXFLAGS="${COMMON_FLAGS}"
 FCFLAGS="${COMMON_FLAGS}"
 FFLAGS="${COMMON_FLAGS}"
 
+LDFLAGS="${LDFLAGS} ${LTOFLAGS}"
+
 # NOTE: This stage was built with the bindist Use flag enabled
 PORTDIR="/var/db/repos/gentoo"
 DISTDIR="/var/cache/distfiles"
@@ -26,7 +31,7 @@ FEATURES="binpkg-multi-instance buildpkg compress-index 
-network-sandbox"
 BINPKG_FORMAT="gpkg"
 BINPKG_COMPRESS="xz"
 
-USE="bindist cet"
+USE="bindist cet lto pgo"
 
 ACCEPT_RESTRICT="* -bindist"
 

diff --git a/builders/milou/gnome-v3-23/portage/package.env/lto 
b/builders/milou/gnome-v3-23/portage/package.env/lto
new file mode 100644
index 0000000..91d5f6b
--- /dev/null
+++ b/builders/milou/gnome-v3-23/portage/package.env/lto
@@ -0,0 +1,2 @@
+dev-lang/python lto.conf
+sys-devel/* lto.conf

diff --git a/builders/milou/gnome-v3-23/portage/package.use/pgo 
b/builders/milou/gnome-v3-23/portage/package.use/pgo
new file mode 100644
index 0000000..07b62df
--- /dev/null
+++ b/builders/milou/gnome-v3-23/portage/package.use/pgo
@@ -0,0 +1,2 @@
+# needed by firefox
+x11-base/xorg-server xvfb

diff --git a/builders/milou/kde-23/portage/env/lto.conf 
b/builders/milou/kde-23/portage/env/lto.conf
new file mode 100644
index 0000000..37647dd
--- /dev/null
+++ b/builders/milou/kde-23/portage/env/lto.conf
@@ -0,0 +1,5 @@
+CFLAGS="${CFLAGS} -flto"
+CXXFLAGS="${CXXFLAGS} -flto"
+FCFLAGS="${FCFLAGS} -flto"
+FFLAGS="${FFLAGS} -flto"
+LDFLAGS="${LDFLAGS} -flto"

diff --git a/builders/milou/kde-23/portage/make.conf 
b/builders/milou/kde-23/portage/make.conf
index 537f5b4..105f980 100644
--- a/builders/milou/kde-23/portage/make.conf
+++ b/builders/milou/kde-23/portage/make.conf
@@ -2,12 +2,17 @@
 # built this stage.
 # Please consult /usr/share/portage/config/make.conf.example for a more
 # detailed example.
-COMMON_FLAGS="-O2 -pipe -march=x86-64 -mtune=generic"
+
+# For now, we enforce LTO warnings but only enable LTO for certain packages.
+LTOFLAGS="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
+COMMON_FLAGS="-O2 -pipe -march=x86-64 -mtune=generic ${LTOFLAGS}"
 CFLAGS="${COMMON_FLAGS}"
 CXXFLAGS="${COMMON_FLAGS}"
 FCFLAGS="${COMMON_FLAGS}"
 FFLAGS="${COMMON_FLAGS}"
 
+LDFLAGS="${LDFLAGS} ${LTOFLAGS}"
+
 # NOTE: This stage was built with the bindist Use flag enabled
 PORTDIR="/var/db/repos/gentoo"
 DISTDIR="/var/cache/distfiles"
@@ -33,4 +38,3 @@ ACCEPT_RESTRICT="* -bindist"
 ACCEPT_LICENSE="@FREE MPEG-4"
 
 LC_ALL="en_US.utf8"
-

diff --git a/builders/milou/kde-23/portage/package.env/lto 
b/builders/milou/kde-23/portage/package.env/lto
new file mode 100644
index 0000000..91d5f6b
--- /dev/null
+++ b/builders/milou/kde-23/portage/package.env/lto
@@ -0,0 +1,2 @@
+dev-lang/python lto.conf
+sys-devel/* lto.conf

diff --git a/builders/milou/kde-v3-23/portage/env/lto.conf 
b/builders/milou/kde-v3-23/portage/env/lto.conf
new file mode 100644
index 0000000..37647dd
--- /dev/null
+++ b/builders/milou/kde-v3-23/portage/env/lto.conf
@@ -0,0 +1,5 @@
+CFLAGS="${CFLAGS} -flto"
+CXXFLAGS="${CXXFLAGS} -flto"
+FCFLAGS="${FCFLAGS} -flto"
+FFLAGS="${FFLAGS} -flto"
+LDFLAGS="${LDFLAGS} -flto"

diff --git a/builders/milou/kde-v3-23/portage/make.conf 
b/builders/milou/kde-v3-23/portage/make.conf
index 18a732c..80e255d 100644
--- a/builders/milou/kde-v3-23/portage/make.conf
+++ b/builders/milou/kde-v3-23/portage/make.conf
@@ -2,12 +2,17 @@
 # built this stage.
 # Please consult /usr/share/portage/config/make.conf.example for a more
 # detailed example.
-COMMON_FLAGS="-O2 -pipe -march=x86-64-v3"
+
+# For now, we enforce LTO warnings but only enable LTO for certain packages.
+LTOFLAGS="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
+COMMON_FLAGS="-O2 -pipe -march=x86-64-v3 ${LTOFLAGS}"
 CFLAGS="${COMMON_FLAGS}"
 CXXFLAGS="${COMMON_FLAGS}"
 FCFLAGS="${COMMON_FLAGS}"
 FFLAGS="${COMMON_FLAGS}"
 
+LDFLAGS="${LDFLAGS} ${LTOFLAGS}"
+
 # NOTE: This stage was built with the bindist Use flag enabled
 PORTDIR="/var/db/repos/gentoo"
 DISTDIR="/var/cache/distfiles"

diff --git a/builders/milou/kde-v3-23/portage/package.env/lto 
b/builders/milou/kde-v3-23/portage/package.env/lto
new file mode 100644
index 0000000..91d5f6b
--- /dev/null
+++ b/builders/milou/kde-v3-23/portage/package.env/lto
@@ -0,0 +1,2 @@
+dev-lang/python lto.conf
+sys-devel/* lto.conf

diff --git a/builders/milou/openrc-23/portage/env/lto.conf 
b/builders/milou/openrc-23/portage/env/lto.conf
new file mode 100644
index 0000000..37647dd
--- /dev/null
+++ b/builders/milou/openrc-23/portage/env/lto.conf
@@ -0,0 +1,5 @@
+CFLAGS="${CFLAGS} -flto"
+CXXFLAGS="${CXXFLAGS} -flto"
+FCFLAGS="${FCFLAGS} -flto"
+FFLAGS="${FFLAGS} -flto"
+LDFLAGS="${LDFLAGS} -flto"

diff --git a/builders/milou/openrc-23/portage/make.conf 
b/builders/milou/openrc-23/portage/make.conf
index 537f5b4..105f980 100644
--- a/builders/milou/openrc-23/portage/make.conf
+++ b/builders/milou/openrc-23/portage/make.conf
@@ -2,12 +2,17 @@
 # built this stage.
 # Please consult /usr/share/portage/config/make.conf.example for a more
 # detailed example.
-COMMON_FLAGS="-O2 -pipe -march=x86-64 -mtune=generic"
+
+# For now, we enforce LTO warnings but only enable LTO for certain packages.
+LTOFLAGS="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
+COMMON_FLAGS="-O2 -pipe -march=x86-64 -mtune=generic ${LTOFLAGS}"
 CFLAGS="${COMMON_FLAGS}"
 CXXFLAGS="${COMMON_FLAGS}"
 FCFLAGS="${COMMON_FLAGS}"
 FFLAGS="${COMMON_FLAGS}"
 
+LDFLAGS="${LDFLAGS} ${LTOFLAGS}"
+
 # NOTE: This stage was built with the bindist Use flag enabled
 PORTDIR="/var/db/repos/gentoo"
 DISTDIR="/var/cache/distfiles"
@@ -33,4 +38,3 @@ ACCEPT_RESTRICT="* -bindist"
 ACCEPT_LICENSE="@FREE MPEG-4"
 
 LC_ALL="en_US.utf8"
-

diff --git a/builders/milou/openrc-23/portage/package.env/lto 
b/builders/milou/openrc-23/portage/package.env/lto
new file mode 100644
index 0000000..91d5f6b
--- /dev/null
+++ b/builders/milou/openrc-23/portage/package.env/lto
@@ -0,0 +1,2 @@
+dev-lang/python lto.conf
+sys-devel/* lto.conf

diff --git a/builders/milou/openrc-v3-23/portage/env/lto.conf 
b/builders/milou/openrc-v3-23/portage/env/lto.conf
new file mode 100644
index 0000000..37647dd
--- /dev/null
+++ b/builders/milou/openrc-v3-23/portage/env/lto.conf
@@ -0,0 +1,5 @@
+CFLAGS="${CFLAGS} -flto"
+CXXFLAGS="${CXXFLAGS} -flto"
+FCFLAGS="${FCFLAGS} -flto"
+FFLAGS="${FFLAGS} -flto"
+LDFLAGS="${LDFLAGS} -flto"

diff --git a/builders/milou/openrc-v3-23/portage/make.conf 
b/builders/milou/openrc-v3-23/portage/make.conf
index 18a732c..80e255d 100644
--- a/builders/milou/openrc-v3-23/portage/make.conf
+++ b/builders/milou/openrc-v3-23/portage/make.conf
@@ -2,12 +2,17 @@
 # built this stage.
 # Please consult /usr/share/portage/config/make.conf.example for a more
 # detailed example.
-COMMON_FLAGS="-O2 -pipe -march=x86-64-v3"
+
+# For now, we enforce LTO warnings but only enable LTO for certain packages.
+LTOFLAGS="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
+COMMON_FLAGS="-O2 -pipe -march=x86-64-v3 ${LTOFLAGS}"
 CFLAGS="${COMMON_FLAGS}"
 CXXFLAGS="${COMMON_FLAGS}"
 FCFLAGS="${COMMON_FLAGS}"
 FFLAGS="${COMMON_FLAGS}"
 
+LDFLAGS="${LDFLAGS} ${LTOFLAGS}"
+
 # NOTE: This stage was built with the bindist Use flag enabled
 PORTDIR="/var/db/repos/gentoo"
 DISTDIR="/var/cache/distfiles"

diff --git a/builders/milou/openrc-v3-23/portage/package.env/lto 
b/builders/milou/openrc-v3-23/portage/package.env/lto
new file mode 100644
index 0000000..91d5f6b
--- /dev/null
+++ b/builders/milou/openrc-v3-23/portage/package.env/lto
@@ -0,0 +1,2 @@
+dev-lang/python lto.conf
+sys-devel/* lto.conf

diff --git a/builders/milou/server-23/portage/env/lto.conf 
b/builders/milou/server-23/portage/env/lto.conf
new file mode 100644
index 0000000..37647dd
--- /dev/null
+++ b/builders/milou/server-23/portage/env/lto.conf
@@ -0,0 +1,5 @@
+CFLAGS="${CFLAGS} -flto"
+CXXFLAGS="${CXXFLAGS} -flto"
+FCFLAGS="${FCFLAGS} -flto"
+FFLAGS="${FFLAGS} -flto"
+LDFLAGS="${LDFLAGS} -flto"

diff --git a/builders/milou/server-23/portage/make.conf 
b/builders/milou/server-23/portage/make.conf
index 537f5b4..105f980 100644
--- a/builders/milou/server-23/portage/make.conf
+++ b/builders/milou/server-23/portage/make.conf
@@ -2,12 +2,17 @@
 # built this stage.
 # Please consult /usr/share/portage/config/make.conf.example for a more
 # detailed example.
-COMMON_FLAGS="-O2 -pipe -march=x86-64 -mtune=generic"
+
+# For now, we enforce LTO warnings but only enable LTO for certain packages.
+LTOFLAGS="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
+COMMON_FLAGS="-O2 -pipe -march=x86-64 -mtune=generic ${LTOFLAGS}"
 CFLAGS="${COMMON_FLAGS}"
 CXXFLAGS="${COMMON_FLAGS}"
 FCFLAGS="${COMMON_FLAGS}"
 FFLAGS="${COMMON_FLAGS}"
 
+LDFLAGS="${LDFLAGS} ${LTOFLAGS}"
+
 # NOTE: This stage was built with the bindist Use flag enabled
 PORTDIR="/var/db/repos/gentoo"
 DISTDIR="/var/cache/distfiles"
@@ -33,4 +38,3 @@ ACCEPT_RESTRICT="* -bindist"
 ACCEPT_LICENSE="@FREE MPEG-4"
 
 LC_ALL="en_US.utf8"
-

diff --git a/builders/milou/server-23/portage/package.env/lto 
b/builders/milou/server-23/portage/package.env/lto
new file mode 100644
index 0000000..91d5f6b
--- /dev/null
+++ b/builders/milou/server-23/portage/package.env/lto
@@ -0,0 +1,2 @@
+dev-lang/python lto.conf
+sys-devel/* lto.conf

diff --git a/builders/milou/server-v3-23/portage/env/lto.conf 
b/builders/milou/server-v3-23/portage/env/lto.conf
new file mode 100644
index 0000000..37647dd
--- /dev/null
+++ b/builders/milou/server-v3-23/portage/env/lto.conf
@@ -0,0 +1,5 @@
+CFLAGS="${CFLAGS} -flto"
+CXXFLAGS="${CXXFLAGS} -flto"
+FCFLAGS="${FCFLAGS} -flto"
+FFLAGS="${FFLAGS} -flto"
+LDFLAGS="${LDFLAGS} -flto"

diff --git a/builders/milou/server-v3-23/portage/make.conf 
b/builders/milou/server-v3-23/portage/make.conf
index 18a732c..80e255d 100644
--- a/builders/milou/server-v3-23/portage/make.conf
+++ b/builders/milou/server-v3-23/portage/make.conf
@@ -2,12 +2,17 @@
 # built this stage.
 # Please consult /usr/share/portage/config/make.conf.example for a more
 # detailed example.
-COMMON_FLAGS="-O2 -pipe -march=x86-64-v3"
+
+# For now, we enforce LTO warnings but only enable LTO for certain packages.
+LTOFLAGS="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
+COMMON_FLAGS="-O2 -pipe -march=x86-64-v3 ${LTOFLAGS}"
 CFLAGS="${COMMON_FLAGS}"
 CXXFLAGS="${COMMON_FLAGS}"
 FCFLAGS="${COMMON_FLAGS}"
 FFLAGS="${COMMON_FLAGS}"
 
+LDFLAGS="${LDFLAGS} ${LTOFLAGS}"
+
 # NOTE: This stage was built with the bindist Use flag enabled
 PORTDIR="/var/db/repos/gentoo"
 DISTDIR="/var/cache/distfiles"

diff --git a/builders/milou/server-v3-23/portage/package.env/lto 
b/builders/milou/server-v3-23/portage/package.env/lto
new file mode 100644
index 0000000..91d5f6b
--- /dev/null
+++ b/builders/milou/server-v3-23/portage/package.env/lto
@@ -0,0 +1,2 @@
+dev-lang/python lto.conf
+sys-devel/* lto.conf

Reply via email to