[clang] [clang-repl] fix vtable symbol duplication error (closes #141039) (PR #185648)
Emery Conrad via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 14 13:02:20 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);
----------------
conrade-ctc wrote:
yup, we can make it abi independent, just pushed the commit. this leaves the ItaniumCXXABI out of it, good catch.
https://github.com/llvm/llvm-project/pull/185648
More information about the cfe-commits
mailing list