diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-04-29 22:27:16 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-04-29 22:27:16 +0000 |
commit | 96a77693be7cfc87208840b2a367362104c43a6b (patch) | |
tree | 7d6ffa862b2d5e6eb4bc135c60e21f970851b9b8 /clang/test/CodeGenCXX/tls-init-funcs.cpp | |
parent | 3e1758c045a440704f70df23acebb08b3036cf45 (diff) | |
download | bcm5719-llvm-96a77693be7cfc87208840b2a367362104c43a6b.tar.gz bcm5719-llvm-96a77693be7cfc87208840b2a367362104c43a6b.zip |
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>
llvm-svn: 180739
Diffstat (limited to 'clang/test/CodeGenCXX/tls-init-funcs.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/tls-init-funcs.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/tls-init-funcs.cpp b/clang/test/CodeGenCXX/tls-init-funcs.cpp new file mode 100644 index 00000000000..79b0ea43191 --- /dev/null +++ b/clang/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 |