diff options
-rw-r--r-- | test/dump/relocations.txt | 39 | ||||
-rwxr-xr-x | test/run-wasmdump.py | 4 |
2 files changed, 42 insertions, 1 deletions
diff --git a/test/dump/relocations.txt b/test/dump/relocations.txt new file mode 100644 index 00000000..779b1f3c --- /dev/null +++ b/test/dump/relocations.txt @@ -0,0 +1,39 @@ +;;; TOOL: run-wasmdump +;;; FLAGS: --headers -r +(module + (type $t (func (param i32))) + (import "__extern" "foo" (func (param i32) (result i32))) + (global i32 (i32.const 0)) + (func $f (param i32) (result i32) + get_global 0 + call 1 + call 0) + (export "f" (func $f)) + (table anyfunc (elem $f))) +(;; STDOUT ;;; +relocations.wasm: file format wasm 0x000001 + +Sections: + + Type start=0x0000000a end=0x00000014 (size=0x0000000a) count: 2 + Import start=0x00000016 end=0x00000026 (size=0x00000010) count: 1 + Function start=0x00000028 end=0x0000002a (size=0x00000002) count: 1 + Table start=0x0000002c end=0x00000031 (size=0x00000005) count: 1 + Global start=0x00000033 end=0x00000039 (size=0x00000006) count: 1 + Export start=0x0000003b end=0x00000040 (size=0x00000005) count: 1 + Elem start=0x00000042 end=0x0000004d (size=0x0000000b) count: 1 + Code start=0x0000004f end=0x00000065 (size=0x00000016) count: 1 + Custom start=0x00000067 end=0x00000077 (size=0x00000010) "reloc.Elem" + Custom start=0x00000079 end=0x0000008f (size=0x00000016) "reloc.Code" + +Code Disassembly: + +000050 func[1]: + 000052: 23 80 80 80 80 00 | get_global 0 + 000053: R_GLOBAL_INDEX_LEB 0 + 000058: 10 81 80 80 80 00 | call 0x1 + 000059: R_FUNC_INDEX_LEB 1 + 00005e: 10 80 80 80 80 00 | call 0 + 00005f: R_FUNC_INDEX_LEB 0 + 000064: 0b | end +;;; STDOUT ;;) diff --git a/test/run-wasmdump.py b/test/run-wasmdump.py index efb3eb2c..8bd3d246 100755 --- a/test/run-wasmdump.py +++ b/test/run-wasmdump.py @@ -50,6 +50,7 @@ def main(args): parser.add_argument('--gen-wasm', action='store_true', help='parse with gen-wasm') parser.add_argument('--spec', action='store_true') + parser.add_argument('-r', '--relocatable', action='store_true') parser.add_argument('--no-canonicalize-leb128s', action='store_true') parser.add_argument('--debug-names', action='store_true') parser.add_argument('file', help='test file.') @@ -70,6 +71,7 @@ def main(args): '--no-canonicalize-leb128s': options.no_canonicalize_leb128s, '--spec': options.spec, '-v': options.verbose, + '-r': options.relocatable, '-c': options.compile_only, }) @@ -108,7 +110,7 @@ def main(args): wasm_files = [out_file] for wasm_file in wasm_files: - wasmdump.RunWithArgs('-d', wasm_file) + wasmdump.RunWithArgs('-r', '-d', wasm_file) if __name__ == '__main__': |