The WebAssembly Binary Toolkit

Overview

Github CI Status

WABT: The WebAssembly Binary Toolkit

WABT (we pronounce it "wabbit") is a suite of tools for WebAssembly, including:

  • wat2wasm: translate from WebAssembly text format to the WebAssembly binary format
  • wasm2wat: the inverse of wat2wasm, translate from the binary format back to the text format (also known as a .wat)
  • wasm-objdump: print information about a wasm binary. Similiar to objdump.
  • wasm-interp: decode and run a WebAssembly binary file using a stack-based interpreter
  • wasm-decompile: decompile a wasm binary into readable C-like syntax.
  • wat-desugar: parse .wat text form as supported by the spec interpreter (s-expressions, flat syntax, or mixed) and print "canonical" flat format
  • wasm2c: convert a WebAssembly binary file to a C source and header
  • wasm-strip: remove sections of a WebAssembly binary file
  • wasm-validate: validate a file in the WebAssembly binary format
  • wast2json: convert a file in the wasm spec test format to a JSON file and associated wasm binary files
  • wasm-opcodecnt: count opcode usage for instructions
  • spectest-interp: read a Spectest JSON file, and run its tests in the interpreter

These tools are intended for use in (or for development of) toolchains or other systems that want to manipulate WebAssembly files. Unlike the WebAssembly spec interpreter (which is written to be as simple, declarative and "speccy" as possible), they are written in C/C++ and designed for easier integration into other systems. Unlike Binaryen these tools do not aim to provide an optimization platform or a higher-level compiler target; instead they aim for full fidelity and compliance with the spec (e.g. 1:1 round-trips with no changes to instructions).

Online Demos

Wabt has been compiled to JavaScript via emscripten. Some of the functionality is available in the following demos:

Supported Proposals

  • Proposal: Name and link to the WebAssembly proposal repo
  • flag: Flag to pass to the tool to enable/disable support for the feature
  • default: Whether the feature is enabled by default
  • binary: Whether wabt can read/write the binary format
  • text: Whether wabt can read/write the text format
  • validate: Whether wabt can validate the syntax
  • interpret: Whether wabt can execute these operations in wasm-interp or spectest-interp
Proposal flag default binary text validate interpret
exception handling --enable-exceptions
mutable globals --disable-mutable-globals
nontrapping float-to-int conversions --disable-saturating-float-to-int
sign extension --disable-sign-extension
simd --disable-simd
threads --enable-threads
multi-value --disable-multi-value
tail-call --enable-tail-call
bulk memory --disable-bulk-memory
reference types --disable-reference-types
annotations --enable-annotations
memory64 --enable-memory64
multi-memory --enable-multi-memory

Cloning

Clone as normal, but don't forget to get the submodules as well:

$ git clone --recursive https://github.com/WebAssembly/wabt
$ cd wabt
$ git submodule update --init

This will fetch the testsuite and gtest repos, which are needed for some tests.

Building using CMake directly (Linux and macOS)

You'll need CMake. You can then run CMake, the normal way:

$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .

This will produce build files using CMake's default build generator. Read the CMake documentation for more information.

NOTE: You must create a separate directory for the build artifacts (e.g. build above). Running cmake from the repo root directory will not work since the build produces an executable called wasm2c which conflicts with the wasm2c directory.

Building using the top-level Makefile (Linux and macOS)

NOTE: Under the hood, this uses make to run CMake, which then calls ninja to perform that actual build. On some systems (typically macOS), this doesn't build properly. If you see these errors, you can build using CMake directly as described above.

You'll need CMake and Ninja. If you just run make, it will run CMake for you, and put the result in out/clang/Debug/ by default:

Note: If you are on macOS, you will need to use CMake version 3.2 or higher

$ make

This will build the default version of the tools: a debug build using the Clang compiler.

There are many make targets available for other configurations as well. They are generated from every combination of a compiler, build type and configuration.

  • compilers: gcc, clang, gcc-i686, emcc
  • build types: debug, release
  • configurations: empty, asan, msan, lsan, ubsan, fuzz, no-tests

They are combined with dashes, for example:

$ make clang-debug
$ make gcc-i686-release
$ make clang-debug-lsan
$ make gcc-debug-no-tests

Building (Windows)

You'll need CMake. You'll also need Visual Studio (2015 or newer) or MinGW.

Note: Visual Studio 2017 and later come with CMake (and the Ninja build system) out of the box, and should be on your PATH if you open a Developer Command prompt. See https://aka.ms/cmake for more details.

You can run CMake from the command prompt, or use the CMake GUI tool. See Running CMake for more information.

When running from the commandline, create a new directory for the build artifacts, then run cmake from this directory:

> cd [build dir]
> cmake [wabt project root] -DCMAKE_BUILD_TYPE=[config] -DCMAKE_INSTALL_PREFIX=[install directory] -G [generator]

The [config] parameter should be a CMake build type, typically DEBUG or RELEASE.

The [generator] parameter should be the type of project you want to generate, for example "Visual Studio 14 2015". You can see the list of available generators by running cmake --help.

To build the project, you can use Visual Studio, or you can tell CMake to do it:

> cmake --build [wabt project root] --config [config] --target install

This will build and install to the installation directory you provided above.

So, for example, if you want to build the debug configuration on Visual Studio 2015:

> mkdir build
> cd build
> cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=..\ -G "Visual Studio 14 2015"
> cmake --build . --config DEBUG --target install

Adding new keywords to the lexer

If you want to add new keywords, you'll need to install gperf. Before you upload your PR, please run make update-gperf to update the prebuilt C++ sources in src/prebuilt/.

Running wat2wasm

Some examples:

# parse and typecheck test.wat
$ bin/wat2wasm test.wat

# parse test.wat and write to binary file test.wasm
$ bin/wat2wasm test.wat -o test.wasm

# parse spec-test.wast, and write verbose output to stdout (including the
# meaning of every byte)
$ bin/wat2wasm spec-test.wast -v

You can use --help to get additional help:

$ bin/wat2wasm --help

Or try the online demo.

Running wasm2wat

Some examples:

# parse binary file test.wasm and write text file test.wat
$ bin/wasm2wat test.wasm -o test.wat

# parse test.wasm and write test.wat
$ bin/wasm2wat test.wasm -o test.wat

You can use --help to get additional help:

$ bin/wasm2wat --help

Or try the online demo.

Running wasm-interp

Some examples:

# parse binary file test.wasm, and type-check it
$ bin/wasm-interp test.wasm

# parse test.wasm and run all its exported functions
$ bin/wasm-interp test.wasm --run-all-exports

# parse test.wasm, run the exported functions and trace the output
$ bin/wasm-interp test.wasm --run-all-exports --trace

# parse test.json and run the spec tests
$ bin/wasm-interp test.json --spec

# parse test.wasm and run all its exported functions, setting the value stack
# size to 100 elements
$ bin/wasm-interp test.wasm -V 100 --run-all-exports

You can use --help to get additional help:

$ bin/wasm-interp --help

Running wast2json

See wast2json.md.

Running wasm-decompile

For example:

# parse binary file test.wasm and write text file test.dcmp
$ bin/wasm-decompile test.wasm -o test.dcmp

You can use --help to get additional help:

$ bin/wasm-decompile --help

See decompiler.md for more information on the language being generated.

Running wasm2c

See wasm2c.md

Running the test suite

See test/README.md.

Sanitizers

To build with the LLVM sanitizers, append the sanitizer name to the target:

$ make clang-debug-asan
$ make clang-debug-msan
$ make clang-debug-lsan
$ make clang-debug-ubsan

