[clang] Fix Strong VTables Accidentally Emitted by #159856 (PR #200942)

Patrick Simmons via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 12 09:21:08 PDT 2026


================
@@ -1849,6 +1849,9 @@ void CGOpenMPRuntime::emitAndRegisterVTable(CodeGenModule &CGM,
       CGM.EmitVTable(CXXRecord);
       CodeGenVTables VTables = CGM.getVTables();
       llvm::GlobalVariable *VTablesAddr = VTables.GetAddrOfVTable(CXXRecord);
+      // Must set VTables to weak since we're emitting them in multiple TUs now
+      if (VTablesAddr->hasExternalLinkage())
+        VTablesAddr->setLinkage(llvm::GlobalValue::WeakODRLinkage);
----------------
linuxrocks123 wrote:

Moved after assertion (will push soon).  From `CodeGenModule::getVTableLinkage`, it looks like WeakODRLinkage is the correct linkage type to use for VTables that can't be discarded.

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


More information about the cfe-commits mailing list