aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-04-29 22:27:16 +0000
committerBill Wendling <isanbard@gmail.com>2013-04-29 22:27:16 +0000
commit7c6b7ba5f5410d4b552ee53c60d0690522c99959 (patch)
treec45ba694fd5902138b6f7b76d9665327513b6373 /test/CodeGenCXX
parentd237d2e6b85a74f31c986dc585fa6c39733b74a2 (diff)
Emit the TLS intialization functions into a list.
Add the TLS initialization functions to a list of initialization functions. The back-end takes this list and places the function pointers into the correct section. This way they're called before `main().' <rdar://problem/13733006> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX')
-rw-r--r--test/CodeGenCXX/tls-init-funcs.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGenCXX/tls-init-funcs.cpp b/test/CodeGenCXX/tls-init-funcs.cpp
new file mode 100644
index 0000000000..79b0ea4319
--- /dev/null
+++ b/test/CodeGenCXX/tls-init-funcs.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -std=c++11 -S -emit-llvm %s -o - | FileCheck -check-prefix=BITCODE %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -std=c++11 -S %s -o - | FileCheck -check-prefix=ASM %s
+
+// BITCODE: @llvm.tls_init_funcs = appending global [1 x void ()*] [void ()* @__tls_init]
+
+struct A {
+ A();
+};
+
+struct B {
+ int i;
+ B(int i);
+};
+
+thread_local int i = 37;
+thread_local A a;
+thread_local B b(927);
+
+// ASM: .section __DATA,__thread_init,thread_local_init_function_pointers
+// ASM: .align 3
+// ASM: .quad ___tls_init