Skip to content

Commit

Permalink
Update GentooLTO defaults
Browse files Browse the repository at this point in the history
Add -fipa-pta, -fdevirtualize-at-ltrans to default flags
Make ld.gold default GentooLTO linker
Remove older ltoize versions
Rename some variables
Add new definitions

Signed-off-by: Shane Peelar <[email protected]>
  • Loading branch information
InBetweenNames committed May 22, 2019
1 parent df5fbe1 commit 48776d9
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 318 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Title: GentooLTO updated default flags
Author: Shane Peelar <[email protected]>
Content-Type: text/plain
Posted: 2019-05-22
Revision: 1
News-Item-Format: 1.0

A few weeks have passed since the introduction of GCC 9.1.0 and GentooLTO will
now be updating the default configuration to include two new flags:

* -fipa-pta
* -fdevirtualize-at-ltrans

These are two safe flags that don't change the semantics of your programs.
Users of make.conf.lto will receive the changes transparently. Users
of make.conf.lto.defines will have to manually edit their config to include
these flags. No system rebuild or lto-rebuild is required.

Note that these flags will increase compilation time by some amount.
If you encounter build failures, please make a report or email me.

GentooLTO is also now using ld.gold as the default linker.
ld.bfd is still necessary for certain packages, but gold seems
to give less trouble than bfd in general. A warning has been
added to sys-config/ltoize to remind users to switch over.
No system rebuild or lto-rebuild is required for this change.

GentooLTO is also undergoing a refactor in terms of repository layout
and documentation. The documentation/knowledge base is being migrated
over to the GentooLTO wiki located here:

https://github.com/InBetweenNames/gentooLTO/wiki

and the repository layout will change such that new and different
configurations will be supported. A news item will be posted
when these changes occur so that you can update your system accordingly.
More to come soon!

All the best,
-Shane
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEECNe4A5FF8/6bCpnT/UW7dtNCsA4FAlzlZe4ACgkQ/UW7dtNC
sA4CKwf/UkflQydaqmNbkI4gh9Pdh+OyRxf/g4v1wpmXl/zbeegYYrL3PCqWVu/S
JjzT9xkTG11gq/y8OiKmmmrBuQ1QwwKicomDM5Hkzn3tt8mm0F2O1JJodKRDj12O
4BponnBUt51lxsRdk9VZ67m3UgRDNvow3AkhQfOgJeIX4Cdxfry0kgHESRzYRbbI
9EekyJXCAVXwTEE9g29WDevGLAIyOvghQ1eUU4+hZAVpducQmkkMqx46irG33c3u
LvUP6gPVZDznH7wy8abkTJLnZx06JB4MRPKyxfXDMhWxY57ZPHiRo4TZUSa/ULiN
5SfwvmcLOm/wYT3v0owFK5iklkI34w==
=XD2Z
-----END PGP SIGNATURE-----
2 changes: 1 addition & 1 deletion sys-config/ltoize/files/make.conf.lto
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ source make.conf.lto.defines

#Thanks to issue #49, no action necessary for preventing stripping of static libraries

CFLAGS="-O3 ${GRAPHITE} ${SEMINTERPOS} ${FLTO} -fuse-linker-plugin"
CFLAGS="-O3 ${GRAPHITE} ${DEVIRTLTO} ${IPAPTA} ${SEMINTERPOS} ${FLTO} -fuse-linker-plugin"

#Your LDFLAGS should contain *ALL* of your CFLAGS for LTO to work. It must receieve all optimization options, march, etc.
#package.cflags takes care of this for you--no need to manually add your {C,CXX}FLAGS here.
Expand Down
19 changes: 15 additions & 4 deletions sys-config/ltoize/files/make.conf.lto.defines
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#* Your CFLAGS should contain ${FLTO} and, depending on your gcc, -fuse-linker-plugin
#* Newer GCCs enable -fuse-linker-plugin by default.
#* If you want Graphite, include "${GRAPHITE}" in your CFLAGS
#* If you want -fipa-pta, include "${IPA}" in your CFLAGS (undefined for now, issue #257)
#* If you want -fipa-pta, include "${IPAPTA}" in your CFLAGS (undefined for now, issue #257)
#* Anything else is up to you, such as -march, -pipe, -O{3,2,s,1}, etc...
#* CXXFLAGS should be set to CFLAGS
#* Optionally, set other *FLAGS for languages compiled with GCC as well (See make.conf.lto)
Expand All @@ -28,9 +28,9 @@ FLTO="-flto=${NTHREADS}"
GRAPHITE="-fgraphite-identity -floop-nest-optimize"
#NOTE: To use graphite, make sure you have gcc compiled with graphite support (add graphite to your USE). Otherwise GCC will complain!

