]> granicus.if.org Git - llvm/commitdiff
Revert "[WebAssembly] Parse llvm.ident into producers section"
authorThomas Lively <tlively@google.com>
Thu, 17 Jan 2019 00:39:49 +0000 (00:39 +0000)
committerThomas Lively <tlively@google.com>
Thu, 17 Jan 2019 00:39:49 +0000 (00:39 +0000)
This reverts commit eccdbba3a02a33e13b5262e92200a33e2ead873d.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351410 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
include/llvm/BinaryFormat/Wasm.h
include/llvm/Object/Wasm.h
include/llvm/ObjectYAML/WasmYAML.h
lib/MC/WasmObjectWriter.cpp
lib/Object/WasmObjectFile.cpp
lib/ObjectYAML/WasmYAML.cpp
lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
test/CodeGen/WebAssembly/custom-sections.ll
test/MC/WebAssembly/custom-sections.ll
test/MC/WebAssembly/debug-info.ll
test/ObjectYAML/wasm/producers_section.yaml [deleted file]
test/ObjectYAML/wasm/producers_section_repeat.yaml [deleted file]
tools/obj2yaml/wasm2yaml.cpp
tools/yaml2obj/yaml2wasm.cpp

index 05439c608727db118f2e99c8a0f73c20411bf9af..d9f0f94b298d4e72f68fca5de4ca926c479ac51c 100644 (file)
@@ -43,12 +43,6 @@ struct WasmDylinkInfo {
   std::vector<StringRef> Needed; // Shared library depenedencies
 };
 
-struct WasmProducerInfo {
-  std::vector<std::pair<std::string, std::string>> Languages;
-  std::vector<std::pair<std::string, std::string>> Tools;
-  std::vector<std::pair<std::string, std::string>> SDKs;
-};
-
 struct WasmExport {
   StringRef Name;
   uint8_t Kind;
index 083fd2e9030d9b673076a1e2551cf0206ad5fcf0..ed857652a0486149658e157987586f7693e4e2b0 100644 (file)
@@ -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<wasm::WasmSignature> types() const { return Signatures; }
   ArrayRef<uint32_t> functionTypes() const { return FunctionTypes; }
   ArrayRef<wasm::WasmImport> 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<WasmSection> Sections;
   wasm::WasmDylinkInfo DylinkInfo;
-  wasm::WasmProducerInfo ProducerInfo;
   std::vector<wasm::WasmSignature> Signatures;
   std::vector<uint32_t> FunctionTypes;
   std::vector<wasm::WasmTable> Tables;
index 1927ff35159e874ab6d71f40cdeb19c7de921f80..406dd7cb515f745fff27a26ef9d16d777c55ec86 100644 (file)
@@ -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<Comdat> Comdats;
 };
 
-struct ProducersSection : CustomSection {
-  ProducersSection() : CustomSection("producers") {}
-
-  static bool classof(const Section *S) {
-    auto C = dyn_cast<CustomSection>(S);
-    return C && C->Name == "producers";
-  }
-
-  std::vector<ProducerEntry> Languages;
-  std::vector<ProducerEntry> Tools;
-  std::vector<ProducerEntry> 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<WasmYAML::NameEntry> {
   static void mapping(IO &IO, WasmYAML::NameEntry &NameEntry);
 };
 
-template <> struct MappingTraits<WasmYAML::ProducerEntry> {
-  static void mapping(IO &IO, WasmYAML::ProducerEntry &ProducerEntry);
-};
-
 template <> struct MappingTraits<WasmYAML::SegmentInfo> {
   static void mapping(IO &IO, WasmYAML::SegmentInfo &SegmentInfo);
 };
index 8e45b2f3e0c37b0e04a738a642eab6032a9d38eb..0cca3757be907fd0005577d891e8be0a8ebe1551 100644 (file)
@@ -224,7 +224,6 @@ class WasmObjectWriter : public MCObjectWriter {
   // Stores output data (index, relocations, content offset) for custom
   // section.
   std::vector<WasmCustomSection> CustomSections;
-  std::unique_ptr<WasmCustomSection> ProducersSection;
   // Relocations for fixing up references in the custom sections.
   DenseMap<const MCSectionWasm *, std::vector<WasmRelocationEntry>>
       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<wasm::WasmSymbolInfo> SymbolInfos,
       ArrayRef<std::pair<uint16_t, uint32_t>> InitFuncs,
       const std::map<StringRef, std::vector<WasmComdatEntry>> &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<WasmFunction, 4> &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<WasmCustomSection>(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;
index fd6ad9bdefebb3bf33e4635ae9bf34785b752c54..d84cb48c9fbd5d594d0f487b67453f038cfd6ad9 100644 (file)
@@ -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<StringRef, 3> 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<GenericBinaryError>(
-          "Producers section does not have unique fields",
-          object_error::parse_failed);
-    std::vector<std::pair<std::string, std::string>> *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<GenericBinaryError>(
-          "Producers section field is not named one of language, processed-by, "
-          "or sdk",
-          object_error::parse_failed);
-    }
-    uint32_t ValueCount = readVaruint32(Ctx);
-    llvm::SmallSet<StringRef, 8> 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<GenericBinaryError>(
-            "Producers section contains repeated producer",
-            object_error::parse_failed);
-      }
-      ProducerVec->emplace_back(Name, Version);
-    }
-  }
-  if (Ctx.Ptr != Ctx.End)
-    return make_error<GenericBinaryError>("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;
index b45c8ce65ebaa65c947f5bae1d1075eaf7329837..47bf853e0d3e2f8a044fbc19b8cd212f65c3b507 100644 (file)
@@ -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<std::unique_ptr<WasmYAML::Section>>::mapping(
       if (!IO.outputting())
         Section.reset(new WasmYAML::NameSection());
       sectionMapping(IO, *cast<WasmYAML::NameSection>(Section.get()));
-    } else if (SectionName == "producers") {
-      if (!IO.outputting())
-        Section.reset(new WasmYAML::ProducersSection());
-      sectionMapping(IO, *cast<WasmYAML::ProducersSection>(Section.get()));
     } else {
       if (!IO.outputting())
         Section.reset(new WasmYAML::CustomSection(SectionName));
@@ -305,12 +293,6 @@ void MappingTraits<WasmYAML::NameEntry>::mapping(
   IO.mapRequired("Name", NameEntry.Name);
 }
 
-void MappingTraits<WasmYAML::ProducerEntry>::mapping(
-    IO &IO, WasmYAML::ProducerEntry &ProducerEntry) {
-  IO.mapRequired("Name", ProducerEntry.Name);
-  IO.mapRequired("Version", ProducerEntry.Version);
-}
-
 void MappingTraits<WasmYAML::SegmentInfo>::mapping(
     IO &IO, WasmYAML::SegmentInfo &SegmentInfo) {
   IO.mapRequired("Index", SegmentInfo.Index);
index 6d5647a7ace193f57f629adca50c630889517fdb..c4f03dfa7f9e451ed81859023d2c64cde7bb15f7 100644 (file)
@@ -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<StringRef, 4> SeenTools;
-    llvm::SmallVector<std::pair<StringRef, StringRef>, 4> Tools;
-    for (size_t i = 0, e = Ident->getNumOperands(); i < e; ++i) {
-      const auto *S = cast<MDString>(Ident->getOperand(i)->getOperand(0));
-      std::pair<StringRef, StringRef> 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() {
index e92c0f8f3a882c234a6b8712ddba7ee33d8b5b6e..cf21b0af4fb12e2303d9b12770508c4e8402b54d 100644 (file)
@@ -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"
index f662d55352bbdb8f6ea22f93d2beb20154fba898..8ee04e0b0449dc6513ecbec51bd186320636f68c 100644 (file)
@@ -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:  }
index 06c394964cb1e3e4463e50d90913a57afd5038a2..05e33927917100fe7f8f054aa97fa1f65407aa92 100644 (file)
 ; 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/test/ObjectYAML/wasm/producers_section.yaml b/test/ObjectYAML/wasm/producers_section.yaml
deleted file mode 100644 (file)
index 1aef68c..0000000
+++ /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/test/ObjectYAML/wasm/producers_section_repeat.yaml b/test/ObjectYAML/wasm/producers_section_repeat.yaml
deleted file mode 100644 (file)
index 9dd6b7f..0000000
+++ /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
index 0bd5642b7600fca7366d3351042ee307dd9616aa..7581bbef50ad602b31a5c60d1eadc38dac1b541f 100644 (file)
@@ -133,29 +133,6 @@ WasmDumper::dumpCustomSection(const WasmSection &WasmSec) {
     }
 
     CustomSec = std::move(LinkingSec);
-  } else if (WasmSec.Name == "producers") {
-    std::unique_ptr<WasmYAML::ProducersSection> ProducersSec =
-        make_unique<WasmYAML::ProducersSection>();
-    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<WasmYAML::CustomSection>(WasmSec.Name);
   }
index 242bc6b6442a2b71f38258648e6a9916d06a0c47..2d3e3b71f0868e9ddb3d8ec0cfd64b535aafc95d 100644 (file)
@@ -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<WasmYAML::DylinkSection>(&Section)) {
@@ -290,9 +266,6 @@ int WasmWriter::writeSectionContent(raw_ostream &OS,
   } else if (auto S = dyn_cast<WasmYAML::LinkingSection>(&Section)) {
     if (auto Err = writeSectionContent(OS, *S))
       return Err;
-  } else if (auto S = dyn_cast<WasmYAML::ProducersSection>(&Section)) {
-    if (auto Err = writeSectionContent(OS, *S))
-      return Err;
   } else {
     writeStringRef(Section.Name, OS);
     Section.Payload.writeAsBinary(OS);