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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Sat Jul 4 08:42:08 PDT 2015


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
>



More information about the cfe-commits mailing list