IPA="-fipa-pta"
IPAPTA="-fipa-pta"

#IPA contains -fipa* opts that are disabled by default in GCC. These are interprocedural optimizations. For now this is only -fipa-pta.
#IPAPTA contains -fipa* opts that are disabled by default in GCC. These are interprocedural optimizations. For now this is only -fipa-pta.
#This option increases compile times, but can potentially produce better binaries, especially with LTO.
#Essentially, it allows the compiler to look into called function bodies when performing alias analysis

Expand All @@ -43,9 +43,20 @@ NOCOMMON="-fno-common"
# This option only affects C code. Only non-conformant C code needs -fcommon, which is enabled by default. Clear Linux leaves this flag off by default.
# We may enable this at some point. For now, there's a lot of breakages to work through.

FASTMATH="-fno-math-errno -fno-trapping-math"
SAFERFASTMATH="-fno-math-errno -fno-trapping-math"

#These are flags left off by default that we're planning to start using. Clear Linux uses these in lieu of full -ffast-math optimizations
#They DO break compliance with ISO C++, so we'll be careful about introducing these.
#Relevant discussion: https://gcc.gnu.org/ml/gcc/2017-09/msg00079.html
#We may end up just going full -Ofast, with exceptions done in the usual way.

DEVIRTLTO="-fdevirtualize-at-ltrans"

#This allows GCC to perform devirtualization across object file boundaries using LTO. It's off by default because it
#increases compilation time.

NOPLT="-fno-plt"

#This option omits the PLT from the executable, making calls go through the GOT directly.
#It inhibits lazy binding, so this is not enabled by default. If you use prelink, this is
#strictly better than lazy binding.
30 changes: 15 additions & 15 deletions sys-config/ltoize/files/package.cflags/ltoworkarounds.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ games-emulation/mupen64plus-libretro *FLAGS-=-flto*
net-p2p/cpuminer-opt *FLAGS-=-flto*
x11-drivers/xf86-video-intel *FLAGS-=-flto*
<app-text/mupdf-1.12.0 *FLAGS-=-flto* # Only older versions are affected
dev-scheme/racket *FLAGS-=-flto* *FLAGS-="${IPA}" # Undefined references and multiple segfaults / violations during build.
dev-scheme/racket *FLAGS-=-flto* *FLAGS-="${IPAPTA}" # Undefined references and multiple segfaults / violations during build.
sys-libs/libsepol *FLAGS-=-flto*
sys-libs/libselinux *FLAGS-=-flto*
sys-libs/libsemanage *FLAGS-=-flto*
Expand All @@ -61,7 +61,7 @@ dev-libs/weston *FLAGS-=-flto*
>=dev-lang/php-7.2.0 *FLAGS-=-flto* # lto-wrapper link failure / https://github.com/InBetweenNames/gentooLTO/issues/135
sys-fs/fuse *FLAGS-=-flto* # Issue #139 and #142, it appears the symbol __fuse_read_cmd goes missing if LTO is enabled, causing linking problems on some systems. Using gold seems to help.
sys-fs/fuse-common *FLAGS-=-flto*
sys-libs/glibc *FLAGS-=-flto* #Alternative: *FLAGS+=-ffat-lto-objects *FLAGS-="${IPA}" Fails in configure stage with LTO enabled, checking for builtin redirect. With -ffat-lto-objects, and no -fipa-pta, we get further, but get multiple definition errors Forcing past that yields undefined symbol errors.
sys-libs/glibc *FLAGS-=-flto* #Alternative: *FLAGS+=-ffat-lto-objects *FLAGS-="${IPAPTA}" Fails in configure stage with LTO enabled, checking for builtin redirect. With -ffat-lto-objects, and no -fipa-pta, we get further, but get multiple definition errors Forcing past that yields undefined symbol errors.
app-emulation/wine* *FLAGS-=-flto*
sys-process/criu *FLAGS-=-pipe* *FLAGS-=-flto* *FLAGS-="-fuse-linker-plugin" LDFLAGS-="-Wl,--hash-style=gnu" *FLAGS-="${GRAPHITE}" # Fewer settings may be possible. Needs testing. (Dependency of LXC.)
media-video/ffmpeg *FLAGS-=-flto* #NOTE: Depending on your CPUFLAGS this may work with LTO. The SSE intrinsics seem to cause problems in some cases.
Expand Down Expand Up @@ -146,21 +146,21 @@ sys-devel/gcc LTO_ENABLE_FLAGOMATIC=yes #Build system requires special attention
dev-lang/gnat-gpl LTO_ENABLE_FLAGOMATIC=yes
# END: override-flagomatic workarounds

