-
Notifications
You must be signed in to change notification settings - Fork 192
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
LLVM 19 + setjmp/longjmp doc #480
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2e90221
llvmorg-19.1.0-rc3
yamt 69dd169
document setjmp/longjmp support
yamt e98bace
README.md: mention SetjmpLongjmp.md
yamt 7b33e75
bump wasi-libc
yamt 85972e0
bump llvm to llvmorg-19.1.0-rc4
yamt 254a9e7
bump llvm to llvmorg-19.1.0
yamt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# C setjmp/longjmp support | ||
|
||
## Build an application | ||
|
||
To build an application using setjmp/longjmp, you need two things: | ||
|
||
* Enable the necessary LLVM translation (`-mllvm -wasm-enable-sjlj`) | ||
|
||
* Link the setjmp library (`-lsetjmp`) | ||
|
||
### Example without LTO | ||
|
||
```shell | ||
clang -Os -mllvm -wasm-enable-sjlj -o your_app.wasm your_app.c -lsetjmp | ||
``` | ||
|
||
### Example with LTO | ||
|
||
```shell | ||
clang -Os -flto=full -mllvm -wasm-enable-sjlj -Wl,-mllvm,-wasm-enable-sjlj -o your_app.wasm your_app.c -lsetjmp | ||
``` | ||
|
||
## Run an application | ||
|
||
To run the application built as in the previous section, | ||
you need to use a runtime with [exception handling proposal] support. | ||
|
||
Unfortunately, there are two incompatible versions of | ||
[exception handling proposal], which is commonly implemented by runtimes. | ||
|
||
* The latest version with `exnref` | ||
|
||
* The [phase3] version | ||
|
||
### Example with the latest exception handling proposal | ||
|
||
Because the current version of WASI-SDK produces an old version | ||
of [exception handling proposal] instructions, if your runtime | ||
implements the latest version of the proposal, you need to convert | ||
your module to the latest version. | ||
|
||
[toywasm] is an example of such runtimes. | ||
|
||
You can use binaryen `wasm-opt` command for the conversion. | ||
|
||
```shell | ||
wasm-opt --translate-to-exnref -all -o your_app.exnref.wasm your_app.wasm | ||
``` | ||
|
||
Then you can run it with a runtime supporting the latest version of | ||
[exception handling proposal]. | ||
|
||
```shell | ||
toywasm --wasi your_app.exnref.wasm | ||
``` | ||
(You may need to enable the support with `-D TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING=ON`.) | ||
|
||
### Example with the phase3 exception handling proposal (a bit older version) | ||
|
||
If your runtime supports the [phase3] version of | ||
[exception handling proposal], which is the same version as what WASI-SDK | ||
currently produces, you can run the produced module as it is. | ||
|
||
For example, the classic interpreter of [wasm-micro-runtime] is | ||
one of such runtimes. | ||
|
||
```shell | ||
iwasm your_app.wasm | ||
``` | ||
(You may need to enable the support with `-D WAMR_BUILD_EXCE_HANDLING=1 -D WAMR_BUILD_FAST_INTERP=0`.) | ||
|
||
[exception handling proposal]: https://github.com/WebAssembly/exception-handling/ | ||
[phase3]: https://github.com/WebAssembly/exception-handling/tree/main/proposals/exception-handling/legacy | ||
[toywasm]: https://github.com/yamt/toywasm | ||
[wasm-micro-runtime]: https://github.com/bytecodealliance/wasm-micro-runtime |
Submodule llvm-project
updated
from 26a1d6 to a4bf6c
Submodule wasi-libc
updated
15 files
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently broken. see WebAssembly/wasi-libc#529
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed