diff options
author | Eric Christopher <echristo@apple.com> | 2010-05-22 00:10:22 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2010-05-22 00:10:22 +0000 |
commit | 8116ca5134b355b897450f9a537c9c77e1f08723 (patch) | |
tree | c5f9fa283fdd0558bd3c75c4297602619de8969d /lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | 65eb482e8fcd6084d83793aeb767ef0bddefc92a (diff) | |
download | external_llvm-8116ca5134b355b897450f9a537c9c77e1f08723.zip external_llvm-8116ca5134b355b897450f9a537c9c77e1f08723.tar.gz external_llvm-8116ca5134b355b897450f9a537c9c77e1f08723.tar.bz2 |
Add full bss data support for darwin tls variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104414 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 50a5075..d0b48b0 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -314,7 +314,32 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { // Handle the tbss directive on darwin which is a thread local bss directive // like zerofill. if (GVKind.isThreadBSS() && MAI->hasMachoTBSSDirective()) { - OutStreamer.EmitTBSSSymbol(TheSection, GVSym, Size, 1 << AlignLog); + // Emit the .tbss symbol + MCSymbol *MangSym = + OutContext.GetOrCreateSymbol(GVSym->getName() + Twine("$tlv$init")); + OutStreamer.EmitTBSSSymbol(TheSection, MangSym, Size, 1 << AlignLog); + OutStreamer.AddBlankLine(); + + // Emit the variable struct for the runtime. + const MCSection *TLVSect + = getObjFileLowering().getTLSExtraDataSection(); + + OutStreamer.SwitchSection(TLVSect); + // Emit the linkage here. + EmitLinkage(GV->getLinkage(), GVSym); + OutStreamer.EmitLabel(GVSym); + + // Three pointers in size: + // - __tlv_bootstrap - used to make sure support exists + // - spare pointer, used when mapped by the runtime + // - pointer to mangled symbol above with initializer + unsigned PtrSize = TD->getPointerSizeInBits()/8; + OutStreamer.EmitSymbolValue(GetExternalSymbolSymbol("__tlv_bootstrap"), + PtrSize, 0); + OutStreamer.EmitIntValue(0, PtrSize, 0); + OutStreamer.EmitSymbolValue(MangSym, PtrSize, 0); + + OutStreamer.AddBlankLine(); return; } |