Quite some packages fail with -flto if the gcc's flto linker plugin library /usr/libexec/gcc/$ARCH/$GCC_VERSION/liblto_plugin.so.0.0.0 is not symlinked into /usr/$ARCH/binutils-bin/lib/bfd-plugins
In particular, without this symlink, all packages creating static archives with "ar" or "$ARCH-ar" (in contrast to "gcc-ar" or "$ARCH-gcc-ar") do not do this correctly (unless -ffat-lto objects is in effect - but the latter simply means that flto cannot be used with that archive).
Note that tc-getAR from toolchain-funcs outputs $ARCH-ar (and not $ARCH-gcc-ar), so that e.g. meson.eclass exports a value for AR which requires the plugin.
This leads to such problems as discussed in
In my opinion, the correct solution would be that gentoo manages the above mentioned plugin symlink. Since this symlink should better point to the plugin corresponding to the currently selected gcc version, I suggest that this be done in gcc-config.
Created attachment 495798 [details, diff]
Add LTO symlink support to gcc-config
The bug has been closed via the following commit(s):
Author: Andreas K. Hüttel <email@example.com>
AuthorDate: 2017-12-17 00:23:49 +0000
Commit: Andreas K. Hüttel <firstname.lastname@example.org>
CommitDate: 2017-12-17 00:24:00 +0000
sys-devel/gcc-config: Version bump; fixes prefix issues (bug 641096) and adds support for LTO linker plugins (bug 630066)
Package-Manager: Portage-2.3.19, Repoman-2.3.6
sys-devel/gcc-config/Manifest | 1 +
sys-devel/gcc-config/gcc-config-1.9.1.ebuild | 54 ++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
Awesome! Now I can remove this from lto-overlay and advise users to use gcc-config-9999. Thank you!
*** Bug 612816 has been marked as a duplicate of this bug. ***