LinuxCommandLibrary

wasm-objdump

Disassemble WebAssembly binary files

TLDR

Display the section headers of a given binary

$ wasm-objdump [[-h|--headers]] [file.wasm]
copy

Display the entire disassembled output of a given binary
$ wasm-objdump [[-d|--disassemble]] [file.wasm]
copy

Display the details of each section
$ wasm-objdump [[-x|--details]] [file.wasm]
copy

Display the details of a given section
$ wasm-objdump [[-j|--section]] '[import]' [[-x|--details]] [file.wasm]
copy

SYNOPSIS

wasm-objdump [options] file

PARAMETERS

-h, --headers
    Display the header information of the Wasm module.

-s, --sections
    Display all sections of the Wasm module.

-d, --disassemble
    Disassemble all code sections of the Wasm module.

-x, --all-headers
    Display all header information and section contents.

-r, --relocations
    Display relocation entries in the file.

-f, --file-headers
    Display the file headers.

-j , --section=
    Dump the contents of the specified section.

--details
    Print detailed information about the file.

--start-address=


    Specify the start address for disassembly.

--stop-address=

    Specify the stop address for disassembly.

--version
    Display the version of `wasm-objdump`.

--help
    Display help information.


    The WebAssembly file to inspect.

DESCRIPTION

The `wasm-objdump` command is a disassembler and inspection tool for WebAssembly (Wasm) binary files. It allows developers to examine the internal structure of Wasm modules, including sections, functions, instructions, imports, exports, and metadata. This command is a valuable tool for understanding the compiled WebAssembly code, debugging issues, and analyzing the performance characteristics of Wasm modules. `wasm-objdump` can display a variety of information, from raw byte representations to human-readable disassembled code, making it useful for both low-level analysis and higher-level understanding of Wasm modules. It helps when porting to WebAssembly, to ensure that the port has been successfully and effectively generated.

CAVEATS

Disassembly may be challenging to interpret without a strong understanding of the WebAssembly instruction set. Results can vary depending on the specific version of the toolchain used to generate the Wasm module.

EXIT STATUS

The exit status is 0 on success, and non-zero on errors (e.g., invalid command-line arguments or failure to open/process the specified file).

EXAMPLES

Displaying Headers:
wasm-objdump -h my_module.wasm

Disassembling Code:
wasm-objdump -d my_module.wasm

Displaying Section Contents:
wasm-objdump -j .data my_module.wasm

HISTORY

wasm-objdump is a relatively recent tool, developed alongside the rise and standardization of WebAssembly. It is typically part of a WebAssembly toolchain, such as the Binaryen toolkit or the WebAssembly System Interface (WASI) SDK. Its development closely tracks the evolution of the WebAssembly specification.

SEE ALSO

objdump(1)

Copied to clipboard