[llvm] Add 'unifiedlto' option to gold plugin (PR #121336)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 30 15:12:44 PST 2024


eleviant wrote:

> @ormris can you take a look? In particular, I'm confused at how this gets enabled via lld. It appears there isn't a separate unified LTO option there, and the mode is set unconditionally to UnifiedThin or UnifiedRegular based on the `-flto=` option:
> 
> https://github.com/llvm/llvm-project/blob/c7d237085bf9102ecf0c9105d8cc7fd94b752a3a/lld/ELF/Driver.cpp#L1651-L1662
> 
> .
> But then it looks like in the LTO code we will give an error if modules weren't built with -funified-lto:
> 
> https://github.com/llvm/llvm-project/blob/c7d237085bf9102ecf0c9105d8cc7fd94b752a3a/llvm/lib/LTO/LTO.cpp#L768-L773
> 
> I can't recall how this is this supposed to work?

I think this shouldn't work. The only reason we don't really observe the issue is that clang is not passing --lto option to the linker. So lld is also "thinlto only" with -funified-lto.

https://github.com/llvm/llvm-project/pull/121336


More information about the llvm-commits mailing list