On Thu, Sep 28, 2023 at 09:03:39PM +0200, Toon Moene wrote: > > > The full question of "lto-ing" run time libraries is more > > > complicated than just "whether it works" as those who attended the > > > BoF will recall. > > > > I didn't attend the Cauldron (but that discussion would have been > > very interesting). I think for libgfortran, a first step would be > > additional work to get declarations on both sides to agree (which is > > worth doing anyway). > > > > Best regards > > > > Thomas > > The big problem in *distributing* GCC (i.e., the collection) with lto'd > run-time libraries is that the format of the lto structure changes with > releases. If a compiler (by accident) picks up a run time library with > non-matching lto objects, it might crash (or "introduce subtle errors in a > once working program").
It is worse than that, usually the LTO format changes e.g. any time any option or parameter is added on a release branch (several times a year) and at other times as well. Though, admittedly GCC is the single package that actually could get away with LTO in lib*.a libraries, at least in some packagings (if the static libraries are in gcc specific subdirectories rather than say /usr/lib{,64} or similar and if the packaging of gcc updates both the compiler and corresponding static libraries in a lock-step. Because in that case LTO in there will be always used only by the same snapshot from the release branch and so should be compatible with the LTO in it. Jakub