-
Notifications
You must be signed in to change notification settings - Fork 96
LTO Rebuild
Normally, you would have to do a full system rebuild after upgrading GCC. This is because compiler object files are generally not backwards or forwards compatible, especially ones containing LTO symbols. If action isn't taken to rebuild the static libraries on your system, you will encounter LTO linker errors when emerging dependent packages.
Fortunately, this is no longer the case. A new tool, app-portage/lto-rebuild
has been provided to ease transitions to new compilers.
It searches for any installed static archives on the system and requests a oneshot emerge of the ones that were built using a different GCC.
Doing this requires that the ebuilds for your installed packages are available -- the easiest way to guarantee this is the following:
- Ensure your system is up to date (including installing the new GCC)
- Switch to the new GCC (using
eselect gcc
orgcc-config
) - Run
lto-rebuild -r
as root - Complete the emerge
If you encounter problems with lto-rebuild -r
, you may be able to resolve them manually with lto-rebuild -l
and
rebuilding the offending packages one by one. If that's not possible, you must do a full system rebuild as you would have
previously. An emerge -e @world
should suffice.
Of course, if you want to realize the performance improvements from the newer compiler across your entire system, you will have to do a world rebuild -- no getting around that!
GentooLTO can now be used in a "soft" configuration where a full system rebuild is not necessary.
After ensuring your GCC, binutils, and glibc meet the standard GentooLTO requirements, simply modify
make.conf
as per the GentooLTO instructions, but instead of rebuilding @world
, use:
lto-rebuild -r
This will rebuild the minimal set of packages required to ensure your future updates run smoothly. Newly updated and emerged packages will be built with LTO, and your system will gradually be converted to a fully LTO system over time.