[PATCH] D61991: [WebAssembly] Don't generate empty type section.

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 22:35:17 PDT 2019


sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61991

Files:
  lld/test/wasm/section-symbol-relocs.yaml
  lld/wasm/Writer.cpp


Index: lld/wasm/Writer.cpp
===================================================================
--- lld/wasm/Writer.cpp
+++ 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");
Index: lld/test/wasm/section-symbol-relocs.yaml
===================================================================
--- lld/test/wasm/section-symbol-relocs.yaml
+++ lld/test/wasm/section-symbol-relocs.yaml
@@ -49,3 +49,13 @@
 # RELOC-NEXT:         Offset:          0x0000000B
 # RELOC-NEXT:         Addend:          3
 # RELOC-NEXT:    Name:            green
+#
+# RELOC:        SymbolTable:
+# RELOC-NEXT:     - Index:           0
+# RELOC-NEXT:       Kind:            SECTION
+# RELOC-NEXT:       Flags:           [ BINDING_LOCAL ]
+# RELOC-NEXT:       Section:         2
+# RELOC-NEXT:     - Index:           1
+# RELOC-NEXT:       Kind:            SECTION
+# RELOC-NEXT:       Flags:           [ BINDING_LOCAL ]
+# RELOC-NEXT:       Section:         3


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61991.199748.patch
Type: text/x-patch
Size: 1157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190516/0ca1b12a/attachment.bin>


More information about the llvm-commits mailing list