lgtm
================
Comment at: lib/CodeGen/CGDeclCXX.cpp:335
@@ -334,1 +334,3 @@
DelayedCXXInitPosition.erase(D);
+ } else if (D->hasAttr<SelectAnyAttr>()) {
+ // SelectAny globals will be comdat-folded. Put the initializer into a
COMDAT
----------------
hans wrote:
> rnk wrote:
> > Should we do the same for WeakAttr? What does GCC do?
> >
> > I wonder if there is a more general GVA linkage check we should do. Can you
> > add a test for static data members of implicitly instantiated dllexport
> > class templates?
> Yes, doing the same for WeakAttr sounds reasonable.
>
> I couldn't observe gcc doing anything special for dynamic initializers of
> weak objects :/
>
> We do get this right for static data members of implicitly instantiated class
> templates; it's handled by your code above, and dllexport doesn't change it.
> I can add a test.
>
> If we want to base this on GVA linkage, it seems to me that the associative
> comdat method should be applied to all symbols that can be merged, so
> GVA_StrongODR and GVA_DiscardableODR? But I don't think SelectAny or WeakAttr
> are reflected in the gva linkage.
I *think* selectany and templates are the only ways to get COMDAT data with
dynamic initialization, so we should be OK with what we have then.
http://reviews.llvm.org/D5281
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits