[lld] [llvm] [LTO] Move section names from symbol table to module summary. (PR #210856)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 15:47:35 PDT 2026


teresajohnson wrote:

> The initial version of LTO with linker scripts (#204282) has some relatively complicated changes that make internal/private symbols visible to the linker. And it doesn't have support for ThinLTO. This patch is basically the result of trying to solve those issues: implementing the framework for how the linker and LTO interact, and using it to reimplement the existing start/end handling.
> 
> Moving where we store the input section information seemed cleaner, to keep everything together. That's technically not required: we could keep the input section information in the symbol table. And then to solve the related issues, we could either go back to exposing internal/private symbols to the linker, or do the processing for internal symbols inside ThinLTO.
> 
> For ThinLTO, we do need some place to store the "output section" information, though, and the summary is the obvious place for that. I'm not sure how else to structure that.
> 
> I haven't really measured the overhead here, but I expect the effect is small in the vast majority of cases: most symbols don't have a section specified, and none of the new code runs if we don't have section information. The code is structured for that result.

I tried a large internal application. We do have section names for ~5% unique symbols out of all unique symbols in the combined index. But we don't use linker scripts to do anything that requires LTO handling and assignment of the output section. My concern is adding overhead to the single monolithic portion of a ThinLTO build, especially for cases that don't need it there.

Is there a way to only add this overhead in the case of the symbols that need LTO handling?

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


More information about the llvm-commits mailing list