From 3cfcc94c099140cade96d0d799f017f95eb20bd9 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 17 Jan 2019 00:39:49 +0000 Subject: [PATCH] Revert "[WebAssembly] Parse llvm.ident into producers section" This reverts commit eccdbba3a02a33e13b5262e92200a33e2ead873d. llvm-svn: 351410 --- llvm/include/llvm/BinaryFormat/Wasm.h | 6 --- llvm/include/llvm/Object/Wasm.h | 4 +- llvm/include/llvm/ObjectYAML/WasmYAML.h | 23 --------- llvm/lib/MC/WasmObjectWriter.cpp | 47 +++++++------------ llvm/lib/Object/WasmObjectFile.cpp | 45 ------------------ llvm/lib/ObjectYAML/WasmYAML.cpp | 18 ------- .../WebAssembly/WebAssemblyAsmPrinter.cpp | 30 ------------ .../CodeGen/WebAssembly/custom-sections.ll | 13 ----- llvm/test/MC/WebAssembly/custom-sections.ll | 9 ---- llvm/test/MC/WebAssembly/debug-info.ll | 6 --- .../ObjectYAML/wasm/producers_section.yaml | 29 ------------ .../wasm/producers_section_repeat.yaml | 14 ------ llvm/tools/obj2yaml/wasm2yaml.cpp | 23 --------- llvm/tools/yaml2obj/yaml2wasm.cpp | 27 ----------- 14 files changed, 18 insertions(+), 276 deletions(-) delete mode 100644 llvm/test/ObjectYAML/wasm/producers_section.yaml delete mode 100644 llvm/test/ObjectYAML/wasm/producers_section_repeat.yaml diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h index 05439c608727..d9f0f94b298d 100644 --- a/llvm/include/llvm/BinaryFormat/Wasm.h +++ b/llvm/include/llvm/BinaryFormat/Wasm.h @@ -43,12 +43,6 @@ struct WasmDylinkInfo { std::vector Needed; // Shared library depenedencies }; -struct WasmProducerInfo { - std::vector> Languages; - std::vector> Tools; - std::vector> SDKs; -}; - struct WasmExport { StringRef Name; uint8_t Kind; diff --git a/llvm/include/llvm/Object/Wasm.h b/llvm/include/llvm/Object/Wasm.h index 083fd2e9030d..ed857652a048 100644 --- a/llvm/include/llvm/Object/Wasm.h +++ b/llvm/include/llvm/Object/Wasm.h @@ -130,7 +130,6 @@ public: static bool classof(const Binary *v) { return v->isWasm(); } const wasm::WasmDylinkInfo &dylinkInfo() const { return DylinkInfo; } - const wasm::WasmProducerInfo &getProducerInfo() const { return ProducerInfo; } ArrayRef types() const { return Signatures; } ArrayRef functionTypes() const { return FunctionTypes; } ArrayRef imports() const { return Imports; } @@ -150,6 +149,7 @@ public: uint32_t getNumImportedGlobals() const { return NumImportedGlobals; } uint32_t getNumImportedFunctions() const { return NumImportedFunctions; } uint32_t getNumImportedEvents() const { return NumImportedEvents; } + void moveSymbolNext(DataRefImpl &Symb) const override; uint32_t getSymbolFlags(DataRefImpl Symb) const override; @@ -252,13 +252,11 @@ private: Error parseLinkingSection(ReadContext &Ctx); Error parseLinkingSectionSymtab(ReadContext &Ctx); Error parseLinkingSectionComdat(ReadContext &Ctx); - Error parseProducersSection(ReadContext &Ctx); Error parseRelocSection(StringRef Name, ReadContext &Ctx); wasm::WasmObjectHeader Header; std::vector Sections; wasm::WasmDylinkInfo DylinkInfo; - wasm::WasmProducerInfo ProducerInfo; std::vector Signatures; std::vector FunctionTypes; std::vector Tables; diff --git a/llvm/include/llvm/ObjectYAML/WasmYAML.h b/llvm/include/llvm/ObjectYAML/WasmYAML.h index 1927ff35159e..406dd7cb515f 100644 --- a/llvm/include/llvm/ObjectYAML/WasmYAML.h +++ b/llvm/include/llvm/ObjectYAML/WasmYAML.h @@ -123,11 +123,6 @@ struct NameEntry { StringRef Name; }; -struct ProducerEntry { - std::string Name; - std::string Version; -}; - struct SegmentInfo { uint32_t Index; StringRef Name; @@ -229,19 +224,6 @@ struct LinkingSection : CustomSection { std::vector Comdats; }; -struct ProducersSection : CustomSection { - ProducersSection() : CustomSection("producers") {} - - static bool classof(const Section *S) { - auto C = dyn_cast(S); - return C && C->Name == "producers"; - } - - std::vector Languages; - std::vector Tools; - std::vector SDKs; -}; - struct TypeSection : Section { TypeSection() : Section(wasm::WASM_SEC_TYPE) {} @@ -384,7 +366,6 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Function) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::LocalDecl) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Relocation) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::NameEntry) -LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::ProducerEntry) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SegmentInfo) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SymbolInfo) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::InitFunction) @@ -463,10 +444,6 @@ template <> struct MappingTraits { static void mapping(IO &IO, WasmYAML::NameEntry &NameEntry); }; -template <> struct MappingTraits { - static void mapping(IO &IO, WasmYAML::ProducerEntry &ProducerEntry); -}; - template <> struct MappingTraits { static void mapping(IO &IO, WasmYAML::SegmentInfo &SegmentInfo); }; diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp index 8e45b2f3e0c3..0cca3757be90 100644 --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -224,7 +224,6 @@ class WasmObjectWriter : public MCObjectWriter { // Stores output data (index, relocations, content offset) for custom // section. std::vector CustomSections; - std::unique_ptr ProducersSection; // Relocations for fixing up references in the custom sections. DenseMap> CustomSectionsRelocations; @@ -266,8 +265,6 @@ private: WasmIndices.clear(); TableIndices.clear(); DataLocations.clear(); - CustomSections.clear(); - ProducersSection.reset(); CustomSectionsRelocations.clear(); SignatureIndices.clear(); Signatures.clear(); @@ -314,8 +311,7 @@ private: ArrayRef SymbolInfos, ArrayRef> InitFuncs, const std::map> &Comdats); - void writeCustomSection(WasmCustomSection &CustomSection, - const MCAssembler &Asm, const MCAsmLayout &Layout); + void writeCustomSections(const MCAssembler &Asm, const MCAsmLayout &Layout); void writeCustomRelocSections(); void updateCustomSectionRelocations(const SmallVector &Functions, @@ -1049,24 +1045,25 @@ void WasmObjectWriter::writeLinkingMetaDataSection( endSection(Section); } -void WasmObjectWriter::writeCustomSection(WasmCustomSection &CustomSection, - const MCAssembler &Asm, - const MCAsmLayout &Layout) { - SectionBookkeeping Section; - auto *Sec = CustomSection.Section; - startCustomSection(Section, CustomSection.Name); +void WasmObjectWriter::writeCustomSections(const MCAssembler &Asm, + const MCAsmLayout &Layout) { + for (auto &CustomSection : CustomSections) { + SectionBookkeeping Section; + auto *Sec = CustomSection.Section; + startCustomSection(Section, CustomSection.Name); - Sec->setSectionOffset(W.OS.tell() - Section.ContentsOffset); - Asm.writeSectionData(W.OS, Sec, Layout); + Sec->setSectionOffset(W.OS.tell() - Section.ContentsOffset); + Asm.writeSectionData(W.OS, Sec, Layout); - CustomSection.OutputContentsOffset = Section.ContentsOffset; - CustomSection.OutputIndex = Section.Index; + CustomSection.OutputContentsOffset = Section.ContentsOffset; + CustomSection.OutputIndex = Section.Index; - endSection(Section); + endSection(Section); - // Apply fixups. - auto &Relocations = CustomSectionsRelocations[CustomSection.Section]; - applyRelocations(Relocations, CustomSection.OutputContentsOffset); + // Apply fixups. + auto &Relocations = CustomSectionsRelocations[CustomSection.Section]; + applyRelocations(Relocations, CustomSection.OutputContentsOffset); + } } uint32_t WasmObjectWriter::getFunctionType(const MCSymbolWasm &Symbol) { @@ -1285,13 +1282,6 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm, report_fatal_error("section name and begin symbol should match: " + Twine(SectionName)); } - - // Separate out the producers section - if (Name == "producers") { - ProducersSection = llvm::make_unique(Name, &Section); - continue; - } - CustomSections.emplace_back(Name, &Section); } } @@ -1580,14 +1570,11 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm, writeElemSection(TableElems); writeCodeSection(Asm, Layout, Functions); writeDataSection(); - for (auto &CustomSection : CustomSections) - writeCustomSection(CustomSection, Asm, Layout); + writeCustomSections(Asm, Layout); writeLinkingMetaDataSection(SymbolInfos, InitFuncs, Comdats); writeRelocSection(CodeSectionIndex, "CODE", CodeRelocations); writeRelocSection(DataSectionIndex, "DATA", DataRelocations); writeCustomRelocSections(); - if (ProducersSection) - writeCustomSection(*ProducersSection, Asm, Layout); // TODO: Translate the .comment section to the output. return W.OS.tell() - StartOffset; diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index fd6ad9bdefeb..d84cb48c9fbd 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -10,7 +10,6 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" #include "llvm/ADT/Triple.h" @@ -660,47 +659,6 @@ Error WasmObjectFile::parseLinkingSectionComdat(ReadContext &Ctx) { return Error::success(); } -Error WasmObjectFile::parseProducersSection(ReadContext &Ctx) { - llvm::SmallSet FieldsSeen; - uint32_t Fields = readVaruint32(Ctx); - for (size_t i = 0; i < Fields; ++i) { - StringRef FieldName = readString(Ctx); - if (!FieldsSeen.insert(FieldName).second) - return make_error( - "Producers section does not have unique fields", - object_error::parse_failed); - std::vector> *ProducerVec = nullptr; - if (FieldName == "language") { - ProducerVec = &ProducerInfo.Languages; - } else if (FieldName == "processed-by") { - ProducerVec = &ProducerInfo.Tools; - } else if (FieldName == "sdk") { - ProducerVec = &ProducerInfo.SDKs; - } else { - return make_error( - "Producers section field is not named one of language, processed-by, " - "or sdk", - object_error::parse_failed); - } - uint32_t ValueCount = readVaruint32(Ctx); - llvm::SmallSet ProducersSeen; - for (size_t j = 0; j < ValueCount; ++j) { - StringRef Name = readString(Ctx); - StringRef Version = readString(Ctx); - if (!ProducersSeen.insert(Name).second) { - return make_error( - "Producers section contains repeated producer", - object_error::parse_failed); - } - ProducerVec->emplace_back(Name, Version); - } - } - if (Ctx.Ptr != Ctx.End) - return make_error("Producers section ended prematurely", - object_error::parse_failed); - return Error::success(); -} - Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { uint32_t SectionIndex = readVaruint32(Ctx); if (SectionIndex >= Sections.size()) @@ -799,9 +757,6 @@ Error WasmObjectFile::parseCustomSection(WasmSection &Sec, ReadContext &Ctx) { } else if (Sec.Name == "linking") { if (Error Err = parseLinkingSection(Ctx)) return Err; - } else if (Sec.Name == "producers") { - if (Error Err = parseProducersSection(Ctx)) - return Err; } else if (Sec.Name.startswith("reloc.")) { if (Error Err = parseRelocSection(Sec.Name, Ctx)) return Err; diff --git a/llvm/lib/ObjectYAML/WasmYAML.cpp b/llvm/lib/ObjectYAML/WasmYAML.cpp index b45c8ce65eba..47bf853e0d3e 100644 --- a/llvm/lib/ObjectYAML/WasmYAML.cpp +++ b/llvm/lib/ObjectYAML/WasmYAML.cpp @@ -74,14 +74,6 @@ static void sectionMapping(IO &IO, WasmYAML::LinkingSection &Section) { IO.mapOptional("Comdats", Section.Comdats); } -static void sectionMapping(IO &IO, WasmYAML::ProducersSection &Section) { - commonSectionMapping(IO, Section); - IO.mapRequired("Name", Section.Name); - IO.mapOptional("Languages", Section.Languages); - IO.mapOptional("Tools", Section.Tools); - IO.mapOptional("SDKs", Section.SDKs); -} - static void sectionMapping(IO &IO, WasmYAML::CustomSection &Section) { commonSectionMapping(IO, Section); IO.mapRequired("Name", Section.Name); @@ -177,10 +169,6 @@ void MappingTraits>::mapping( if (!IO.outputting()) Section.reset(new WasmYAML::NameSection()); sectionMapping(IO, *cast(Section.get())); - } else if (SectionName == "producers") { - if (!IO.outputting()) - Section.reset(new WasmYAML::ProducersSection()); - sectionMapping(IO, *cast(Section.get())); } else { if (!IO.outputting()) Section.reset(new WasmYAML::CustomSection(SectionName)); @@ -305,12 +293,6 @@ void MappingTraits::mapping( IO.mapRequired("Name", NameEntry.Name); } -void MappingTraits::mapping( - IO &IO, WasmYAML::ProducerEntry &ProducerEntry) { - IO.mapRequired("Name", ProducerEntry.Name); - IO.mapRequired("Version", ProducerEntry.Version); -} - void MappingTraits::mapping( IO &IO, WasmYAML::SegmentInfo &SegmentInfo) { IO.mapRequired("Index", SegmentInfo.Index); diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index 6d5647a7ace1..c4f03dfa7f9e 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -22,7 +22,6 @@ #include "WebAssemblyMCInstLower.h" #include "WebAssemblyMachineFunctionInfo.h" #include "WebAssemblyRegisterInfo.h" -#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringExtras.h" #include "llvm/CodeGen/Analysis.h" #include "llvm/CodeGen/AsmPrinter.h" @@ -147,35 +146,6 @@ void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) { OutStreamer->PopSection(); } } - - if (const NamedMDNode *Ident = M.getNamedMetadata("llvm.ident")) { - llvm::SmallSet SeenTools; - llvm::SmallVector, 4> Tools; - for (size_t i = 0, e = Ident->getNumOperands(); i < e; ++i) { - const auto *S = cast(Ident->getOperand(i)->getOperand(0)); - std::pair Field = S->getString().split("version"); - StringRef Name = Field.first.trim(); - StringRef Version = Field.second.trim(); - if (!SeenTools.insert(Name).second) - continue; - Tools.emplace_back(Name, Version); - } - MCSectionWasm *Producers = OutContext.getWasmSection( - ".custom_section.producers", SectionKind::getMetadata()); - OutStreamer->PushSection(); - OutStreamer->SwitchSection(Producers); - OutStreamer->EmitULEB128IntValue(1); - OutStreamer->EmitULEB128IntValue(strlen("processed-by")); - OutStreamer->EmitBytes("processed-by"); - OutStreamer->EmitULEB128IntValue(Tools.size()); - for (auto &Tool : Tools) { - OutStreamer->EmitULEB128IntValue(Tool.first.size()); - OutStreamer->EmitBytes(Tool.first); - OutStreamer->EmitULEB128IntValue(Tool.second.size()); - OutStreamer->EmitBytes(Tool.second); - } - OutStreamer->PopSection(); - } } void WebAssemblyAsmPrinter::EmitConstantPool() { diff --git a/llvm/test/CodeGen/WebAssembly/custom-sections.ll b/llvm/test/CodeGen/WebAssembly/custom-sections.ll index e92c0f8f3a88..cf21b0af4fb1 100644 --- a/llvm/test/CodeGen/WebAssembly/custom-sections.ll +++ b/llvm/test/CodeGen/WebAssembly/custom-sections.ll @@ -10,9 +10,6 @@ target triple = "wasm32-unknown-unknown" !2 = !{ !"green", !"qux" } !wasm.custom_sections = !{ !0, !1, !2 } -!llvm.ident = !{!3} -!3 = !{!"clang version 123"} - ; CHECK: .section .custom_section.red,"",@ ; CHECK-NEXT: .ascii "foo" @@ -21,13 +18,3 @@ target triple = "wasm32-unknown-unknown" ; CHECK: .section .custom_section.green,"",@ ; CHECK-NEXT: .ascii "qux" - -; CHECK: .section .custom_section.producers,"",@ -; CHECK-NEXT: .int8 1 -; CHECK-NEXT: .int8 12 -; CHECK-NEXT: .ascii "processed-by" -; CHECK-NEXT: .int8 1 -; CHECK-NEXT: .int8 5 -; CHECK-NEXT: .ascii "clang" -; CHECK-NEXT: .int8 3 -; CHECK-NEXT: .ascii "123" diff --git a/llvm/test/MC/WebAssembly/custom-sections.ll b/llvm/test/MC/WebAssembly/custom-sections.ll index f662d55352bb..8ee04e0b0449 100644 --- a/llvm/test/MC/WebAssembly/custom-sections.ll +++ b/llvm/test/MC/WebAssembly/custom-sections.ll @@ -9,9 +9,6 @@ target triple = "wasm32-unknown-unknown" !2 = !{ !"green", !"qux" } !wasm.custom_sections = !{ !0, !1, !2 } -!3 = !{ !"clang version 123"} -!llvm.ident = !{!3} - ; CHECK: Section { ; CHECK: Type: CUSTOM (0x0) ; CHECK: Size: 3 @@ -24,9 +21,3 @@ target triple = "wasm32-unknown-unknown" ; CHECK: Offset: 85 ; CHECK: Name: green ; CHECK: } -; CHECK: Section { -; CHECK: Type: CUSTOM (0x0) -; CHECK: Size: 25 -; CHECK: Offset: 118 -; CHECK: Name: producers -; CHECK: } diff --git a/llvm/test/MC/WebAssembly/debug-info.ll b/llvm/test/MC/WebAssembly/debug-info.ll index 06c394964cb1..05e339279171 100644 --- a/llvm/test/MC/WebAssembly/debug-info.ll +++ b/llvm/test/MC/WebAssembly/debug-info.ll @@ -124,12 +124,6 @@ ; CHECK-NEXT: Offset: 991 ; CHECK-NEXT: Name: reloc..debug_line ; CHECK-NEXT: } -; CHECK-NEXT: Section { -; CHECK-NEXT: Type: CUSTOM (0x0) -; CHECK-NEXT: Size: 62 -; CHECK-NEXT: Offset: 1021 -; CHECK-NEXT: Name: producers -; CHECK-NEXT: } ; CHECK-NEXT:] ; CHECK-NEXT:Relocations [ ; CHECK-NEXT: Section (6) DATA { diff --git a/llvm/test/ObjectYAML/wasm/producers_section.yaml b/llvm/test/ObjectYAML/wasm/producers_section.yaml deleted file mode 100644 index 1aef68ca3e78..000000000000 --- a/llvm/test/ObjectYAML/wasm/producers_section.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# RUN: yaml2obj %s | obj2yaml | FileCheck %s ---- !WASM -FileHeader: - Version: 0x00000001 -Sections: - - Type: CUSTOM - Name: producers - Languages: - - Name: C++ - Version: C++11 - Tools: - - Name: clang - Version: 123 - SDKs: - - Name: emscripten - Version: 9001 -... -# CHECK: Sections: -# CHECK: - Type: CUSTOM -# CHECK: Name: producers -# CHECK: Languages: -# CHECK: - Name: 'C++' -# CHECK: Version: 'C++11' -# CHECK: Tools: -# CHECK: - Name: clang -# CHECK: Version: '123' -# CHECK: SDKs: -# CHECK: - Name: emscripten -# CHECK: Version: '9001' diff --git a/llvm/test/ObjectYAML/wasm/producers_section_repeat.yaml b/llvm/test/ObjectYAML/wasm/producers_section_repeat.yaml deleted file mode 100644 index 9dd6b7fd1f7e..000000000000 --- a/llvm/test/ObjectYAML/wasm/producers_section_repeat.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# RUN: yaml2obj %s | not obj2yaml 2>&1 | FileCheck %s ---- !WASM -FileHeader: - Version: 0x00000001 -Sections: - - Type: CUSTOM - Name: producers - Languages: - - Name: C++ - Version: C++11 - - Name: C++ - Version: C++17 -... -# CHECK: Producers section contains repeated producer diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp index 0bd5642b7600..7581bbef50ad 100644 --- a/llvm/tools/obj2yaml/wasm2yaml.cpp +++ b/llvm/tools/obj2yaml/wasm2yaml.cpp @@ -133,29 +133,6 @@ WasmDumper::dumpCustomSection(const WasmSection &WasmSec) { } CustomSec = std::move(LinkingSec); - } else if (WasmSec.Name == "producers") { - std::unique_ptr ProducersSec = - make_unique(); - const llvm::wasm::WasmProducerInfo &Info = Obj.getProducerInfo(); - for (auto &E : Info.Languages) { - WasmYAML::ProducerEntry Producer; - Producer.Name = E.first; - Producer.Version = E.second; - ProducersSec->Languages.push_back(Producer); - } - for (auto &E : Info.Tools) { - WasmYAML::ProducerEntry Producer; - Producer.Name = E.first; - Producer.Version = E.second; - ProducersSec->Tools.push_back(Producer); - } - for (auto &E : Info.SDKs) { - WasmYAML::ProducerEntry Producer; - Producer.Name = E.first; - Producer.Version = E.second; - ProducersSec->SDKs.push_back(Producer); - } - CustomSec = std::move(ProducersSec); } else { CustomSec = make_unique(WasmSec.Name); } diff --git a/llvm/tools/yaml2obj/yaml2wasm.cpp b/llvm/tools/yaml2obj/yaml2wasm.cpp index 242bc6b6442a..2d3e3b71f086 100644 --- a/llvm/tools/yaml2obj/yaml2wasm.cpp +++ b/llvm/tools/yaml2obj/yaml2wasm.cpp @@ -49,7 +49,6 @@ private: int writeSectionContent(raw_ostream &OS, WasmYAML::DylinkSection &Section); int writeSectionContent(raw_ostream &OS, WasmYAML::NameSection &Section); int writeSectionContent(raw_ostream &OS, WasmYAML::LinkingSection &Section); - int writeSectionContent(raw_ostream &OS, WasmYAML::ProducersSection &Section); WasmYAML::Object &Obj; uint32_t NumImportedFunctions = 0; uint32_t NumImportedGlobals = 0; @@ -256,29 +255,6 @@ int WasmWriter::writeSectionContent(raw_ostream &OS, return 0; } -int WasmWriter::writeSectionContent(raw_ostream &OS, - WasmYAML::ProducersSection &Section) { - writeStringRef(Section.Name, OS); - int Fields = int(!Section.Languages.empty()) + int(!Section.Tools.empty()) + - int(!Section.SDKs.empty()); - if (Fields == 0) - return 0; - encodeULEB128(Fields, OS); - for (auto &Field : {std::make_pair(StringRef("language"), &Section.Languages), - std::make_pair(StringRef("processed-by"), &Section.Tools), - std::make_pair(StringRef("sdk"), &Section.SDKs)}) { - if (Field.second->empty()) - continue; - writeStringRef(Field.first, OS); - encodeULEB128(Field.second->size(), OS); - for (auto &Entry : *Field.second) { - writeStringRef(Entry.Name, OS); - writeStringRef(Entry.Version, OS); - } - } - return 0; -} - int WasmWriter::writeSectionContent(raw_ostream &OS, WasmYAML::CustomSection &Section) { if (auto S = dyn_cast(&Section)) { @@ -290,9 +266,6 @@ int WasmWriter::writeSectionContent(raw_ostream &OS, } else if (auto S = dyn_cast(&Section)) { if (auto Err = writeSectionContent(OS, *S)) return Err; - } else if (auto S = dyn_cast(&Section)) { - if (auto Err = writeSectionContent(OS, *S)) - return Err; } else { writeStringRef(Section.Name, OS); Section.Payload.writeAsBinary(OS);