[lld] [lld][COFF] Remove duplicate strtab entries (PR #141197)

Haohai Wen via llvm-commits llvm-commits at lists.llvm.org
Fri May 23 00:20:18 PDT 2025


HaohaiWen wrote:

> Instead of just using `std::map` to deduplicate whole strings, it's also possible to use the `StringTableBuilder` class for deduplicating and doing tail merging of strings - optimizing the string table even further (at the cost of a little longer link time).
> 
> This was attempted before in [9ffeaaa](https://github.com/llvm/llvm-project/commit/9ffeaaa0ea54307db309104696a0b6cce6ddda38), but I had to revert it in [4d2eda2](https://github.com/llvm/llvm-project/commit/4d2eda2bb3156cee63ea486be34b01164b178e10); see the revert commit for an explanation of the issues I ran into, including a suggestion on what one could do to reapply it.
> 
> Anyway, using a `std::map` probably is lower overhead than using `StringTableBuilder`, and it keeps the strings in their current order (i.e. the early section names don't end up too far back in the string table).
> 
> Do you have any numbers on how much binary size you save with this? It could be interesting to compare with the `StringTableBuilder` case.

Thanks for reminding.
The blender binary size has been reduced about 300MB. There are many duplicate symbol name.

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


More information about the llvm-commits mailing list