[WebAssembly] Expose the offset of each data segment
Summary:
This allows tools like lld that process relocations
to apply data relocation correctly. This information
is required because relocation are stored as section
offset.
Subscribers: jfb, dschuff, jgravelle-google, aheejin
Differential Revision: https://reviews.llvm.org/D35234
llvm-svn: 307741
diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp
index 1df6afc..a1da4b6 100644
--- a/llvm/tools/obj2yaml/wasm2yaml.cpp
+++ b/llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -236,9 +236,10 @@
auto DataSec = make_unique<WasmYAML::DataSection>();
for (auto &Segment : Obj.dataSegments()) {
WasmYAML::DataSegment Seg;
- Seg.Index = Segment.Index;
- Seg.Offset = Segment.Offset;
- Seg.Content = yaml::BinaryRef(Segment.Content);
+ Seg.SectionOffset = Segment.SectionOffset;
+ Seg.MemoryIndex = Segment.Data.MemoryIndex;
+ Seg.Offset = Segment.Data.Offset;
+ Seg.Content = yaml::BinaryRef(Segment.Data.Content);
DataSec->Segments.push_back(Seg);
}
S = std::move(DataSec);