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/lib/CodeGen/CodeGenModule.h | |
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/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 0f4fe8ae51b..ca30096dcb8 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -293,6 +293,10 @@ class CodeGenModule : public CodeGenTypeCache { /// priorities to be emitted when the translation unit is complete. CtorList GlobalDtors; + /// TLSInitFuncs - Store the list of TLS initialization functions toe be + /// emitted with the translation unit is complete. + std::vector<llvm::Constant*> TLSInitFuncs; + /// MangledDeclNames - A map of canonical GlobalDecls to their mangled names. llvm::DenseMap<GlobalDecl, StringRef> MangledDeclNames; llvm::BumpPtrAllocator MangledNamesAllocator; @@ -1053,11 +1057,18 @@ private: void AddGlobalCtor(llvm::Function *Ctor, int Priority=65535); void AddGlobalDtor(llvm::Function *Dtor, int Priority=65535); + void AddTLSInitFunc(llvm::Function *Init); + /// EmitCtorList - Generates a global array of functions and priorities using /// the given list and name. This array will have appending linkage and is /// suitable for use as a LLVM constructor or destructor array. void EmitCtorList(const CtorList &Fns, const char *GlobalName); + /// EmitTLSList - Generates a global array of functions with the name + /// `llvm.tls_init_funcs'. This array will have appending linkage and is meant + /// to hold initialization functions for TLS variables. + void EmitTLSList(ArrayRef<llvm::Constant*> Fns); + /// EmitFundamentalRTTIDescriptor - Emit the RTTI descriptors for the /// given type. void EmitFundamentalRTTIDescriptor(QualType Type); |