Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What module will _start, args, env, and pre-opens be defined in? #508

Closed
codefromthecrypt opened this issue Jan 26, 2023 · 7 comments
Closed

Comments

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Jan 26, 2023

I noticed here, several wasi modules being clarified. However, it seems there's not enough defined to actually bootstrap a wasi command. Notably, we're missing definition of the _start function, memory (basically nothing works without it), how to enumerate pre-opens and how to get args and env. Are you thinking a "wasi-bootstrap" all in, or micro modules like wasi-env?

@codefromthecrypt
Copy link
Contributor Author

It seems maybe it is this, but looks abandoned? e.g. it isn't defined in the new format and untouched recently cc @sunfishcode https://github.com/WebAssembly/wasi-classic-command/blob/main/standard/classic-command/docs.md

@SamuraiCrow
Copy link

However, it seems there's not enough defined to actually bootstrap a wasi command.

I'm also curious because WAsm2C and the third-party W2C2 each require that the main function be already be written in C independently from the generated code. This is undesirable in the long term.

I was thinking of replacing the C backend of W2C2 or WAsm2C with calls to LibGCCJIT for more parallel building without the need for back-to-back source generation and immediate reparsing.

@SamuraiCrow
Copy link

Does #509 relate to or answer this question?

@codefromthecrypt
Copy link
Contributor Author

@SamuraiCrow it relates, though it is indirect. For example a "command function" would indeed read things like pre-opens, but pre-opens themselves currently are functions (stat and name). It is still murky to me how this stitches together, particularly how you map snapshot01 to this. I'll try to follow along and thanks for the hint.

@sunfishcode
Copy link
Member

The preview1 _start function as used in preview1 is documented here. It has no arguments, and preview1 has functions for retrieving arguments and environment variables.

#509 is for preview2, which is expected to have an entrypoint function that has arguments for command-line arguments and environment variables.

@sunfishcode
Copy link
Member

I also filed #510 which hopefully makes the preview1 docs a little easier to navigate. It removes the old "phases", "snapshot", and "ephemeral" terminology, and just calls things "preview0" and "preview1", which are the terminology we tend to refer to them by now.

@sunfishcode
Copy link
Member

As commented above, WASIp1 is documented here, and the equivalents in WASIp2 are defined here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants