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 https://github.com/mesonbuild/meson/issues/2129 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
https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=aab6bf7095a0ab921c78b07a202db207ce07a5f8 Pushed, thanks!
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f29fde782b79bc0bf7a8603a86e238412dc2ddfe commit f29fde782b79bc0bf7a8603a86e238412dc2ddfe Author: Andreas K. Hüttel <dilfridge@gentoo.org> AuthorDate: 2017-12-17 00:23:49 +0000 Commit: Andreas K. Hüttel <dilfridge@gentoo.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) Closes: https://bugs.gentoo.org/630066 Bug: https://bugs.gentoo.org/641096 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. ***