summaryrefslogtreecommitdiffstats
path: root/llvm/tools/obj2yaml/wasm2yaml.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-04-26 18:15:32 +0000
committerSam Clegg <sbc@chromium.org>2018-04-26 18:15:32 +0000
commit6bb5a41f99445a9c067a699028d0d62a89953d12 (patch)
tree59de67347939a02dae85848660ca40e08469b216 /llvm/tools/obj2yaml/wasm2yaml.cpp
parentb31f91897966d6f14c50ac22de8f8a15bcfc0812 (diff)
downloadbcm5719-llvm-6bb5a41f99445a9c067a699028d0d62a89953d12.tar.gz
bcm5719-llvm-6bb5a41f99445a9c067a699028d0d62a89953d12.zip
[WebAssembly] Add version to object file metadata
Summary: See https://github.com/WebAssembly/tool-conventions/issues/54 Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46069 llvm-svn: 330969
Diffstat (limited to 'llvm/tools/obj2yaml/wasm2yaml.cpp')
-rw-r--r--llvm/tools/obj2yaml/wasm2yaml.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp
index 29bf9b5e25e..55fc2bf9234 100644
--- a/llvm/tools/obj2yaml/wasm2yaml.cpp
+++ b/llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -62,6 +62,8 @@ std::unique_ptr<WasmYAML::CustomSection> WasmDumper::dumpCustomSection(const Was
CustomSec = std::move(NameSec);
} else if (WasmSec.Name == "linking") {
std::unique_ptr<WasmYAML::LinkingSection> LinkingSec = make_unique<WasmYAML::LinkingSection>();
+ LinkingSec->Version = Obj.linkingData().Version;
+
ArrayRef<StringRef> Comdats = Obj.linkingData().Comdats;
for (StringRef ComdatName : Comdats)
LinkingSec->Comdats.emplace_back(WasmYAML::Comdat{ComdatName, {}});
@@ -71,6 +73,7 @@ std::unique_ptr<WasmYAML::CustomSection> WasmDumper::dumpCustomSection(const Was
WasmYAML::ComdatEntry{wasm::WASM_COMDAT_FUNCTION, Func.Index});
}
}
+
uint32_t SegmentIndex = 0;
for (const object::WasmSegment &Segment : Obj.dataSegments()) {
if (!Segment.Data.Name.empty()) {
@@ -87,6 +90,7 @@ std::unique_ptr<WasmYAML::CustomSection> WasmDumper::dumpCustomSection(const Was
}
SegmentIndex++;
}
+
uint32_t SymbolIndex = 0;
for (const wasm::WasmSymbolInfo &Symbol : Obj.linkingData().SymbolTable) {
WasmYAML::SymbolInfo Info;
@@ -105,10 +109,12 @@ std::unique_ptr<WasmYAML::CustomSection> WasmDumper::dumpCustomSection(const Was
}
LinkingSec->SymbolTable.emplace_back(Info);
}
+
for (const wasm::WasmInitFunc &Func : Obj.linkingData().InitFunctions) {
WasmYAML::InitFunction F{Func.Priority, Func.Symbol};
LinkingSec->InitFunctions.emplace_back(F);
}
+
CustomSec = std::move(LinkingSec);
} else {
CustomSec = make_unique<WasmYAML::CustomSection>(WasmSec.Name);
OpenPOWER on IntegriCloud