[WebAssembly] Don't generate empty type sections.

Differential Revision: https://reviews.llvm.org/D61991

llvm-svn: 360940
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index fedaa54..8460f85 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -234,6 +234,8 @@
 }
 
 void Writer::createTypeSection() {
+  if (!Types.size())
+    return;
   SyntheticSection *Section = createSyntheticSection(WASM_SEC_TYPE);
   raw_ostream &OS = Section->getStream();
   writeUleb128(OS, Types.size(), "type count");