WASI icon indicating copy to clipboard operation
WASI copied to clipboard

wasi calls from wasm start function

Open yamt opened this issue 1 year ago • 5 comments

is it allowed to call wasi functions from wasm start function?

  • wasip1, if it matters.
  • i mean this https://www.w3.org/TR/wasm-core-2/#syntax-start start function, not "_start".

i suppose the answer is no because, with some embedder apis, it's tricky or impossible to get a reference to the exported memory before the start function is called. anyway, is it specified anywhere in the spec?

yamt avatar Aug 09 '24 11:08 yamt

Yes, this issue has been much discussed.

See https://github.com/WebAssembly/design/issues/1160 and https://github.com/WebAssembly/WASI/issues/487 https://github.com/WebAssembly/WASI/issues/19

I'm not sure if any of those discussions lets to documentation changes anywhere.

sbc100 avatar Aug 09 '24 18:08 sbc100

The status quo is that _start is reserved for use by the linker (at least with llvm/wasm-ld) and cannot run user code.

sbc100 avatar Aug 09 '24 18:08 sbc100

The status quo is that _start is reserved for use by the linker (at least with llvm/wasm-ld) and cannot run user code.

do you mean wasm start function?

yamt avatar Aug 13 '24 06:08 yamt

Yes, sorry I meant the wasm start function.

sbc100 avatar Aug 13 '24 15:08 sbc100

As you can see the terminology is confusing here :)

sbc100 avatar Aug 13 '24 15:08 sbc100