I think we should have clang omit comdats, it would be confusing to
silently ignore comdats in llvm.

On Tuesday, September 16, 2014, Rafael Espíndola <[email protected]>
wrote:

> Clang can already handle
>
> -------------------------------------------
> struct S {
>   static const int x;
> };
> template<typename T> struct U {
>   static const int k;
> };
> template<typename T> const int U<T>::k = T::x;
>
> #ifdef TU1
> const int S::x = 42;
> extern const int *f();
> const int *g() { return &U<S>::k; }
> int main() {
>   return *f() + U<S>::k;
> }
> #endif
>
> #ifdef TU2
> const int *f() { return &U<S>::k; }
> #endif
> -------------------------------------------
>
> since r217264 which puts the .inint_array section in the same COMDAT
> as the variable.
>
> The attached patch allows the linker to more easily delete some dead
> code and data by putting the guard variable and init function in the
> same COMDAT.
>
> One thing we have to decide is what to do about MachO. Should we omit
> the comdats from the IR for MachO or have llvm ignore it?
>
> Cheers,
> Rafael
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to