bin+lib wasmonkey

Patch a WASM object file to replace a set of exported functions with imported functions from another library

9 releases

✓ Uses Rust 2018 edition

new 0.1.8 Jul 11, 2019
0.1.7 Jun 27, 2019
0.1.6 Mar 12, 2019
0.1.5 Nov 23, 2018
0.1.4 May 31, 2018

#61 in WebAssembly

Download history 8/week @ 2019-03-28 8/week @ 2019-04-04 2/week @ 2019-04-11 7/week @ 2019-04-18 2/week @ 2019-04-25 8/week @ 2019-05-02 7/week @ 2019-05-09 8/week @ 2019-05-16 8/week @ 2019-05-23 7/week @ 2019-06-06 23/week @ 2019-06-13 21/week @ 2019-06-20 55/week @ 2019-06-27 58/week @ 2019-07-04

69 downloads per month
Used in 5 crates (1 directly)

ISC license

38KB
1K SLoC

Rust 687 SLoC // 0.0% comments Assembly 430 SLoC C 73 SLoC

WASMonkey

The WASMonkey patches a WASM object file to replace a set of exported functions with imported functions from another library.

Usage

USAGE:
    wasmonkey [FLAGS] [OPTIONS] --input <input_file> --output <output_file>

FLAGS:
    -n, --original-names    Use the original name as a key in the builtins map
    -h, --help              Prints help information
    -V, --version           Prints version information

OPTIONS:
    -B, --builtins-additional <builtins_additional>...    Additional builtins function names to replace
    -b, --builtins <builtins_file>                        Path to the builtins library
    -m, --builtins-map <builtins_map_file>                Path to the builtins map file
    -i, --input <input_file>                              Path to the input file
    -o, --output <output_file>                            Path to the output file

builtins_file is an object containing alternative implementations to funcitons called in the wasm code.

Symbols starting with a builtin_ prefix will be used for substitution.

For example, a memmove() function defined as an external in the WASM object will be replaced by calls to an imported builtin_memmove() function, if builtin_memmove() is present in the builtins file.

A JSON-encoded map of the performed substitutions can be optionally written into builtins_map_file.

Dependencies

~3.5MB
~67K SLoC