[clang] [CodeGen] [VTable] don't think linkonce vtable as unique (PR #197855)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Fri May 15 20:31:10 PDT 2026
ojhunt wrote:
> > Generally for linkonce_odr defs we convert one copy (the one identified by the linker as prevailing) to weak_odr so that it is kept, and the rest to available_externally so that they are dropped after inlining.
> > The case referenced in the earlier comment kicks in which should only happen in very limited situations: there is a single copy. I see in the linked bug that this is a shared library, so there is a single copy, but I would have thought that the earlier analysis in LTO that feeds into the IsExported callback would indicate this as exported based on the info we get from the linker. I'll need to look at what is happening there, I should have time for a quick look today.
>
> @pcc pointed out a couple of existing tests that are adding unnamed_addr to vtable symbols, which by the existing comment and my (non-linking expert) reading of the itanium spec might be wrong (because it means there is more than one symbol for a single vtable)?
Oh indeed all of the vtables are labeled as unused_addr - if that allows them to be duplicated that seems like it might be an error?
https://github.com/llvm/llvm-project/pull/197855
More information about the cfe-commits
mailing list