stop using the .lcomm pseudoop on darwin, instead, directly use the
.zerofill directive. Streamerize its generation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93868 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 411a0f0..fbbcc27 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -171,21 +171,34 @@
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
- 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;
}
+
+ // 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;
+ O << '\n';
+ return;
+ }
+
+ // .local _foo
+ O << "\t.local\t" << *GVSym << '\n';
+ // .comm _foo, 42, 4
+ OutStreamer.EmitCommonSymbol(GVSym, Size, 1 << AlignLog);
return;
}