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

add --rename-world and --type-section-suffix options to C generator #805

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

dicej
Copy link
Collaborator

@dicej dicej commented Jan 4, 2024

These are both useful for supporting the wasm32-wasi-preview2 target in wasi-libc.

Ideally, both of those options would be available for all the applicable generators, but for now I'm focused on the C generator given its use in wasi-libc.

These are both useful for supporting the `wasm32-wasi-preview2` target in
`wasi-libc`.

- `--rename-world` lets us give the files more meaningful names than e.g. "imports.h" when generating bindings for `wasi:cli/imports`
- `--type-section-suffix` lets us provide a suffix for the component type custom section name per bytecodealliance#788

Ideally, both of those options would be available for all the applicable
generators, but for now I'm focused on the C generator given its use in
`wasi-libc`.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@alexcrichton alexcrichton merged commit 7f2db1a into bytecodealliance:main Jan 4, 2024
9 checks passed
dicej added a commit to dicej/wasi-libc that referenced this pull request Jan 5, 2024
This includes bytecodealliance/wit-bindgen#804 (fix
broken indentation in generated code) and
bytecodealliance/wit-bindgen#805 (support overriding
world name and adding a suffix to the component type custom section).

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
dicej added a commit to dicej/wasi-libc that referenced this pull request Jan 11, 2024
This includes bytecodealliance/wit-bindgen#804 (fix
broken indentation in generated code) and
bytecodealliance/wit-bindgen#805 (support overriding
world name and adding a suffix to the component type custom section).

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
sunfishcode pushed a commit to WebAssembly/wasi-libc that referenced this pull request Jan 11, 2024
* add WASI Preview 2 bindings

This adds C bindings generated from the `wasi:cli/imports@0.2.0-rc-2023-12-05`
world, plus a makefile target to regenerate them from the WIT source files.

We'll use these bindings to call Preview 2 host functions when building for the
`wasm32-wasi-preview2` target.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

* update to pre-release of `wit-bindgen` 0.17.0

This includes bytecodealliance/wit-bindgen#804 (fix
broken indentation in generated code) and
bytecodealliance/wit-bindgen#805 (support overriding
world name and adding a suffix to the component type custom section).

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

* test all targets; update preview2 expected output files

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

* build for `wasm32-wasi-threads` before testing it

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

* move generated bindings per review feedback

Since these files aren't part of cloudlibc, no reason to put them under the
cloudlibc directory.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

* move preview2.h to wasi directory

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

---------

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
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

Successfully merging this pull request may close these issues.

2 participants