On 25 Jun 2022, Rob Browning spake thusly:
> Nix <
n...@esperi.org.uk> writes:
>
>> I'd do that only if libpython is an .a file. If it's an .so, using LTO
>> should be fine, I'd think.
>
> Hmm, I don't really know enough yet about gcc's lto to know what the
> rules are, and also, for now, not sure I want to add much complexity to
> accommodate this.
The rules are fairly simple: when linking LTO-generated object files
together, they all need to be generated with compatible compilers
(usually, the same version of GCC): but only object files and .a's
containing them. The LTO version bumped a few times, as the version
number shows, and not all LTOs are intercompatible.
So for things like libpython.a, which might be generated by God knows
what GCC version, passing in -fno-lto makes sense. But LTO does not
traverse .so boundaries, so if libpython is a .so there is no danger of
traversing into it and finding object files there built by a much older
compiler. (Of course, if there are *other* .a files on the system that
have been built with LTO and that get picked up by the same link, the
same problem can recur.)
> For the moment, the compilation related changes I just pushed may
> mean that people affected can just to this:
>
> LDFLAGS=-fno-lto ./configure && make check
Seems sensible, particularly if the unaffected majority still get LTO if
they want it.
(Not that LTO is likely to do bup much good anyway, since it spends all
its time in a few hotspots in single TUs, in libpython, and in disk
I/O. More evidence your fix is right.)
--
NULL && (void)