Stream: wasmtime

Topic: Dissassemble pulley bytecode from a precompiled `.cwasm` ELF


view this post on Zulip Antoine Lavandier (Mar 30 2026 at 14:47):

Hello,
I have a precompiled file that works and that I cannot for the life of me reproduce. The file was precompiled from the pulley32 target so since the pulley-interpreter crate comes with a dissassembler I thought that it would be easy but I can't figure out how to feed it the bytecode that is contained in the ELF. Is there a something that can help with this ? Should i try to isolate the .text section of the ELF and feed it that ?

Thanks in advance

view this post on Zulip fitzgen (he/him) (Mar 30 2026 at 15:13):

wasmtime objdump path/to/my.cwasm should work

view this post on Zulip fitzgen (he/him) (Mar 30 2026 at 15:15):

if you need to do it via (internal and unstable) programmatic APIs, you can take a look at how the objdump subcommand does it: https://github.com/bytecodealliance/wasmtime/blob/f33f15e64c3253415fd502563906e042647e9c53/src/commands/objdump.rs#L488

view this post on Zulip Antoine Lavandier (Mar 30 2026 at 15:35):

Thanks a lot, I never use the wasmtime CLI so i didn't think to check.
Is there a way to go one step further and recover some wasm bytecode/wat file from either the precompiled file or the pulley bytecode ?

view this post on Zulip fitzgen (he/him) (Mar 30 2026 at 16:40):

unfortunately not, .cwasms are not reversible to .wasms

view this post on Zulip Chris Fallin (Mar 30 2026 at 16:47):

(well, unless guest-debug is enabled when we slip the whole of the .wasm into a special section for the debugger's use; maybe we could theoretically build tooling to pull it out, but I don't know that I would want to because it would then force us to pave the cowpath and support it forever)


Last updated: Apr 13 2026 at 00:25 UTC