stop using the .lcomm pseudoop on darwin, instead, directly use the
[oota-llvm.git] / lib / CodeGen / AsmPrinter / AsmPrinter.cpp
index 411a0f05fcb1e0085ac565c44b84735bf0d3305e..fbbcc27a580a9f61e1810fac16fdfa86afa6b488 100644 (file)
@@ -171,21 +171,34 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
       WriteAsOperand(O, GV, /*PrintType=*/false, GV->getParent());
       O << '\n';
     }
+    
+    // Handle common symbols.
     if (GVKind.isCommon()) {
       // .comm _foo, 42, 4
       OutStreamer.EmitCommonSymbol(GVSym, Size, 1 << AlignLog);
-    } else if (const char *LComm = MAI->getLCOMMDirective()) {
-      // .lcomm _foo, 42, 4
+      return;
+    }
+    
+    // Handle local BSS symbols.
+    if (MAI->hasMachoZeroFillDirective()) {
+      const MCSection *TheSection =
+        getObjFileLowering().SectionForGlobal(GV, GVKind, Mang, TM);
+      // .zerofill __DATA, __bss, _foo, 400, 5
+      OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog);
+      return;
+    }
+    
+    if (const char *LComm = MAI->getLCOMMDirective()) {
+      // .lcomm _foo, 42
       O << LComm << *GVSym << ',' << Size;
-      if (MAI->getLCOMMDirectiveTakesAlignment())
-        O << ',' << AlignLog;
       O << '\n';
-    } else {
-      // .local _foo
-      O << "\t.local\t" << *GVSym << '\n';
-      // .comm _foo, 42, 4
-      OutStreamer.EmitCommonSymbol(GVSym, Size, 1 << AlignLog);
+      return;
     }
+    
+    // .local _foo
+    O << "\t.local\t" << *GVSym << '\n';
+    // .comm _foo, 42, 4
+    OutStreamer.EmitCommonSymbol(GVSym, Size, 1 << AlignLog);
     return;
   }