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 f57f6426e0acadf5c10297ceba9d085702dcfe14..e5f82825629c7f94646fb692623f09651a0eafed 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 bd7d0e5324a3cfd01866548b21ffa0548765d81f..50a50750e8bf0b27cda11f2190ee7730d43a445b 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 2b23994637031bd6ef8c857e5db2231e5884345c..a275be2c53c5fa8026b5b3b0edb09d8ee83591ba 100644 (file)
@@ -21,6 +21,7 @@ using namespace llvm;
 MCAsmInfo::MCAsmInfo() {
   HasSubsectionsViaSymbols = false;
   HasMachoZeroFillDirective = false;
+  HasMachoTBSSDirective = false;
   HasStaticCtorDtorReferenceInStaticMode = false;
   MaxInstLength = 4;
   PCSymbol = "$";
index 3c31caa5aca8170b5193f56e9b6c65abfc3d8547..0bd3b2d001e8c5cddbafdc8621605b3f3119d67f 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;