OSDN Git Service

Partial code for emitting thread local bss data.
authorEric Christopher <echristo@apple.com>
Thu, 20 May 2010 00:49:07 +0000 (00:49 +0000)
committerEric Christopher <echristo@apple.com>
Thu, 20 May 2010 00:49:07 +0000 (00:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104197 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCAsmInfo.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/MC/MCAsmInfo.cpp
lib/MC/MCAsmInfoDarwin.cpp

index f57f642..e5f8282 100644 (file)
@@ -303,6 +303,7 @@ namespace llvm {
     // Accessors.
     //
     bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; }
+    bool hasMachoTBSSDirective() const { return HasMachoTBSSDirective; }
     bool hasStaticCtorDtorReferenceInStaticMode() const {
       return HasStaticCtorDtorReferenceInStaticMode;
     }
index bd7d0e5..50a5075 100644 (file)
@@ -310,6 +310,13 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
     OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog);
     return;
   }
+  
+  // 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);
+    return;
+  }
 
   OutStreamer.SwitchSection(TheSection);
 
index 2b23994..a275be2 100644 (file)
@@ -21,6 +21,7 @@ using namespace llvm;
 MCAsmInfo::MCAsmInfo() {
   HasSubsectionsViaSymbols = false;
   HasMachoZeroFillDirective = false;
+  HasMachoTBSSDirective = false;
   HasStaticCtorDtorReferenceInStaticMode = false;
   MaxInstLength = 4;
   PCSymbol = "$";
index 3c31caa..0bd3b2d 100644 (file)
@@ -35,6 +35,7 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
   WeakRefDirective = "\t.weak_reference ";
   ZeroDirective = "\t.space\t";  // ".space N" emits N zeros.
   HasMachoZeroFillDirective = true;  // Uses .zerofill
+  HasMachoTBSSDirective = true; // Uses .tbss
   HasStaticCtorDtorReferenceInStaticMode = true;
   
   HiddenVisibilityAttr = MCSA_PrivateExtern;