[lld] [ELF] Respect ltoCanOmit for symbols in non-prevailing COMDAT (PR #119332)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 11:29:35 PST 2024


MaskRay wrote:

Thanks for taking a look. Yes, this is complex...

--export-dynamic and -shared links exported all definitions, even linkonce_odr ones.
4d480ed5451e9af88e84bcf8be62f8befa915bed (2016) introduced a mechanism to internalize certain linkonce_odr symbols
`(unnamed_addr linkonce_odr GlobalValue || local_unnamed_addr linkonce_odr (constant GlobalVariable || Function))`.
Nowadays this works by making the `VisibleToRegularObj` condition in LTO.cpp false in these linkonce_odr scenarios.

For a symbol in a non-prevailing COMDAT, we can now use `Defined` instead of `Undefined` because of
the previous parallelism work (https://reviews.llvm.org/D120626).

This patch is like the bitcode counterpart of the ObjectFile part of https://reviews.llvm.org/D120626 .


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


More information about the llvm-commits mailing list