CodeGen: Don't emit a thread-wrapper if we can't touch the backing variable
authorDavid Majnemer <david.majnemer@gmail.com>
Fri, 11 Jul 2014 20:28:10 +0000 (20:28 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Fri, 11 Jul 2014 20:28:10 +0000 (20:28 +0000)
commit9b21c33da44985b59e637ee3a235ad1fb3472c60
tree42666061684dd195d1b58270fd21a276fc9288ff
parent83510e70a9fd0bd2bbe474f510e037937dd6abc7
CodeGen: Don't emit a thread-wrapper if we can't touch the backing variable

OS X TLS has all accesses going through the thread-wrapper function and
gives the backing thread-local variable internal linkage.  This means
that thread-wrappers must have WeakAnyLinkage so that references to the
internal thread-local variables do not get propagated to other code.

It also means that translation units which do not provide a definition
for the thread-local variable cannot attempt to emit a thread-wrapper
because the thread wrapper will attempt to reference the backing
variable.

Differential Revision: http://reviews.llvm.org/D4109

llvm-svn: 212841
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/test/CodeGenCXX/tls-init-funcs.cpp