diff options
author | Sam Clegg <sbc@chromium.org> | 2019-06-04 09:48:32 -0700 |
---|---|---|
committer | Ben Smith <binji@chromium.org> | 2019-06-04 09:48:32 -0700 |
commit | 986f5cc8bb85ba4ecc0dd3ed82fa39565ce9c419 (patch) | |
tree | fdf4797a94b27e3523fdd7ae30a8e34ebdcd5bcf /src/binary-reader.cc | |
parent | a3a7a93f1f417c6c258e6b5d507adb004fc8b688 (diff) | |
download | wabt-986f5cc8bb85ba4ecc0dd3ed82fa39565ce9c419.tar.gz wabt-986f5cc8bb85ba4ecc0dd3ed82fa39565ce9c419.tar.bz2 wabt-986f5cc8bb85ba4ecc0dd3ed82fa39565ce9c419.zip |
Add support for comdat groups in the linking section (#1087)
Diffstat (limited to 'src/binary-reader.cc')
-rw-r--r-- | src/binary-reader.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/binary-reader.cc b/src/binary-reader.cc index 893be276..038d54c2 100644 --- a/src/binary-reader.cc +++ b/src/binary-reader.cc @@ -1748,6 +1748,27 @@ Result BinaryReader::ReadLinkingSection(Offset section_size) { CALLBACK(OnInitFunction, priority, func); } break; + case LinkingEntryType::ComdatInfo: + CHECK_RESULT(ReadU32Leb128(&count, "count")); + CALLBACK(OnComdatCount, count); + while (count--) { + uint32_t flags; + uint32_t entry_count; + string_view name; + CHECK_RESULT(ReadStr(&name, "comdat name")); + CHECK_RESULT(ReadU32Leb128(&flags, "flags")); + CHECK_RESULT(ReadU32Leb128(&entry_count, "entry count")); + CALLBACK(OnComdatBegin, name, flags, entry_count); + while (entry_count--) { + uint32_t kind; + uint32_t index; + CHECK_RESULT(ReadU32Leb128(&kind, "kind")); + CHECK_RESULT(ReadU32Leb128(&index, "index")); + ComdatType comdat_type = static_cast<ComdatType>(kind); + CALLBACK(OnComdatEntry, comdat_type, index); + } + } + break; default: // Unknown subsection, skip it. state_.offset = subsection_end; |