diff options
| author | Sam Clegg <sbc@chromium.org> | 2018-01-09 23:43:14 +0000 |
|---|---|---|
| committer | Sam Clegg <sbc@chromium.org> | 2018-01-09 23:43:14 +0000 |
| commit | ea7caceedcc8d872bc31c141515ef2e3749ef659 (patch) | |
| tree | 7499d1e4ee969bda41210ab8d2e5d7c339c07b44 /llvm/tools/yaml2obj/yaml2wasm.cpp | |
| parent | 29f5f987f1b76b5c43310b2062c9f447667a4f80 (diff) | |
| download | bcm5719-llvm-ea7caceedcc8d872bc31c141515ef2e3749ef659.tar.gz bcm5719-llvm-ea7caceedcc8d872bc31c141515ef2e3749ef659.zip | |
[WebAssembly] Add COMDAT support
This adds COMDAT support to the Wasm object-file format.
Spec: https://github.com/WebAssembly/tool-conventions/pull/31
Corresponding LLD change:
https://bugs.llvm.org/show_bug.cgi?id=35533, and D40845
Patch by Nicholas Wilson
Differential Revision: https://reviews.llvm.org/D40844
llvm-svn: 322135
Diffstat (limited to 'llvm/tools/yaml2obj/yaml2wasm.cpp')
| -rw-r--r-- | llvm/tools/yaml2obj/yaml2wasm.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/tools/yaml2obj/yaml2wasm.cpp b/llvm/tools/yaml2obj/yaml2wasm.cpp index 7770622149c..5c3b2b996ba 100644 --- a/llvm/tools/yaml2obj/yaml2wasm.cpp +++ b/llvm/tools/yaml2obj/yaml2wasm.cpp @@ -175,6 +175,23 @@ int WasmWriter::writeSectionContent(raw_ostream &OS, WasmYAML::LinkingSection &S } SubSection.Done(); } + + // COMDAT_INFO subsection + if (Section.Comdats.size()) { + encodeULEB128(wasm::WASM_COMDAT_INFO, OS); + encodeULEB128(Section.Comdats.size(), SubSection.GetStream()); + for (const auto &C : Section.Comdats) { + writeStringRef(C.Name, SubSection.GetStream()); + encodeULEB128(0, SubSection.GetStream()); // flags for future use + encodeULEB128(C.Entries.size(), SubSection.GetStream()); + for (const WasmYAML::ComdatEntry &Entry : C.Entries) { + encodeULEB128(Entry.Kind, SubSection.GetStream()); + encodeULEB128(Entry.Index, SubSection.GetStream()); + } + } + SubSection.Done(); + } + return 0; } |

