turbolent / w2c2

Translates WebAssembly modules to portable C
MIT License
718 stars 37 forks source link

Support for WASM generated by GHC #81

Open Borschemancer opened 1 year ago

Borschemancer commented 1 year ago

GHC has recently introduced support for the WASM backend. Unfortunately, w2c2 will throw the following error when trying to generate C code:

$./w2c2 hi.wasm hi.c
w2c2: failed to read module: invalid code section local declarations

I have absolutely no knowledge of wasm, but as far as I understand it's about supporting WASM or WASI standards?

turbolent commented 1 year ago

It's pretty likely that this because the GHC WebAssembly backend uses several extensions to the WebAssembly 1.0 spec ("post-MVP features").

Some of those are supported by w2c2 already, see https://github.com/turbolent/w2c2#features.

Several are still missing: