[mach-o] Add support for zero-fill sections.

llvm-svn: 208928
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
index 59452fb..ab29f85 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
@@ -74,6 +74,11 @@
   llvm_unreachable("unknown scope value!");
 }
 
+static DefinedAtom::ContentType atomTypeFromSection(const Section &section) {
+  // FIX ME
+  return DefinedAtom::typeCode;
+}
+
 static void processSymbol(const NormalizedFile &normalizedFile, MachOFile &file,
                           const Symbol &sym, bool copyRefs) {
   // Mach-O symbol table does have size in it, so need to scan ahead
@@ -81,8 +86,13 @@
   const Section &section = normalizedFile.sections[sym.sect - 1];
   uint64_t offset = sym.value - section.address;
   uint64_t size = nextSymbolAddress(normalizedFile, sym) - sym.value;
-  ArrayRef<uint8_t> atomContent = section.content.slice(offset, size);
-  file.addDefinedAtom(sym.name, atomContent, atomScope(sym.scope), copyRefs);
+  if (section.type == llvm::MachO::S_ZEROFILL){
+    file.addZeroFillDefinedAtom(sym.name, atomScope(sym.scope), size, copyRefs);
+  } else {
+    ArrayRef<uint8_t> atomContent = section.content.slice(offset, size);
+    file.addDefinedAtom(sym.name, atomScope(sym.scope),
+                        atomTypeFromSection(section), atomContent, copyRefs);
+  }
 }