[clang] [clang-repl] fix vtable symbol duplication error (closes #141039) (PR #185648)
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 12 10:40:53 PDT 2026
================
@@ -2097,6 +2097,15 @@ void ItaniumCXXABI::emitVTableDefinitions(CodeGenVTables &CGVT,
// Set the correct linkage.
VTable->setLinkage(Linkage);
+ // Track ExternalLinkage vtable definitions so moveLazyEmissionStates() can
+ // tell the next PTU not to re-emit them. We only do this for ExternalLinkage
+ // because the JIT reliably exports strong symbols cross-module.
+ // WeakODR/LinkOnceODR vtables (e.g. inline key functions, template
+ // instantiations) are not reliably cross-module resolvable in the JIT, so
+ // later PTUs must re-emit their own copy.
+ if (Linkage == llvm::GlobalValue::ExternalLinkage)
+ CGM.markVTableEmitted(RD);
----------------
vgvassilev wrote:
Shouldn’t that happen somewhere higher in the call chain. Eg the caller of this function so that it is Abi-independent?
https://github.com/llvm/llvm-project/pull/185648
More information about the cfe-commits
mailing list