summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2wasm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/yaml2obj/yaml2wasm.cpp')
-rw-r--r--llvm/tools/yaml2obj/yaml2wasm.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/tools/yaml2obj/yaml2wasm.cpp b/llvm/tools/yaml2obj/yaml2wasm.cpp
index 322ac0117ba..cd07a30b748 100644
--- a/llvm/tools/yaml2obj/yaml2wasm.cpp
+++ b/llvm/tools/yaml2obj/yaml2wasm.cpp
@@ -43,6 +43,7 @@ private:
int writeSectionContent(raw_ostream &OS, WasmYAML::ElemSection &Section);
int writeSectionContent(raw_ostream &OS, WasmYAML::CodeSection &Section);
int writeSectionContent(raw_ostream &OS, WasmYAML::DataSection &Section);
+ int writeSectionContent(raw_ostream &OS, WasmYAML::DataCountSection &Section);
// Custom section types
int writeSectionContent(raw_ostream &OS, WasmYAML::DylinkSection &Section);
@@ -514,6 +515,12 @@ int WasmWriter::writeSectionContent(raw_ostream &OS,
return 0;
}
+int WasmWriter::writeSectionContent(raw_ostream &OS,
+ WasmYAML::DataCountSection &Section) {
+ encodeULEB128(Section.Count, OS);
+ return 0;
+}
+
int WasmWriter::writeRelocSection(raw_ostream &OS, WasmYAML::Section &Sec,
uint32_t SectionIndex) {
switch (Sec.Type) {
@@ -614,6 +621,9 @@ int WasmWriter::writeWasm(raw_ostream &OS) {
} else if (auto S = dyn_cast<WasmYAML::DataSection>(Sec.get())) {
if (auto Err = writeSectionContent(StringStream, *S))
return Err;
+ } else if (auto S = dyn_cast<WasmYAML::DataCountSection>(Sec.get())) {
+ if (auto Err = writeSectionContent(StringStream, *S))
+ return Err;
} else {
errs() << "Unknown section type: " << Sec->Type << "\n";
return 1;
OpenPOWER on IntegriCloud