There are configurations for the Address Sanitizer (ASAN), Memory Sanitizer (MSAN), Leak Sanitizer (LSAN) and Undefine Behavior Sanitizer (UBSAN). You can read about the behaviors of the sanitizers in the link above, but essentially the Address Sanitizer finds invalid memory accesses (use after free, access out-of-bounds, etc.), Memory Sanitizer finds uses of uninitialized memory, the Leak Sanitizer finds memory leaks, and the Undefined Behavior Sanitizer finds undefined behavior (surprise!).

Typically, you'll just want to run all the tests for a given sanitizer:

$ make test-asan

You can also run the tests for a release build:

$ make test-clang-release-asan
...

The GitHub actions bots run all of these tests (and more). Before you land a change, you should run them too. One easy way is to use the test-everything target:

$ make test-everything

Fuzzing

To build using the LLVM fuzzer support, append fuzz to the target:

$ make clang-debug-fuzz

This will produce a wasm2wat_fuzz binary. It can be used to fuzz the binary reader, as well as reproduce fuzzer errors found by oss-fuzz.

$ out/clang/Debug/fuzz/wasm2wat_fuzz ...

See the libFuzzer documentation for more information about how to use this tool.

Comments
  • Integrating with OSS-Fuzz

    Integrating with OSS-Fuzz

    Greetings wabt developers and contributors,

    We’re reaching out because your project is an important part of the open source ecosystem, and we’d like to invite you to integrate with our fuzzing service, OSS-Fuzz. OSS-Fuzz is a free fuzzing infrastructure you can use to identify security vulnerabilities and stability bugs in your project. OSS-Fuzz will:

    • Continuously run at scale all the fuzzers you write.
    • Alert you when it finds issues.
    • Automatically close issues after they’ve been fixed by a commit.

    Many widely used open source projects like OpenSSL, FFmpeg, LibreOffice, and ImageMagick are fuzzing via OSS-Fuzz, which helps them find and remediate critical issues.

    Even though typical integrations can be done in < 100 LoC, we have a reward program in place which aims to recognize folks who are not just contributing to open source, but are also working hard to make it more secure.

    We want to stress that anyone who meets the eligibility criteria and integrates a project with OSS-Fuzz is eligible for a reward.

    To help you getting started, we can attach our internal fuzzer for your project that you are welcome to use directly, or to use it as a starting point.

    If you're not interested in integrating with OSS-Fuzz, it would be helpful for us to understand why—lack of interest, lack of time, or something else—so we can better support projects like yours in the future.

    If we’ve missed your question in our FAQ, feel free to reply or reach out to us at [email protected].

    Thanks!

    Tommy OSS-Fuzz Team

    opened by Google-Autofuzz 26
  • Update SIMD support

    Update SIMD support

    This PR updates SIMD support corresponding to changes in the WebAssembly/simd proposal repo from the following PRs:

    https://github.com/WebAssembly/simd/pull/321 https://github.com/WebAssembly/simd/pull/322 https://github.com/WebAssembly/simd/pull/341 https://github.com/WebAssembly/simd/pull/344

    This should not be merged until https://github.com/WebAssembly/testsuite/pull/32 is merged since it needs the updated testsuite using the new syntax for the SIMD tests.

    For the moment I have pointed the third_party/testsuite to my local branch which has the recent changes from WebAssembly/simd merged.

    Note that in the PR I referenced for the WebAssembly/testsuite there will be additional (probably minor) breakage from recent changes in other proposal repos but I didn't include fixes for all of those here since I wanted this PR to focus on SIMD.

    opened by silvanshade 21
  • WASI Integration

    WASI Integration

    This PR brings WASI to wabt using wasienv.

    Old description - wapm integration

    We just released WAPM: a Package Manager for WebAssembly (announcement here).

    We adapted wabt to emit .wasm files (using Emscripten) and then published to wapm so they can be used very easily (just one install command) across any OS/platform.

    You can try it with:

    # First, let's install wapm
    curl https://get.wasmer.io -sSfL | sh
    
    # Then, install wabt
    wapm install wabt
    
    # And then, you can use wasm2wat, ...
    wapm run wasm2wat ...
    

    It would be awesome if it could be integrated (maybe in the CI?) so any new releases are published automatically.

    Let me know your thoughts!! :)


    In order to be able to transfer you the ownership of the wabt package on wapm, I would need an username. You can register here: https://wapm.io/signup

    opened by syrusakbary 19
  • Library sandboxing changes - support for per instance, cross platform, wasi, some debugging

    Library sandboxing changes - support for per instance, cross platform, wasi, some debugging

    List of features

    • Windows/msvc support for runtime, codegen and builtins as well as support for a wider list of platforms/architectures/compilers including Android (arm architectures), Windows 32-bit etc.
    • Support for growable indirect function call tables
    • Support for library sandboxing apis --- wasm function type index lookup (so host can add new callbacks), make heaps aligned to 4gb for compatiblity with the RLBox sandboxing framework
    • Allow multiple sandbox instances of the same library by moving global vars into a context structure that is passed to every function
    • Migrated from emscripten to use of wasi-clang
    • Upstream libc-wasi does not support windows, so I have written a minimal cross platform wasi support which includes just basic wasi function (just enough to get simple IO libraries running. Nothing complicated like networking or filesystem is supported)
    • Removed use of per function call signal handler, setjmp/longjmp as this slows transitions
    • Removed name mangling to simplify function lookup
    • Option to remove stack depth counting as this adds unnecessary overhead
    • A debugging aid built directly into wasm2c generated code that is similar to valgrind like shadow memory (significantly eases debugging of wasm)
    • A wasm2c runner that can run full applications (code that has a main), when they are compiled via wasm2c to C and then to a shared library (.so/.dll)
    opened by shravanrn 18
  • wabt fails to build from source because of missing wasm.h

    wabt fails to build from source because of missing wasm.h

    When I try to build wabt 1.0.13 from source, the build fails because wasm.h is not present in the source package.

    I know that wasm.h is present in binaryen, but I don't understand how

    src/interp/interp-wasm-c-api.cc

    can be built from source in wabt without wasm.h.

    In version 1.0.12 wasm.h was not required to compile interp-wasm-c-api.cc.

    Please clarify how to build wabt from source in version 1.0.13

    help wanted 
    opened by apoleon 17
  • Fix architecture checks

    Fix architecture checks

    This PR consists of two tightly related changes. It depends on #1968

    1. Fix x87 math detection

    TARGET_ARCH was only used to determine whether to add gcc-specific SSE math flags (-msse2 -mfpmath=sse). The new approach simply assumes gcc compatibility with its __i386__ and __SSE2_MATH__ symbols, which are defined precisely when we are targeting x86-32 with SSE2 math enabled. If those macros are defined, then we conclude all is well. Otherwise, we add the flags if we know the compiler is gcc or clang (and will thus accept them) and issue a warning if the compiler is unknown.

    Fixes #1709 Fixes #1688

    2. Use standard modules to test endianness

    CMake prior to v3.20 provides a module TestBigEndian which we can use to set the WABT_BIG_ENDIAN define. As of 3.20, the CMAKE_<LANG>_BYTE_ORDER variable should be preferred. Leaving this as a note for the future.

    opened by alexreinking 15
  • Clang-format codebase

    Clang-format codebase

    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.

    This PR is mainly to listen to opinions and it is OK we end up not merging this. (Also even if we end up merging this, I'm not sure if I am the right person to change this many lines of code, given that I am not a frequent contributor in this repo.)

    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.

    opened by aheejin 15
  • Improve error message when python 3 not available - Fix for  #1385

    Improve error message when python 3 not available - Fix for #1385

    https://github.com/WebAssembly/wabt/issues/1385

    In this PR, I have made python optional in CMakeLists.txt . I have tested locally by bumping the required version to 3.8 which is not existing on my Mac.

    I have noticed that the below tests are run from python file - test/run-c-api-examples.py.

    • c_api_example(callback)
    • c_api_example(finalize)
    • c_api_example(global)
    • c_api_example(hello)
    • c_api_example(hostref)
    • c_api_example(multi)
    • c_api_example(memory)
    • c_api_example(reflect)
    • c_api_example(serialize)
    • c_api_example(start)
    • c_api_example(table)
    • c_api_example(trap)

    Do we need to port run-c-api-examples.py to gtest file or cpp file?

    opened by lkarthee 15
  • fatal error: 'string' file not found

    fatal error: 'string' file not found

    $ make
    
    .....
    Scanning dependencies of target libwabt
    [  1%] Building CXX object CMakeFiles/libwabt.dir/src/token.cc.o
    In file included from /Users/sam/wasm/wabt/src/token.cc:17:
    /Users/sam/itt/wasm/wabt/src/token.h:20:10: fatal error: 'string' file not found
    #include <string>
             ^~~~~~~~
    1 error generated.
    make[3]: *** [CMakeFiles/libwabt.dir/src/token.cc.o] Error 1
    make[2]: *** [CMakeFiles/libwabt.dir/all] Error 2
    make[1]: *** [all] Error 2
    make: *** [clang-debug] Error 2
    

    How to fix it?

    cmake version: 3.8.0 mac version: 10.13.3 High Sierra

    opened by abdulgalimov 15
  • Allow use of guard pages without requiring a signal handler

    Allow use of guard pages without requiring a signal handler

    The Firefox use case of sandboxing untrusted libraries with Wasm is incompatible with use of signal handlers in wasm2c. This is because Firefox has its own signal handler, with a crash report, stack walking, telemetry handling etc. However, for speed, we still need to use the guard page (8gb model) to trap OOB linear memory accesses from sandboxed libraries (versus memory bounds/range checks). Given that Firefox also does not attempt to recover from any linear memory OOB, the easiest option is to give a macro that disables the install and use of signal handlers.

    opened by shravanrn 14
  • Implement Relaxed SIMD proposal

    Implement Relaxed SIMD proposal

    This adds support for the new opcodes from the Relaxed SIMD proposal (https://github.com/WebAssembly/relaxed-simd) behind the "--enable-relaxed-simd" flag.

    opened by marcusb 14
  • spec/relaxed-simd/relaxed_madd_nmadd.txt test fails on ARM 64-bit (aarch64), Power8 (ppc64le), z/Architecture (s390x)

    spec/relaxed-simd/relaxed_madd_nmadd.txt test fails on ARM 64-bit (aarch64), Power8 (ppc64le), z/Architecture (s390x)

    When running 1.0.32 testsuite on aarch64 under Fedora 36, I get the following new failure:

    - test/spec/relaxed-simd/relaxed_madd_nmadd.txt
      expected error code 0, got 2.
      STDOUT MISMATCH:
      --- expected
      +++ actual
      @@ -1 +1,3 @@
      -7/7 tests passed.
      +out/test/spec/relaxed-simd/relaxed_madd_nmadd.wast:38: mismatch in result of assert_return: expected v128 f32:0.000000f32:0.000000f32:0.000000f32:0.000000 (2 alternatives), got v128 i32x4:0xad000000 0xad000000 0xad000000 0xad000000
      +out/test/spec/relaxed-simd/relaxed_madd_nmadd.wast:73: mismatch in result of assert_return: expected v128 f64:0.000000f64:0.000000 (2 alternatives), got v128 i32x4:0x00000000 0xbca00000 0x00000000 0xbca00000
      +5/7 tests passed.
    

    Similarly on ppc64le:

    - test/spec/relaxed-simd/relaxed_madd_nmadd.txt
      expected error code 0, got 2.
      STDOUT MISMATCH:
      --- expected
      +++ actual
      @@ -1 +1,3 @@
      -7/7 tests passed.
      +out/test/spec/relaxed-simd/relaxed_madd_nmadd.wast:38: mismatch in result of assert_return: expected v128 f32:0.000000f32:0.000000f32:0.000000f32:0.000000 (2 alternatives), got v128 i32x4:0xad000000 0xad000000 0xad000000 0xad000000
      +out/test/spec/relaxed-simd/relaxed_madd_nmadd.wast:73: mismatch in result of assert_return: expected v128 f64:0.000000f64:0.000000 (2 alternatives), got v128 i32x4:0x00000000 0xbca00000 0x00000000 0xbca00000
      +5/7 tests passed.
    

    And on s390x (big-endian):

    - test/spec/relaxed-simd/relaxed_madd_nmadd.txt
      expected error code 0, got 2.
      STDOUT MISMATCH:
      --- expected
      +++ actual
      @@ -1 +1,3 @@
      -7/7 tests passed.
      +out/test/spec/relaxed-simd/relaxed_madd_nmadd.wast:38: mismatch in result of assert_return: expected v128 f32:0.000000f32:0.000000f32:0.000000f32:0.000000 (2 alternatives), got v128 i32x4:0xad000000 0xad000000 0xad000000 0xad000000
      +out/test/spec/relaxed-simd/relaxed_madd_nmadd.wast:73: mismatch in result of assert_return: expected v128 f64:0.000000f64:0.000000 (2 alternatives), got v128 i32x4:0x00000000 0xbca00000 0x00000000 0xbca00000
      +5/7 tests passed.
    
    opened by rathann 1
  • wasm2c: lock func indexes as they are shared across wasm instances

    wasm2c: lock func indexes as they are shared across wasm instances

    For the Firefox use case, we will be creating multiple wasm instances dynamically on concurrent threads. Currently, the creation of the instances is racy when querying/updating the function type indexes, as this is data shared across wasm instances. This PR fixes this by locking any query/update of the function indexes.

    This PR follows a discussion at https://github.com/WebAssembly/wabt/issues/2046

    opened by shravanrn 0
  • build and publish a wasi binary on release

    build and publish a wasi binary on release

    If wabt was compiled for a wasi target, any wasi runtime can run it which provides flexibility both for ad-hoc CLI use (broader than the binaries on the release page) as well embedded use (without dynamic libraries)

    For example, wazero could use this to keep dev dependencies light for wat based tests and also spec tests. Right now, we need an offline installation step and shell forking to use wat2wasm

    opened by codefromthecrypt 1
  • option for wasm-validate to output context

    option for wasm-validate to output context

    Currently wasm-validate outputs the offending operation, however the context needs to be grep'ed manually:

    wasm-validate  main.wasm   
    main.wasm:000007b: error: type mismatch in i32.and, expected [i32, i32] but got [... i64, i32]
    
    wasm-objdump main.wasm -d | g -B3 7b
     000077: 20 03                      |   local.get 3 <width>
     000079: 53                         |   i64.lt_s
     00007a: 71                         |   i32.and
     00007b: 04 40                      |   if
    

    It would be nice to have a flag for wasm-validate to directly output the context, maybe even smart enough to trace back all relevant preceding ops.

    opened by pannous 0
  • wasm2c tests fail on 32-bit due to assumption that pointers are 64-bit

    wasm2c tests fail on 32-bit due to assumption that pointers are 64-bit

    The spectest_make_externref() in test/spec-wasm2c-prefix.c:203 assumes that u64 (uint64_t) can be converted to wasm_rt_externref_t (void *). This is not the case on 32-bit platforms:

    - test/regress/regress-2039.txt
      expected error code 0, got 1.
      STDERR MISMATCH:
      --- expected
      +++ actual
      @@ -0,0 +1,19 @@
      +out/test/regress/regress-2039/regress-2039-main.c: In function ‘spectest_make_externref’:
      +out/test/regress/regress-2039/regress-2039-main.c:205:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
      +  205 |   return (wasm_rt_externref_t)(x + 1);  // externref(0) is not null
      +      |          ^
      +At top level:
      +cc1: note: unrecognized command-line option ‘-Wno-tautological-constant-out-of-range-compare’ may have been intended to silence earlier diagnostics
      +cc1: note: unrecognized command-line option ‘-Wno-ignored-optimization-argument’ may have been intended to silence earlier diagnostics
      +cc1: all warnings being treated as errors
      +Traceback (most recent call last):
      +  File "/builddir/build/BUILD/wabt-1.0.31/test/run-spec-wasm2c.py", line 554, in <module>
      +    sys.exit(main(sys.argv[1:]))
      +  File "/builddir/build/BUILD/wabt-1.0.31/test/run-spec-wasm2c.py", line 536, in main
      +    o_filenames.append(Compile(cc, main_filename, out_dir, includes))
      +  File "/builddir/build/BUILD/wabt-1.0.31/test/run-spec-wasm2c.py", line 408, in Compile
      +    cc.RunWithArgsForStdout(*args)
      +  File "/builddir/build/BUILD/wabt-1.0.31/test/utils.py", line 88, in RunWithArgsForStdout
      +    raise error
      +utils.Error: Error running "gcc -I/builddir/build/BUILD/wabt-1.0.31/wasm2c -c out/test/regress/regress-2039/regress-2039-main.c -o out/test/regress/regress-2039/regress-2039-main.o -O2 -Wall -Werror -Wno-unused -Wno-ignored-optimization-argument -Wno-tautological-constant-out-of-range-compare -Wno-infinite-recursion -Wno-array-bounds -Wbidi-chars=none -fno-optimize-sibling-calls -frounding-math -fsignaling-nans -std=c99 -D_DEFAULT_SOURCE" (1):
      +None
      STDOUT MISMATCH:
      --- expected
      +++ actual
      @@ -1 +0,0 @@
      -0/0 tests passed.
    

    The same error occurs with all wasm2c tests. This can be fixed with a trivial patch:

    diff -up wabt-1.0.31/test/spec-wasm2c-prefix.c.32bit wabt-1.0.31/test/spec-wasm2c-prefix.c
    --- wabt-1.0.31/test/spec-wasm2c-prefix.c.32bit 2022-11-14 05:43:40.000000000 +0100
    +++ wabt-1.0.31/test/spec-wasm2c-prefix.c       2022-12-11 22:17:36.181299604 +0100
    @@ -200,7 +200,7 @@ static bool is_equal_wasm_rt_funcref_t(w
              (x.module_instance == y.module_instance);
     }
    
    -wasm_rt_externref_t spectest_make_externref(u64 x) {
    +wasm_rt_externref_t spectest_make_externref(uintptr_t x) {
       return (wasm_rt_externref_t)(x + 1);  // externref(0) is not null
     }
    

    Additionally, the example code in wasm2c/examples/fac/fac.c makes assumptions that memory addresses are 64-bit, too, for example in lines 71, 81, 97 and 106. The code should use uintptr_t instead in the above lines, too.

    opened by rathann 2
Releases(1.0.32)
Owner
WebAssembly
Development of WebAssembly and associated infrastructure
WebAssembly
A prototype WebAssembly linker using module linking.

WebAssembly Module Linker Please note: this is an experimental project. wasmlink is a prototype WebAssembly module linker that can link together a mod

Peter Huene 19 Oct 28, 2022
Sealed boxes implementation for Rust/WebAssembly.

Sealed boxes for Rust/WebAssembly This Rust crate provides libsodium sealed boxes for WebAssembly. Usage: // Recipient: create a new key pair let reci

Frank Denis 16 Aug 28, 2022
WebAssembly on Rust is a bright future in making application runs at the Edge or on the Serverless technologies.

WebAssembly Tour WebAssembly on Rust is a bright future in making application runs at the Edge or on the Serverless technologies. We spend a lot of ti

Thang Chung 129 Dec 28, 2022
WebAssembly modules that use Azure services

This is an experimental repository containing WebAssembly modules running on top of WAGI (WebAssembly Gateway Interface, which allows you to run WebAssembly WASI binaries as HTTP handlers) and using Azure services.

null 7 Apr 18, 2022
WebAssembly Service Porter

WebAssembly Service Porter.

henrylee2cn 12 Dec 12, 2022
🚀Wasmer is a fast and secure WebAssembly runtime that enables super lightweight containers to run anywhere

Wasmer is a fast and secure WebAssembly runtime that enables super lightweight containers to run anywhere: from Desktop to the Cloud, Edge and IoT devices.

Wasmer 14.1k Jan 8, 2023
WAGI: WebAssembly Gateway Interface

Write HTTP handlers in WebAssembly with a minimal amount of work

null 724 Jan 6, 2023
A console and web-based Gomoku written in Rust and WebAssembly

?? rust-gomoku A console and web-based Gomoku written in Rust and WebAssembly Getting started with cargo & npm Install required program, run # install

namkyu1999 2 Jan 4, 2022
WebAssembly development with Trunk & Vite.js

Trunk & Vite.js Demo Trunk is a WASM web application bundler for Rust, and Vite.js is next Generation Frontend Tooling. Ok, they are together now for

Libing Chen 6 Nov 24, 2021
darkforest is a console and web-based Roguelike written in Rust and WebAssembly.

darkforest darkforest is a console and web-based Roguelike written in Rust and WebAssembly. Key Features TBA Quick Start TBA How To Contribute Contrib

Chris Ohk 5 Oct 5, 2021
WebAssembly to Lua translator, with runtime

This is a WIP (read: absolutely not ready for serious work) tool for translating WebAssembly into Lua. Support is specifically for LuaJIT, with the se

null 43 Dec 31, 2022
A Rust ESP stack trace decoder that can also runs in your browser thanks to WebAssembly

ESP Stack Trace Decoder A Rust ESP stack trace decoder that can also runs in your browser thanks to WebAssembly. It is composed of a ⌨️ Rust library,

Maxime BORGES 20 Oct 5, 2022
Simple file sharing with client-side encryption, powered by Rust and WebAssembly

Hako Simple file sharing with client-side encryption, powered by Rust and WebAssembly Not feature-packed, but basic functionalities are just working.

Jaehyeon Park 30 Nov 25, 2022
bn.js bindings for Rust & WebAssembly with primitive-types support

bn.rs bn.js bindings for Rust & WebAssembly with primitive-types support Write Rust code that uses BN use std::str::FromStr; use primitive_types::{H1

Alexey Shekhirin 23 Nov 22, 2022
A handy calculator, based on Rust and WebAssembly.

qubit ?? Visit Website To Use Calculator Example ?? Visit Website To Use Calculator 2 + 2

Abhimanyu Sharma 55 Dec 26, 2022
A simple compile-to-WebAssembly language rewritten in Rust

chasm A very simple compile-to-WebAssembly language You can play with chasm online. This is a rewrite in Rust of the compiler for the language chasm.

null 11 Nov 27, 2022
Webassembly binding for Hora Approximate Nearest Neighbor Search Library

hora-wasm [Homepage] [Document] [Examples] [Hora] Javascript bidding for the Hora Approximate Nearest Neighbor Search, in WebAssembly way. Features Pe

Hora-Search 26 Sep 23, 2022
Stylist is a CSS-in-Rust styling solution for WebAssembly Applications.

Stylist Stylist is a CSS-in-Rust styling solution for WebAssembly Applications. This is a fork of css-in-rust. Install Add the following to your Cargo

Kaede Hoshikawa 190 Dec 30, 2022
A template project to demonstrate how to run WebAssembly functions as sidecar microservices in dapr

Demo and tutorials Live Demo | Tutorial article | Tutorial video 1. Introduction DAPR is a portable, event-driven runtime that makes it easy for any d

Second State 184 Dec 29, 2022