summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/WasmObjectWriter.cpp
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2019-01-17 00:39:49 +0000
committerThomas Lively <tlively@google.com>2019-01-17 00:39:49 +0000
commit3cfcc94c099140cade96d0d799f017f95eb20bd9 (patch)
treed98d76b3778efcecba2eeb5582e778673857bfdd /llvm/lib/MC/WasmObjectWriter.cpp
parentd24ae47db657b4ee48ac9540aafcf6475b4b9f85 (diff)
downloadbcm5719-llvm-3cfcc94c099140cade96d0d799f017f95eb20bd9.tar.gz
bcm5719-llvm-3cfcc94c099140cade96d0d799f017f95eb20bd9.zip
Revert "[WebAssembly] Parse llvm.ident into producers section"
This reverts commit eccdbba3a02a33e13b5262e92200a33e2ead873d. llvm-svn: 351410
Diffstat (limited to 'llvm/lib/MC/WasmObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/WasmObjectWriter.cpp47
1 files changed, 17 insertions, 30 deletions
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 8e45b2f3e0c..0cca3757be9 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<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;
OpenPOWER on IntegriCloud