#sys-devel/gcc BOOT_CFLAGS="${CFLAGS}"
#>=sys-devel/gcc-9 *FLAGS-=-flto* BOOT_CFLAGS='"${CFLAGS}"'

# BEGIN: -fipa-pta workarounds
www-client/firefox *FLAGS-="${IPA}" #ICE on -fipa-pta
www-client/torbrowser *FLAGS-="${IPA}" #ICE on -fipa-pta
=sys-apps/gawk-4.1.4 *FLAGS-="${IPA}" # during IPA pass: pta lto1: internal compiler error: Segmentation fault
dev-qt/qtwebkit *FLAGS-="${IPA}"
media-sound/mpc *FLAGS-="${IPA}" # hangs on exit with -fipa-pta
dev-lang/R *FLAGS-="${IPA}" # during IPA pass: pta lto1: internal compiler error: Segmentation fault
sys-devel/gcc *FLAGS-="${IPA}"
dev-lang/gnat-gpl *FLAGS-="${IPA}"
dev-lisp/sbcl *FLAGS-="${IPA}" #ICE on -fipa-pta
x11-wm/bspwm *FLAGS-="${IPA}" # needed for version 0.9.7 on 17.0 profile running the testing branch everywhere with GCC 8.3.0
media-libs/libwebp *FLAGS-=-fipa-pta # no compilation issues, but -fipa-pta causes webp images to be displayed incorrectly
dev-qt/qtgui *FLAGS-=-fipa-pta # Same problem as above
www-client/firefox *FLAGS-="${IPAPTA}" #ICE on -fipa-pta
www-client/torbrowser *FLAGS-="${IPAPTA}" #ICE on -fipa-pta
=sys-apps/gawk-4.1.4 *FLAGS-="${IPAPTA}" # during IPAPTA pass: pta lto1: internal compiler error: Segmentation fault
dev-qt/qtwebkit *FLAGS-="${IPAPTA}"
media-sound/mpc *FLAGS-="${IPAPTA}" # hangs on exit with -fipa-pta
dev-lang/R *FLAGS-="${IPAPTA}" # during IPAPTA pass: pta lto1: internal compiler error: Segmentation fault
sys-devel/gcc *FLAGS-="${IPAPTA}"
dev-lang/gnat-gpl *FLAGS-="${IPAPTA}"
dev-lisp/sbcl *FLAGS-="${IPAPTA}" #ICE on -fipa-pta
x11-wm/bspwm *FLAGS-="${IPAPTA}" # needed for version 0.9.7 on 17.0 profile running the testing branch everywhere with GCC 8.3.0
media-libs/libwebp *FLAGS-="${IPAPTA}" # no compilation issues, but -fipa-pta causes webp images to be displayed incorrectly
dev-qt/qtgui *FLAGS-="${IPAPTA}" # Same problem as above
# END: -fipa-pta workarounds

# BEGIN: TLS dialect workarounds
Expand Down
94 changes: 0 additions & 94 deletions sys-config/ltoize/ltoize-0.8.1.ebuild

This file was deleted.

97 changes: 0 additions & 97 deletions sys-config/ltoize/ltoize-0.8.2.ebuild

This file was deleted.

Loading

0 comments on commit 48776d9

Please sign in to comment.