diff options
author | Sam Clegg <sbc@chromium.org> | 2018-11-14 18:36:24 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2018-11-14 18:36:24 +0000 |
commit | e4afbc68046c436f1eb2ec97dd838d8e470c3d7f (patch) | |
tree | ccbf5565f28de12ca5c590758ab4ce028b95a126 /llvm/lib/ObjectYAML/WasmYAML.cpp | |
parent | 6c94264b1f3342376ec3d46e14634d39cf158a49 (diff) | |
download | bcm5719-llvm-e4afbc68046c436f1eb2ec97dd838d8e470c3d7f.tar.gz bcm5719-llvm-e4afbc68046c436f1eb2ec97dd838d8e470c3d7f.zip |
[WebAssembly] Add support for dylink section in object format
See https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md.
Differential Revision: https://reviews.llvm.org/D54490
llvm-svn: 346880
Diffstat (limited to 'llvm/lib/ObjectYAML/WasmYAML.cpp')
-rw-r--r-- | llvm/lib/ObjectYAML/WasmYAML.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/ObjectYAML/WasmYAML.cpp b/llvm/lib/ObjectYAML/WasmYAML.cpp index 610507cf7f0..2bc971a46b3 100644 --- a/llvm/lib/ObjectYAML/WasmYAML.cpp +++ b/llvm/lib/ObjectYAML/WasmYAML.cpp @@ -48,6 +48,15 @@ static void commonSectionMapping(IO &IO, WasmYAML::Section &Section) { IO.mapOptional("Relocations", Section.Relocations); } +static void sectionMapping(IO &IO, WasmYAML::DylinkSection &Section) { + commonSectionMapping(IO, Section); + IO.mapRequired("Name", Section.Name); + IO.mapRequired("MemorySize", Section.MemorySize); + IO.mapRequired("MemoryAlignment", Section.MemoryAlignment); + IO.mapRequired("TableSize", Section.TableSize); + IO.mapRequired("TableAlignment", Section.TableAlignment); +} + static void sectionMapping(IO &IO, WasmYAML::NameSection &Section) { commonSectionMapping(IO, Section); IO.mapRequired("Name", Section.Name); @@ -147,7 +156,11 @@ void MappingTraits<std::unique_ptr<WasmYAML::Section>>::mapping( } else { IO.mapRequired("Name", SectionName); } - if (SectionName == "linking") { + if (SectionName == "dylink") { + if (!IO.outputting()) + Section.reset(new WasmYAML::DylinkSection()); + sectionMapping(IO, *cast<WasmYAML::DylinkSection>(Section.get())); + } else if (SectionName == "linking") { if (!IO.outputting()) Section.reset(new WasmYAML::LinkingSection()); sectionMapping(IO, *cast<WasmYAML::LinkingSection>(Section.get())); |