diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-05-02 19:18:03 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-05-02 19:18:03 +0000 |
commit | 95cae88bcfebe11db2f217de47462a749f4eb123 (patch) | |
tree | cf40ef2e89e26b4f5913e6df43182c90b0667076 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | aa05f9eaf3db4c3d7251a1277691753c1fc68558 (diff) | |
download | bcm5719-llvm-95cae88bcfebe11db2f217de47462a749f4eb123.tar.gz bcm5719-llvm-95cae88bcfebe11db2f217de47462a749f4eb123.zip |
Use the Itanium ABI for thread_local on Darwin.
After some discussion, it was decided to use the Itanium ABI for thread_local on
Darwin OS X platforms. This involved a couple of changes. First, we use
"_tlv_atexit" instead of "__cxa_thread_atexit". Secondly, the global variables
are marked with 'internal' linkage, because we want all access to be calls to
the Itanium-specific entry point, which has normal linkage.
<rdar://problem/13733006>
llvm-svn: 180941
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index bf67bd1007a..66c3983a4b4 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1916,7 +1916,13 @@ CodeGenModule::GetLLVMLinkageVarDefinition(const VarDecl *D, !D->getAttr<WeakImportAttr>()) { // Thread local vars aren't considered common linkage. return llvm::GlobalVariable::CommonLinkage; - } + } else if (D->getTLSKind() == VarDecl::TLS_Dynamic && + getTarget().getTriple().isMacOSX()) + // On Darwin, the backing variable for a C++11 thread_local variable always + // has internal linkage; all accesses should just be calls to the + // Itanium-specified entry point, which has the normal linkage of the + // variable. + return llvm::GlobalValue::InternalLinkage; return llvm::GlobalVariable::ExternalLinkage; } |