Skip to content

Support wasm3 compile flags #22

@jiayihu

Description

@jiayihu

With #21 one can pass the propert clang flags in order to set the compilation flags in https://github.com/wasm3/wasm3/blob/master/source/m3_config.h, for instance:

BINDGEN_EXTRA_CLANG_ARGS="--sysroot=/usr/local/opt/gcc-arm-none-eabi/arm-none-eabi -Dd_m3HasFloat=0" cargo build

Currently passing -Dd_m3HasFloat=0 results in this error because the wasm3 signature changes:

error[E0061]: this function takes 4 arguments but 5 arguments were supplied
   --> /Users/jiayihu/Desktop/Repo/wasm3-rs/src/function.rs:185:13
    |
185 |             (*_pc.cast::<ffi::IM3Operation>()).expect("IM3Operation was null")(
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 4 arguments
186 |                 _pc.add(1),
    |                 ----------
187 |                 _sp,
    |                 ---
188 |                 _mem,
    |                 ----
189 |                 _r0,
    |                 ---
190 |                 _fp0,
    |                 ---- supplied 5 arguments

Passing d_m3FixedHeap, such as -Dd_m3FixedHeap=(8 * 1024), also results in compilation error because the (8 * 1024) syntax is not supported by #21 .

I just wanted to report the issues and causes for anyone interested. After being finally able to compile everything, I realized while I was implementing the intrinsics for calloc, free, realloc (required if d_m3FixedHeap is unset) that I was not very satisfied with the wasm3 implementation itself. Its C code is very hard to read and extend IMO. I'm ditching in favor of https://github.com/paritytech/wasmi or writing a WASM runtime myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions