summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Writer.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-05-16 21:22:43 +0000
committerSam Clegg <sbc@chromium.org>2019-05-16 21:22:43 +0000
commit1a53ff2a13fd0045ee3bf23d84608153864b4567 (patch)
tree96ea0b526eb4c421184fecfe724a4744cba938f9 /lld/wasm/Writer.cpp
parent9adabefdcee693e69f38e10c41c67b80ff06c669 (diff)
downloadbcm5719-llvm-1a53ff2a13fd0045ee3bf23d84608153864b4567.tar.gz
bcm5719-llvm-1a53ff2a13fd0045ee3bf23d84608153864b4567.zip
[WebAssembly] Don't generate empty type sections.
Differential Revision: https://reviews.llvm.org/D61991 llvm-svn: 360940
Diffstat (limited to 'lld/wasm/Writer.cpp')
-rw-r--r--lld/wasm/Writer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index fedaa54ce19..8460f8575c8 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -234,6 +234,8 @@ void Writer::createImportSection() {
}
void Writer::createTypeSection() {
+ if (!Types.size())
+ return;
SyntheticSection *Section = createSyntheticSection(WASM_SEC_TYPE);
raw_ostream &OS = Section->getStream();
writeUleb128(OS, Types.size(), "type count");
OpenPOWER on IntegriCloud