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.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/tools/yaml2obj/yaml2wasm.cpp b/llvm/tools/yaml2obj/yaml2wasm.cpp
index fcbcb8a40d5..322ac0117ba 100644
--- a/llvm/tools/yaml2obj/yaml2wasm.cpp
+++ b/llvm/tools/yaml2obj/yaml2wasm.cpp
@@ -49,6 +49,8 @@ private:
int writeSectionContent(raw_ostream &OS, WasmYAML::NameSection &Section);
int writeSectionContent(raw_ostream &OS, WasmYAML::LinkingSection &Section);
int writeSectionContent(raw_ostream &OS, WasmYAML::ProducersSection &Section);
+ int writeSectionContent(raw_ostream &OS,
+ WasmYAML::TargetFeaturesSection &Section);
WasmYAML::Object &Obj;
uint32_t NumImportedFunctions = 0;
uint32_t NumImportedGlobals = 0;
@@ -280,6 +282,17 @@ int WasmWriter::writeSectionContent(raw_ostream &OS,
}
int WasmWriter::writeSectionContent(raw_ostream &OS,
+ WasmYAML::TargetFeaturesSection &Section) {
+ writeStringRef(Section.Name, OS);
+ encodeULEB128(Section.Features.size(), OS);
+ for (auto &E : Section.Features) {
+ writeUint8(OS, E.Prefix);
+ writeStringRef(E.Name, OS);
+ }
+ return 0;
+}
+
+int WasmWriter::writeSectionContent(raw_ostream &OS,
WasmYAML::CustomSection &Section) {
if (auto S = dyn_cast<WasmYAML::DylinkSection>(&Section)) {
if (auto Err = writeSectionContent(OS, *S))
@@ -293,6 +306,9 @@ int WasmWriter::writeSectionContent(raw_ostream &OS,
} else if (auto S = dyn_cast<WasmYAML::ProducersSection>(&Section)) {
if (auto Err = writeSectionContent(OS, *S))
return Err;
+ } else if (auto S = dyn_cast<WasmYAML::TargetFeaturesSection>(&Section)) {
+ if (auto Err = writeSectionContent(OS, *S))
+ return Err;
} else {
writeStringRef(Section.Name, OS);
Section.Payload.writeAsBinary(OS);
OpenPOWER on IntegriCloud