diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-04-30 21:34:13 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-04-30 21:34:13 +0000 |
commit | e6c878c0c67972a5f4bb14076f3d71c6b5c15083 (patch) | |
tree | dd12e4bd019d69092fc334bb32b0c433af36b556 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 061f1e21bee0c8fec2dda677958c3c27c5a538e5 (diff) | |
download | llvm-e6c878c0c67972a5f4bb14076f3d71c6b5c15083.zip llvm-e6c878c0c67972a5f4bb14076f3d71c6b5c15083.tar.gz llvm-e6c878c0c67972a5f4bb14076f3d71c6b5c15083.tar.bz2 |
Revert r180739 and r180748: they broke C++11 thread_local on non-Darwin systems and did not do the right thing on Darwin.
Original commit message:
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: 180809
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 6247b15..bf67bd1 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -182,7 +182,6 @@ void CodeGenModule::Release() { AddGlobalCtor(ObjCInitFunction); EmitCtorList(GlobalCtors, "llvm.global_ctors"); EmitCtorList(GlobalDtors, "llvm.global_dtors"); - EmitTLSList(TLSInitFuncs); EmitGlobalAnnotations(); EmitStaticExternCAliases(); EmitLLVMUsed(); @@ -480,12 +479,6 @@ void CodeGenModule::AddGlobalDtor(llvm::Function * Dtor, int Priority) { GlobalDtors.push_back(std::make_pair(Dtor, Priority)); } -/// AddTLSInitFunc - Add a function to the list that will initialize TLS -/// variables before main() runs. -void CodeGenModule::AddTLSInitFunc(llvm::Function *Init) { - TLSInitFuncs.push_back(Init); -} - void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) { // Ctor function type is void()*. llvm::FunctionType* CtorFTy = llvm::FunctionType::get(VoidTy, false); @@ -514,25 +507,6 @@ void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) { } } -void CodeGenModule::EmitTLSList(ArrayRef<llvm::Constant*> Fns) { - if (Fns.empty()) return; - - // TLS init function types are void()*. - llvm::FunctionType* TLSFTy = llvm::FunctionType::get(VoidTy, false); - llvm::Type *TLSPFTy = llvm::PointerType::getUnqual(TLSFTy); - - SmallVector<llvm::Constant*, 8> Inits; - for (ArrayRef<llvm::Constant*>::iterator I = Fns.begin(), - E = Fns.end(); I != E; ++I) - Inits.push_back(llvm::ConstantExpr::getBitCast(*I, TLSPFTy)); - - llvm::ArrayType *AT = llvm::ArrayType::get(TLSPFTy, Inits.size()); - new llvm::GlobalVariable(TheModule, AT, false, - llvm::GlobalValue::AppendingLinkage, - llvm::ConstantArray::get(AT, Inits), - "llvm.tls_init_funcs"); -} - llvm::GlobalValue::LinkageTypes CodeGenModule::getFunctionLinkage(const FunctionDecl *D) { GVALinkage Linkage = getContext().GetGVALinkageForFunction(D); |