Can you try the attached patch?
On 12 November 2013 16:12, Rafael Espíndola <[email protected]> wrote:
>> Alternatively, rather than replacing one hack with another hack that may or
>> may not break ABI, why not actually implement comdat support?
>
> The current implementation is not a hack. It brings us back to the one
> function per comdat we used to have. We should implement comdats (in
> my todo list, after pr10367 and mangler), but it is not a strict
> superset.
>
>> I feel like this patch doesn't solve any pressing need, and is causing
>> gratuitous fallout. It may be that the old pattern was a hack, but it was at
>> least a hack that had been well tested in deployment and has caused us no
>> problems so far.
>
> On ELF it is an optimization issue. On COFF we need something along
> these lines since MSVC will only print one destructor if it knows that
> the base and complete ones are identical.
>
> Cheers,
> Rafael
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 0f55616..3ba5dca 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -146,14 +146,14 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl,
/// how aliases work.
if (Ref->isDeclaration())
return true;
-
- // Don't create an alias to a linker weak symbol unless we know we can do
- // that in every TU. This avoids producing different COMDATs in different
- // TUs.
- if (llvm::GlobalValue::isWeakForLinker(TargetLinkage))
- return true;
}
+ // Don't create an alias to a linker weak symbol unless we know we can do
+ // that in every TU. This avoids producing different COMDATs in different
+ // TUs.
+ if (llvm::GlobalValue::isWeakForLinker(TargetLinkage))
+ return true;
+
// Create the alias with no name.
llvm::GlobalAlias *Alias =
new llvm::GlobalAlias(AliasType, Linkage, "", Aliasee, &getModule());
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits