diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-05-16 20:39:27 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-05-16 20:39:27 +0000 |
commit | 1ce308866915c9eab78486066d28d2107b7fede2 (patch) | |
tree | 9de4e45b4a8b60edb08ccdb8d31577d12b38c2e9 /test/Linker/global_ctors.ll | |
parent | dedd6203ad632d99de7648c43e482af8476ba6ed (diff) |
Add comdat key field to llvm.global_ctors and llvm.global_dtors
This allows us to put dynamic initializers for weak data into the same
comdat group as the data being initialized. This is necessary for MSVC
ABI compatibility. Once we have comdats for guard variables, we can use
the combination to help GlobalOpt fire more often for weak data with
guarded initialization on other platforms.
Reviewers: nlewycky
Differential Revision: http://reviews.llvm.org/D3499
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209015 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Linker/global_ctors.ll')
-rw-r--r-- | test/Linker/global_ctors.ll | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Linker/global_ctors.ll b/test/Linker/global_ctors.ll new file mode 100644 index 00000000000..541f0d4f91b --- /dev/null +++ b/test/Linker/global_ctors.ll @@ -0,0 +1,29 @@ +; RUN: llvm-as %s -o %t.new.bc +; RUN: llvm-link %t.new.bc %S/Inputs/old_global_ctors.3.4.bc | llvm-dis | FileCheck %s + +; old_global_ctors.3.4.bc contains the following LLVM IL, assembled into +; bitcode by llvm-as from 3.4. It uses a two element @llvm.global_ctors array. +; --- +; declare void @a_global_ctor() +; declare void @b_global_ctor() +; +; @llvm.global_ctors = appending global [2 x { i32, void ()* } ] [ +; { i32, void ()* } { i32 65535, void ()* @a_global_ctor }, +; { i32, void ()* } { i32 65535, void ()* @b_global_ctor } +; ] +; --- + +declare void @c_global_ctor() +declare void @d_global_ctor() + +@llvm.global_ctors = appending global [2 x { i32, void ()*, i8* } ] [ + { i32, void ()*, i8* } { i32 65535, void ()* @c_global_ctor, i8* null }, + { i32, void ()*, i8* } { i32 65535, void ()* @d_global_ctor, i8* null } +] + +; CHECK: @llvm.global_ctors = appending global [4 x { i32, void ()*, i8* }] [ +; CHECK-DAG: { i32, void ()*, i8* } { i32 65535, void ()* @a_global_ctor, i8* null } +; CHECK-DAG: { i32, void ()*, i8* } { i32 65535, void ()* @b_global_ctor, i8* null } +; CHECK-DAG: { i32, void ()*, i8* } { i32 65535, void ()* @c_global_ctor, i8* null } +; CHECK-DAG: { i32, void ()*, i8* } { i32 65535, void ()* @d_global_ctor, i8* null } +; CHECK: ] |