summaryrefslogtreecommitdiff
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.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/tools/yaml2obj/yaml2wasm.cpp b/llvm/tools/yaml2obj/yaml2wasm.cpp
index 4a9269d96a1..0809cc458ac 100644
--- a/llvm/tools/yaml2obj/yaml2wasm.cpp
+++ b/llvm/tools/yaml2obj/yaml2wasm.cpp
@@ -45,6 +45,7 @@ private:
int writeSectionContent(raw_ostream &OS, WasmYAML::DataSection &Section);
// Custom section types
+ int writeSectionContent(raw_ostream &OS, WasmYAML::DylinkSection &Section);
int writeSectionContent(raw_ostream &OS, WasmYAML::NameSection &Section);
int writeSectionContent(raw_ostream &OS, WasmYAML::LinkingSection &Section);
WasmYAML::Object &Obj;
@@ -133,6 +134,16 @@ public:
};
int WasmWriter::writeSectionContent(raw_ostream &OS,
+ WasmYAML::DylinkSection &Section) {
+ writeStringRef(Section.Name, OS);
+ encodeULEB128(Section.MemorySize, OS);
+ encodeULEB128(Section.MemoryAlignment, OS);
+ encodeULEB128(Section.TableSize, OS);
+ encodeULEB128(Section.TableAlignment, OS);
+ return 0;
+}
+
+int WasmWriter::writeSectionContent(raw_ostream &OS,
WasmYAML::LinkingSection &Section) {
writeStringRef(Section.Name, OS);
encodeULEB128(Section.Version, OS);
@@ -241,7 +252,10 @@ int WasmWriter::writeSectionContent(raw_ostream &OS,
int WasmWriter::writeSectionContent(raw_ostream &OS,
WasmYAML::CustomSection &Section) {
- if (auto S = dyn_cast<WasmYAML::NameSection>(&Section)) {
+ if (auto S = dyn_cast<WasmYAML::DylinkSection>(&Section)) {
+ if (auto Err = writeSectionContent(OS, *S))
+ return Err;
+ } else if (auto S = dyn_cast<WasmYAML::NameSection>(&Section)) {
if (auto Err = writeSectionContent(OS, *S))
return Err;
} else if (auto S = dyn_cast<WasmYAML::LinkingSection>(&Section)) {