[PATCH] D10942: CodeGen: Test that we do not assign a comdat to available_externally globals.

Peter Collingbourne peter at pcc.me.uk
Sat Jul 4 15:33:45 PDT 2015


Makes sense. I've sent out http://reviews.llvm.org/D10945 which I also verified
by building Chromium on Windows with a release+asserts Clang with this applied.

Peter

On Sat, Jul 04, 2015 at 11:42:08AM -0400, Rafael EspĂ­ndola wrote:
> should we ban comdats in available_externally decls in the verifier?
> 
> On 3 July 2015 at 23:46, Peter Collingbourne <peter at pcc.me.uk> wrote:
> > pcc created this revision.
> > pcc added a reviewer: majnemer.
> > pcc added a subscriber: cfe-commits.
> >
> > From the linker's perspective, an available_externally global is equivalent to
> > an external declaration, therefore it should not have a comdat. The presence
> > of a comdat can cause problems later on during LTO if a comdat containing
> > an available_externally global is chosen over a comdat containing a real
> > definition of the global.
> >
> > Depends on http://reviews.llvm.org/D10941
> >
> > http://reviews.llvm.org/D10942
> >
> > Files:
> >   test/CodeGenCXX/microsoft-abi-static-initializers-available-externally.cpp
> >
> > Index: test/CodeGenCXX/microsoft-abi-static-initializers-available-externally.cpp
> > ===================================================================
> > --- /dev/null
> > +++ test/CodeGenCXX/microsoft-abi-static-initializers-available-externally.cpp
> > @@ -0,0 +1,13 @@
> > +// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -std=c++11 -emit-llvm -O %s -o - | FileCheck %s
> > +
> > +// CHECK: = available_externally
> > +// CHECK-NOT: comdat
> > +
> > +template <typename>
> > +class A {
> > +public:
> > +  static void f() { static int a = *new int; }
> > +};
> > +
> > +extern template class A<int>;
> > +void f() { A<int>::f(); }
> >
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
> 

-- 
Peter




More information about the cfe-commits mailing list