[clang] [clang] Do not emit template parameter objects as COMDATs when they have internal linkage. (PR #125448)
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 2 19:04:27 PST 2025
================
@@ -3765,7 +3765,7 @@ ConstantAddress CodeGenModule::GetAddrOfTemplateParamObject(
auto *GV = new llvm::GlobalVariable(getModule(), Init->getType(),
/*isConstant=*/true, Linkage, Init, Name);
setGVProperties(GV, TPO);
- if (supportsCOMDAT())
+ if (supportsCOMDAT() && Linkage == llvm::GlobalValue::LinkOnceODRLinkage)
----------------
MaskRay wrote:
I recall that in some cases WeakODRLinkage is used. Should the condition be something like `!isLocalLinkage()`?
https://github.com/llvm/llvm-project/pull/125448
More information about the cfe-commits
mailing list