summaryrefslogtreecommitdiff
path: root/src/binary-reader-objdump.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* Add --relocatable support for tables (#1549) (#1549)Andy Wingo2020-10-011-1/+41
| | | | | | | | | | | | | We add relocations for table numbers on each place where we reify a table number (call_indirect, table.get, table.set...), but only if reference types are enabled. Also, fix symbol table generation with unnamed definitions, to allow for relocating references to anonymous functions or tables. As tests, add variants of the relocations and symbol-tables dump tests, with and without all features enabled. Enabling reference types causes relocs to be emitted. We also add --details to the relocations dump tests, so that we can see the target symbols for the relocations.
* Fix integer overflow in objdump name tracking (#1524)Sam Clegg2020-08-191-14/+15
| | | | Fixes: #1520
* Added initial "memory64" proposal support (#1500)Wouter van Oortmerssen2020-08-071-6/+19
|
* Reference types changes to remove subtyping (#1407)Ben Smith2020-05-281-6/+19
| | | | | | | | Main changes: * Rename `anyref` -> `externref` * Remove `nullref` * Rename `hostref` -> `externref` * `ref.null` and `ref.is_null` now have "ref kind" parameter * Add ref kind keywords: `func`, `extern`, `exn`
* Parse ArrayTypes (#1364)Ben Smith2020-03-231-0/+17
| | | | | | | | | | The following formats are supported: * (type (array i32)) * (type (array (field i32))) * (type (array (field (mut i32)))) This PR adds support for reading/writing binary and text, but no interpreter support yet.
* Move more functionality into the v128 type (#1363)Ben Smith2020-03-201-4/+4
| | | | | | | | | * Add lane getters: u{8,16,32,64}, f{32,64}_bits * Add lane setters: set_u{8,16,32,64}, set_f{32,64}_bits * Add set_zero, is_zero * Add To<Type>() and From<Type>() These changes will make it easier to build v128 values in the spectest-interp (which needs to be updated to support SIMD spec tests)
* Add wasm-objdump support for structs (#1361)Ben Smith2020-03-191-0/+21
|
* Initial pass parsing/reading struct (#1352)Ben Smith2020-03-091-10/+10
| | | | | | | | | | | | | | | | | | This parses just the format `(struct)` as a new type. I added a test for this using `wat2wasm`, but that requires a rudimentary binary format. The test runner automatically attempts to rountrip all wat2wasm tests, so this required implementing the wat writing and binary reading too. Here's a summary of the changes: * binary-reader:h: Rename `BinaryReader::OnType` callbacks to `OnFuncType` * binary-reader.h: Add `BinaryReader::OnStructType` * binary-reader.cc: Use a switch after reading the type form to determine whether we're reading a function or struct. * tokens.def: Add new `TokenType::Struct` * lexer-keywords.txt: Add new `struct` keyword * type.h: Add `Type::Struct` type form * wast-parser.cc: Parse `(struct)` in text format * wat-writer.cc: Write Func or Struct type forms
* Convert Type from an enum into a class (#1350)Ben Smith2020-02-281-12/+12
| | | | | | | | | | | | | | | | | This is similar to the way Opcode is structured, which allows us to hang member functions off of the enumeration. The primary motivator for this change is the GC proposal (and the function-references proposal) where a Type can be parameterized: (type $T (struct ...)) (func (local (ref $T) ... ) In this case the type is ref, with a parameter of the type index. Making Type a class will make it easier to store this additional information.
* Update testsuite (w/ reference-types changes) (#1351)Ben Smith2020-02-281-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new table-sub test, checks whether the subtyping is handled properly w/ table.init and table.copy instructions. The BeginElemSegment callback can't pass the element type anymore, since it's not known yet. The callback also can't be deferred, since the BeginElemSegmentInitExpr callback has to happen after the BeginElemSegment callback, but the reference type is not always known until after the initializer expression is read. To work around this, I added a new OnElemSegmentElemType callback. Other element segment changes: * The element type must be tracked in the SharedValidator * A subtle fix: when writing out the segment flags, we need to take into account whether the element type of the segment is not funcref, even if there are no element expressions. In that case, we have to use flag bit 0x4 (SegUseElemExprs). In addition, the TableCopy and TableInit instructions weren't handling table indexes fully. * TableCopy variables are read in the parser (both optional) * TableCopy names are now resolved + applied * TableCopy indexes are now validated * TableInit table variables are read in the parser; this is subtle, since the text format has order $table $segment, but the $table is optional.
* Use standard C++11 on GNU/Clang compilers (#1333)okuoku2020-02-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use _POSIX_C_SOURCE where applicable Use _POSIX_C_SOURCE=200809L everywhere except MSVC. For MinGW, it should have same effect in regard of `__USE_MINGW_ANSI_STDIO`. For Cygwin, it will allow to use POSIX APIs under `-std=c++11` environment. * binary-reader-objdump.cc: #include <strings.h> Include `strings.h` because it depends POSIX strcasecmp. * Disable `CMAKE_CXX_EXTENSIONS` explicitly Explicitly disable `CMAKE_CXX_EXTENSIONS` which is ON by default in recent CMake(>= 3.1) which will read implicit `-std=gnu++11` injection. * test-hexfloat: Use <thread> instead of sysconf Use <thread> instead of sysconf which is a bit more "standard" way to do this. * Guard <strings.h> with HAVE_STRCASECMP Guard `strings.h` with `HAVE_STRCASECMP` because non-POSIX platform may not have it.
* Cygwin build fixes (#1332)okuoku2020-02-111-1/+1
| | | | | | | | | | | | | | | * Workaround for Cygwin build On cygwin, `__STRICT_ANSI__` does not show POSIX definitions. Use gnu++11 language instead. * wasm-decompile: Silence -Wsign-compare Silence -Wsign-compare warning, by using unsigned literal one. * wasm-objdump: Fix 4294967296 output on disasm Use `%u` instead of `%lu` as we use `uint32_t` here.
* Support reading from stdin in ReadFile (#1313)Sam Clegg2020-01-231-0/+3
| | | | | | | | This allows tools that read input files to use the special `-` filename to read from stdin. Also, improve the error reported in general in ReadFile. See: #386
* reference-types: Add reference-types spec tests (#1225)Sam Clegg2019-11-251-4/+22
| | | | | | | This change adds most of the tests from the reference-types proposal. There are two tests that require new instructions (`table.fill` and `select_t`) which will be followup changes. See: #1223
* Switch to treating segment flags as a bitfield. NFC (#1232)Sam Clegg2019-11-181-14/+15
| | | | | | | | | | | This is in preparation for updating to latest version reference-types proposal where there is an additional flag and they can be combined. See: https://github.com/WebAssembly/bulk-memory-operations/issues/98 Also, add ERROR_IF to binary-reader.cc as logical corollary to the existing ERROR_UNLESS.
* wasm-objdump: Fix output for passive data elem segments (#1211)Sam Clegg2019-11-071-2/+8
| | | Split out from #1206
* wasm-objdump: Consistent output of table types (#1198)Oliver Horn2019-10-281-4/+5
| | | | | | Adjusts the output of table imports to the output of table declarations and other elements: - `type` instead of `elem_type` - limits: `initial` instead of `init`, check `has_max`
* wasm-objdump: Print `br_table` immediates (#1186)Oliver Horn2019-10-141-2/+8
| | | Print missing `br_table` immediates
* wasm-objdump: Fix type signature for multi-value result types (#1179)Oliver Horn2019-10-071-4/+17
| | | | | | | | | | Previously only the first result type was printed, even for multiple results. This change prints multiple result types in parenthesized form whereas single result types are printed as before. The `func-result-multi.txt` test case is modified to cover the Type section as well.
* wasm-objdump: Include more information about memory segments. (#1177)Sam Clegg2019-09-301-3/+14
|
* wasm-objdump: Add more symbol flags (#1162)Sam Clegg2019-09-191-12/+20
|
* Add support for ref.null in global initializers (#1131)Andy Wingo2019-07-251-0/+14
| | | | | | | | | As per the reference-types spec, ref.null is a constant expression. I did try to add support for ref.func at the same time, but I didn't really understand the strategy of wabt and reference types; there seems to be strong intertwingliness between func.ref and the element section, whereas it does seem possible for a func.ref to be global. Oh well, I didn't need it :)
* wasm-objdump: Improve display of comdat data (#1114)Sam Clegg2019-07-161-1/+19
|
* Match custom section names in wasm-objdump (#1097)Ben Smith2019-06-271-13/+25
| | | | | | | | | This way you can see the contents of just one custom section by using: ``` wasm-objdump -j section_name -x ``` Where `section_name` is the name of the custom section.
* Add support for comdat groups in the linking section (#1087)Sam Clegg2019-06-041-0/+19
|
* [wasm-objdump] Fix crash on invalid reloc sections (#1084)Sam Clegg2019-05-171-0/+6
|
* Implement bulk memory in the interpreter (#1074)Ben Smith2019-05-071-2/+4
| | | | | | | | | * Implement bulk memory in interpreter * Read/Write elem_type in element segments * Binary format * Text format (`(elem passive funcref...)`) * Add DataSegment runtime objects * Only initialize active data segments when instantiating
* Proper encoding of passive element segments (#1066)Ben Smith2019-04-181-7/+14
| | | | | * Store element segments as a vector of `ElemExpr`, instead of func index * Read/write binary format for each element expression * Read/write text format for each element expression
* Print function names on code details too (#1065)Ben Smith2019-04-171-1/+6
| | | | These names were already displayed on the function section, and when disassembling a function.
* Add names to locally declared globals. (#1057)Sam Clegg2019-04-031-0/+4
| | | These currently can only come from the export of a global.
* Make v128.const i32x4 op conform to the SIMD draft (#1037)gnzlbg2019-03-281-0/+1
| | | | | | | | | | | | | | * Update v128.const WAT parsing to conform to the SIMD draft * manually fix indentation * rename no_lanes to lane_count * Fix parsing of OOB integers * Update simd shuffle tests to new syntax * Add the v128.const type tokens to the lexer.
* wasm-objdump: Print names of globals used in init expression. (#1051)Sam Clegg2019-03-261-2/+8
|
* wasm-objdump: Include import module as part displayed name (#1049)Sam Clegg2019-03-211-2/+18
|
* Refactor objdump name handling a little (#1030)Ben Smith2019-03-031-55/+52
| | | | Use `ObjdumpNames` struct to share similar code for mapping indexes to names.
* [wasm-objdump] Show data segment names (#1028)Sam Clegg2019-03-031-6/+36
|
* wasm-objdump: fix f64 init expressions (#1029)Oliver Horn2019-03-031-1/+1
| | | | | | | The `PrintInitExpr` function falsely treated f64 as a float instead of a double. The test case `global.txt` also contained the wrong output, namely `0x0p+0` instead of `0x1p+2` for `(f64.const 4)`.
* [wabt-objdump] Refactored some functions to use string_view (#1027)Wouter van Oortmerssen2019-02-251-53/+51
|
* Improve support for event symbols and except_ref types (#1025)Wouter van Oortmerssen2019-02-241-0/+51
| | | | | | * Added except_ref to be legal in a block type signature * Added more support for event symbols.
* Add wasm-objdump fuzzing script; fix fuzz bugs (#1023)Ben Smith2019-02-201-2/+3
|
* [wasm-objdump] Implemented R_WASM_EVENT_INDEX_LEB reloc type. (#1022)Wouter van Oortmerssen2019-02-201-2/+0
| | | Also fixed 2 asserts that could trigger on user data.
* Add br_on_exn instruction (#1016)Ben Smith2019-02-131-0/+8
| | | | | | It takes two u32 immediates: the branch depth and an exception index. The stack signature is `[expect_ref] -> [except_ref]`, so the `except_ref` can be tested easily against multiple exception types.
* Parse updated event text and binary format (#1014)Ben Smith2019-02-121-20/+8
| | | | | | | | | | | | An event has a type-section index, like a function definition. The current proposal doesn't specify the text format, so I assumed that it would match the format of the other sections that reference function types. This means that the following declaration styles are allowed: ``` (type $t (func (param i32))) (event $e1 (type $t)) (event $e2 (param f32)) ```
* Rename exception -> event (#1013)Ben Smith2019-02-111-16/+16
|
* Remove the `if_except` instruction (#1009)Ben Smith2019-02-101-14/+0
| | | | It is no longer part of the exception proposal.
* wasm-objdump: Always show function numbers along with names (#1004)Sam Clegg2019-02-051-3/+3
| | | Since names are not always unique.
* Implement parsing and writing of DataCount section (#998)Ben Smith2019-01-231-2/+13
|
* Update linking metadata version (#996)Sam Clegg2019-01-171-12/+12
| | | | | Also make explicit when are showing log2 alignment. We could instead display actual byte alignment (1 << p2align)?
* The great renaming (#985)Ben Smith2018-12-191-4/+4
| | | | | | | | This huge PR does all the renaming as described in issue #933. It also updates to the latest testsuite so the new names are used. The old names of the MVP instructions are still supported for convenience (though we should remove those too at some point), but the old simd and atomic instruction names are no longer supported.