cdisselkoen opened Issue #1940:
Not sure if this is a bug, my own user error, or just a not-implemented-yet.
I have the following minimal Wasm example (hello.wat):
(module (func (export "helloFunc") (result i32) (i32.const 42)) )
wasm2obj
seems to not respect the declared export function name:(Linux) > wasmtime wasm2obj hello.wat hello.o > nm hello.o 0000000000000000 D _vmcontext_init 0000000000000000 T _wasm_function_0
(macOS) > wasmtime wasm2obj hello.wat hello.o > nm hello.o 000000000000000e D __vmcontext_init 0000000000000000 T __wasm_function_0
Instead of
_wasm_function_0
, I was expectinghelloFunc
.This behavior is still the same with the following
hello.wat
declaring the export a different way:(module (func (result i32) (i32.const 42)) (export "helloFunc" (func 0)) )
I've tested this on Wasmtime
master
as of this writing, which is commit c91a9313b. As shown above, I observed this behavior on both Linux and macOS.
abrown commented on Issue #1940:
@yurydelendik?
cdisselkoen commented on Issue #1940:
Not knowing what I'm doing, my first attempt to fix this (https://github.com/PLSysSec/wasmtime-blade/commit/7494c43099831d581f78909cc5ad13bbf62ec39f) failed to make any difference in my testing.
yurydelendik commented on Issue #1940:
Not sure if this is a bug, my own user error, or just a not-implemented-yet.
There is no specification in which form wasm2obj shall produce its output. Currently, wasmtime just packages machine code into object file containers, and adds unique symbols (such as "_wasmtime_0") to mark starts of the functions. AFAIK wasm2obj is used only by developers to troubleshot internals of wasmtime and no intent to be used by end user.
yurydelendik edited a comment on Issue #1940:
Not sure if this is a bug, my own user error, or just a not-implemented-yet.
There is no specification in which form wasm2obj shall produce its output. Currently, wasmtime just packages machine code into object file containers, and adds unique symbols (such as
_wasm_function_0
) to mark starts of the functions. AFAIK wasm2obj is used only by developers to troubleshot internals of wasmtime and no intent to be used by end user.
cdisselkoen commented on Issue #1940:
Sure, that sounds reasonable. In that case I can close this issue as it sounds like it's out of scope?
I think Lucet will probably be the tool I'm looking for, even for simple examples (non-WASI code, no external calls).
yurydelendik commented on Issue #1940:
In that case I can close this issue as it sounds like it's out of scope?
Yes. Also you may just re-purpose this issue as feature request -- I expect we change the behavior of wasm2obj to be more user friendly.
cdisselkoen commented on Issue #1940:
Ok, I will leave this as-is then and let maintainers choose whether to close or edit to a feature request.
Last updated: Dec 23 2024 at 13:07 UTC