Cleanup handling of .zerofill on darwin:

1. TargetLoweringObjectFileMachO should decide if something
   goes in zerofill instead of having every target do it.
2. TargetLoweringObjectFileMachO should assign said symbols to
   the right MCSection, the asmprinters should just emit to the
   right section.
3. Since all zerofill stuff goes through mcstreamer anymore,
   MAI can have a bool "haszerofill" instead of having the textual
   directive to emit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93838 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index 93cb420..26a181a 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -750,6 +750,9 @@
   ConstDataCoalSection
     = getMachOSection("__DATA","__const_coal", MCSectionMachO::S_COALESCED,
                       SectionKind::getText());
+  DataCommonSection
+    = getMachOSection("__DATA","__common", MCSectionMachO::S_ZEROFILL,
+                      SectionKind::getBSS());
   ConstDataSection  // .const_data
     = getMachOSection("__DATA", "__const", 0,
                       SectionKind::getReadOnlyWithRel());
@@ -915,6 +918,11 @@
   if (Kind.isReadOnlyWithRel())
     return ConstDataSection;
 
+  // Put zero initialized globals with strong external linkage in the
+  // DATA, __common section with the .zerofill directive.
+  if (Kind.isBSS() && GV->hasExternalLinkage())
+    return DataCommonSection;
+  
   // Otherwise, just drop the variable in the normal data section.
   return DataSection;
 }