Subject: bug#69689: 30.0.50; cannot native compile with -flto in native-comp-compiler-options

From: Paul Eggert <[email-masked]>
Date: Sun, 10 Mar 2024 14:08:48 -0700

On 2024-03-10 10:32, StrawberryTea wrote:
> Well, I wanted to ask here because I wanted to check if anyone else is
> able to compile elisp files with -flto in native-comp-compiler-options.
> I believe that the error is related to the native-comp branch, as a
> Gentoo developer

Google searches suggest that "plugin needed to handle lto object" is an 
issue that arises in Gentoo builds of other projects. The basic issue is 
that if you're going to build everything from scratch, you must build 
the infrastructure correctly first, and that can include linker plugins. 
Sorry I can't help more, as I don't use Gentoo.

On 2024-03-09 22:24, Eli Zaretskii wrote:
 > Paul, does Emacs even support -flto builds?

Yes, with './configure --enable-link-time-optimization'. This should 
work fine, although the build time is greater and there are a few 
false-alarm warnings from GCC - at least they were false alarms the last 
time I checked, many moons ago. (I normally don't use 
--enable-link-time-optimization as it makes --enable-gcc-warnings way 
too slow.)

I don't think -flto per se is the issue here, though it's hard to be 
sure since we weren't given a precise recipe for reproducing the bug 
(and I don't use Gentoo so it'd be hard for me to reproduce it anyway).