summaryrefslogtreecommitdiff
path: root/src/binary-reader-objdump.cc
Commit message (Collapse)AuthorAgeFilesLines
* [wasm-objdump] Fix reporting of imported 64-bit tables (#2425)Sam Clegg2024-05-221-0/+3
|
* Update testsuite and implement table64 (#2418)Sam Clegg2024-05-151-0/+3
| | | | | See https://github.com/WebAssembly/memory64/issues/51 Includes workaround for #2422
* Add support for new WASM_SEGMENT_FLAG_RETAIN segment flag (#2399)Yuta Saito2024-03-111-0/+4
| | | See https://github.com/llvm/llvm-project/pull/81539
* Handle zero local count in disassembly (#2359)Rod Vagg2024-01-031-5/+7
| | | | Previously: local[0..4294967295] Current: local[]
* [wasm-objdump] set function types for correct params+locals indexing (#2353)Rod Vagg2023-12-131-0/+8
|
* [wasm-objdump] Print i64 values as unsigned (#2344)Rod Vagg2023-12-011-1/+1
| | | | | This matches the behaviour of i32 printing. Ref: https://github.com/WebAssembly/wabt/pull/2342
* Add support for new WASM_SYMBOL_ABS symbol flag (#2305)Sam Clegg2023-11-281-3/+12
| | | See https://github.com/llvm/llvm-project/pull/67493
* Share reading/validation code between elem exprs & other const exprs (#2288)Keith Winstein2023-09-061-40/+65
| | | | | | This continues the work from #1783 and reduces special handling of elem exprs, by treating them the same as other const expressions (init expressions).
* wasm-objdump: Fix local numbering in disassembly (#2265)Michael Williamson2023-06-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, in BinaryReaderObjdumpDisassemble::BeginFunctionBody, we had: local_index_ = objdump_state_->function_param_counts[index]; where index is the index of the function i.e. we treat the keys of function_param_counts as function indices. However, function_param_counts is populated in OnFuncType with: objdump_state_->function_param_counts[index] = param_count; where index is the index of the type i.e. we treat the keys of function_param_counts as type indices. This discrepancy would cause the locals to be incorrectly numbered in the "Code Disassembly" section. This fixes the discrepancy by adding a new field, function_types, which maps from function indices to type indices, and is populated in BinaryReaderObjdump::OnFunction. This field is used in BinaryReaderObjdumpDisassemble::BeginFunctionBody to get the type index for the given function, which is then used to get the parameter count. Fixes #2264.
* wasm-objdump: Include function names in "init functions" subsection (#2202)Sam Clegg2023-04-201-3/+9
|
* Use C++17's [[fallthrough]]. NFC (#2091)Sam Clegg2023-02-271-0/+1
|
* objdump: take care of opcodes whose bytes are non-canonical leb128 (#1632)Ng Zhi An2023-02-131-1/+4
| | | Fixes #1631
* [wasm-objdump] Print segment offsets as unsigned (#2023)Sam Clegg2022-10-251-6/+15
|
* Move headers to include/wabt/ (#1998)Alex Reinking2022-09-281-5/+5
| | | This makes things easier for users and packagers of libwabt.
* Support multi-memory in all memory ops and in apply/resolve-names (#1962)Keith Winstein2022-08-151-0/+16
|
* Allow binary reader to skip function bodies. NFC (#1871)Sam Clegg2022-03-231-0/+2
| | | | | | | This is purely a performance optimization for wasm-objdump since it doesn't always need to decode function bodies. For a very large wasm file that I was testing this takes the time taken for `wasm-objdump -h` from 8.6s to 1.5s.
* wasm-objdump: Improve disassembly of call_indirect (#1866)Sam Clegg2022-03-161-0/+42
| | | | | | | Use the text format convention of putting the table before the type. Also track type names so they can be reported along with the table name, if available. Fixes: #1865
* wasm-objdump: support extended const expressions (#1859)Sam Clegg2022-03-111-84/+133
|
* Honor -DWERROR=ON for all cmake targets (#1850)Sam Clegg2022-03-071-2/+2
| | | I believe this is why #1849 managed to land without detection.
* Add initial support for code metadata (#1840)Yuri Iozzelli2022-02-251-0/+29
| | | | | | | | | | | | | | | | | | | | | See https://github.com/WebAssembly/tool-conventions/blob/main/CodeMetadata.md for the specification. In particular this pr implements the following: - Parsing code metadata sections in BinaryReader, providing appropriate callbacks that a BinaryReaderDelegate can implement: - BinaryReaderObjdump: show the sections in a human-readable form - BinaryReaderIr: add code metadata in the IR as expressions - Parsing code metadata annotations in text format, adding them in the IR like the BinaryReaderIR does - Writing the code metadata present in the IR in the proper sections when converting IR to binary - Support in wasm-decompiler for showing code metadata as comments in the pseudo-code All the features have corresponding tests. Support for code metadata is gated through the --enable-code-metadata feature. For reading/writing in the text format, --enable-annotations is also required. Missing features: Support for function-level code metadata (offset 0) Extensive validation in validator.cc (like making sure that all metadata instances are at the same code offset of an instruction)
* Use C++17 string_view (#1826)Sam Clegg2022-02-111-136/+144
| | | | | Now that we have C++17 we don't need our own string_view class anymore. Depends on #1825
* wasm-objdump: Print local names during disassembly (#1818)Michael Williamson2022-02-021-0/+42
| | | Fixes #1815
* objdump: Consider params when printing local decl index (#1819)Michael Williamson2022-02-011-1/+10
|
* Fix erroneous reporting of "Data reloctions outside of segments" (#1800)Sam Clegg2022-01-071-2/+8
| | | | | | This check should only not be done during disassembly, only when displaying details. Fixes: #1790
* Clang-format codebase (#1684)Heejin Ahn2021-12-201-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This applies clang-format to the whole codebase. I noticed we have .clang-format in wabt but the codebase is not very well formatted. This kind of mass-formatting PR has fans and skeptics because it can mess with `git blame`, but we did a similar thing in Binaryen a few years ago (WebAssembly/binaryen#2048, which was merged in WebAssembly/binaryen#2059) and it was not very confusing after all. If we are ever going to format the codebase, I think it is easier to do it in a single big PR than dozens of smaller PRs. This is using the existing .clang-format file in this repo, which follows the style of Chromium. If we think this does not suit the current formatting style, we can potentially tweak .clang-format too. For example, I noticed the current codebase puts many `case` statements within a single line when they are short, but the current .clang-format does not allow that. This does not include files in src/prebuilt, because they are generated. This also manually fixes some comment lines, because mechanically applying clang-format to long inline comments can look weird. I also added a clang-format check hook in the Github CI in #1683, which I think can be less controversial, given that it only checks the diff. --- After discussions, we ended up reverting many changes, especially one-liner functions and switch-cases, which are too many to wrap in `// clang-format off` and `// clang-format on`. I also considered fixing `.clang-format` to allow those one-liners but it caused a larger churn in other parts. So currently the codebase does not conform to `.clang-format` 100%, but we decided it's fine.
* Fix type names for function references (#1787)Sam Clegg2021-12-131-13/+13
| | | | | | | | This requires `Type::GetName` to return to be dynamicllay created and return `std::string` rather then a `const char*` As this diff shows this type name is only used in textual output and error messages so should this change should not have a effect of binary parse time or the interpreter.
* wasm-objdump: centralize opcode size calculations. NFC (#1778)Sam Clegg2021-12-081-39/+26
|
* wasm-objdump: Fix disassembly output of selectT instruction (#1777)Sam Clegg2021-12-081-1/+5
| | | | Use `LogOpcodeType` rather than LogOpcodeBare` when the select instruction has a type.
* Show tag names in objdump disassembly (#1774)Sam Clegg2021-12-071-0/+7
| | | | | | | | | Tag names are not officially part of the extended-name-section proposal (because it only deals with naming things that are in the spec already). However, I think its reasonable (and useful) to include these names under a speculative subsection ID, on the basis that tags can only exist when exceptions are enabled and that engines should ignore unknown name types.
* Perform init expression validation outside of the binary reader. NFC (#1770)Sam Clegg2021-12-021-58/+117
| | | | | | | | | | | | | | | | Rather than spocial casing them in the reader we now use the same instruction callbacks for instruction that appear in init expressions as instructions that appear in normal functions. The result of this change is the validation of init expressions is pushed further up the stack. For example, objdump will now quite happily dump modules that use arbitrary instructions in thier init expressions even though they are not valid. To me, this makes sense since objdump does not do instruction validation elsewhere. The change is pre-cursor to allowing a wider variety of instruction to be present in init expressions. See https://github.com/WebAssembly/extended-const
* Refactor init expressions handling in binary-reader-objdump.cc. NFC (#1755)Sam Clegg2021-11-051-35/+42
| | | | This makes thinks a little more precise and is part of paving the way for extended const/init expressions.
* Remove separate OnEndFunc vs OnEndExpr. (#1756)Sam Clegg2021-11-051-6/+0
| | | | We already have EndFunctionBody, and this extra distinction doesn't seem like it is needed.
* Add support for target_features section (#1744)Sam Clegg2021-10-191-1/+8
|
* Support for import/export info in dylink section (#1741)Sam Clegg2021-10-191-0/+30
|
* Fix for wasm-objdump and memory64 segment offsets (#1743)Sam Clegg2021-10-181-8/+10
|
* Support TLS symbol flag (#1706)Sam Clegg2021-09-091-0/+4
| | | See https://reviews.llvm.org/D109426
* Add objdump flag to print section offsets instead of file offsets (#1696)Derek Schuff2021-08-051-3/+11
| | | Currently implemented just for disassembly. It could be added for other sections/functionality in the future.
* [EH] Remove `unwind` (#1682)Heejin Ahn2021-06-291-1/+0
| | | `unwind` was removed. See WebAssembly/exception-handling#156.
* [EH] Replace event with tag (#1678)Heejin Ahn2021-06-221-51/+50
| | | | | | | | | | | We recently decided to change 'event' to 'tag', and 'event section' to 'tag section', out of the rationale that the section contains a generalized tag that references a type, which may be used for something other than exceptions, and the name 'event' can be confusing in the web context. See - https://github.com/WebAssembly/exception-handling/issues/159#issuecomment-857910130 - https://github.com/WebAssembly/exception-handling/pull/161
* objdump: add support for segments flags in the linking section (#1669)Sam Clegg2021-05-131-8/+44
|
* [simd] Implement load lane (#1646)Ng Zhi An2021-03-221-0/+10
| | | | | | | | | This is a new kind of ir/ast node/instruction. It has 3 immediates: memarg align, memarg offset, and lane index. This required new visitor functions in all the places. Drive-by cleanup to share the simd lane parsing logic between shuffle, lane op and this new load lane instructions. This requires rebasing some tests because the error messages are slightly different now.
* objdump: fix typo (#1614)Sam Clegg2021-03-021-1/+1
|
* Update rethrow depth handling and catch_all opcode (#1608)Asumu Takikawa2021-02-181-0/+1
| | | | | | | | | | | | | Give `catch_all` its own opcode: Previously `catch_all` shared an opcode with `else`, but the spec now allocates it the 0x19 opcode. Adjust rethrow depth semantics: Previously this had interpreted the rethrow depth argument as counting only catch blocks, but the spec has clarified that it should count all blocks (in a similar fashion as `br` and related instructions).
* Update exception handling support to current proposal (#1596)Asumu Takikawa2021-02-101-0/+11
| | | | | | | | | | This PR updates the support of exception handling to the latest proposal (that is compatible with future 2-phase exception handling) described in https://github.com/WebAssembly/exception-handling/pull/137 and https://github.com/WebAssembly/exception-handling/pull/143. * Adds back tagged `catch $e`, `catch_all`, and `rethrow N` from a previous version of wabt, but with updates to match the current spec (e.g., `catch_all` shares an opcode with `else`, `rethrow`'s depth indexes only catch blocks, etc). * Adds `unwind` and `delegate` instructions. * Removes `exnref` and `br_on_exn`. * Updates relevant tests. There are some details that could still change (e.g., maybe how `delegate`'s depth is validated), but I'd be happy to submit further PRs if the spec details change.
* objdump: Set table name based on import name (#1599)Sam Clegg2021-01-291-0/+11
|
* wasm-objdump: Report data segment names (#1588)Sam Clegg2020-12-091-2/+19
| | | Also fix ordering of data names and table segment names.
* wasm-objdump: display name of start function (#1581)Sam Clegg2020-12-031-1/+6
|
* Use stderr for all logging and error output (#1579)Sam Clegg2020-12-031-10/+15
| | | | I'm not sure why we were using stdout but the convention is normally to write all logging and error message to stderr.
* wasm-objdump: Honor extended names section (#1573)Sam Clegg2020-11-201-0/+27
| | | This should really have been part of #1554
* Add initial support for extended names sections (#1554)Sam Clegg2020-10-021-0/+12
| | | | | | | | See: https://github.com/WebAssembly/extended-name-section Although this is only a phase 1 proposal its seems pretty straight forward, and is already being implemented in binaryen.