[arch-dev-public] Fun with LTO and stripping

Evangelos Foutras evangelos at foutrelis.com
Fri Dec 24 19:23:06 UTC 2021

On Fri, 24 Dec 2021 at 10:01, Allan McRae via arch-dev-public
<arch-dev-public at lists.archlinux.org> wrote:
> This fix for the strip issue is for people to add CFLAGS+="
> -ffat-lto-objects" to their PKGBUILDs if they use LTO and contain a .a
> or .o archive.  This affects ~300 packages in our repos (~2.5%).  I will
> create a TODO list.

It's worth noting that -ffat-lto-objects is not supported by clang.
I'm not sure if there's an equivalent option (seems unlikely).

Packages built with clang and -flto appear to have unusable static
libraries as the object files are LLVM bitcode. Perhaps GCC can link
these archives with -Wl,-plugin,LLVMgold.so but this is not a solution
for official packages.

tl;dr: If a package in the "LTO fat objects" todo is compiled with
clang, it'll need to have LTO disabled with options=('!lto'), unless a
better solution is found.

More information about the arch-dev-public mailing list