-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[WASM] Add minimal support for targeting wasm32-unknown-unknown-wasm. Forked #20684 #27860
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
[WASM] Add minimal support for targeting wasm32-unknown-unknown-wasm. Forked #20684 #27860
Conversation
44979cd
to
4f69a8d
Compare
In the time since the precursor to this PR was opened, our fork of LLVM has advanced enough to the point that it supports In platform-specific code, that's what you're going to be interested in, anyway: #if os(wasi)
import WasiLibc // wasi's stripped-down libc
printf(...)
#endif |
- This is nothing beyond preventing the compiler from rejecting this target triple. - There doesn't yet appear to be a well-defined convention around a triple which detects WASM based on an "OS" field, so we use the "wasm" indicator in the environment component.
73980a7
to
3117991
Compare
3117991
to
4f82512
Compare
I updated to use WASI as target OS |
The original patch is now over a year old, then it finally became unarguably ready to merge, so of course someone had to immediately go and refactor that part of code so it now needs rewriting 😅 One day we will finally catch up to the likes of C, Forth and Lua, and support WASM. |
Hi, is there anything that prevents this PR from being merged? |
@kateinoigakukun i believe @compnerd redid this after his changes and merged that version. E.g. #28584 It would be great to rebase swiftwasm (there was another wasm-related patch, also from Saleem, after the one referenced above) based on master, and I think we can remove some hacks now that LLVM knows about WASI and that’s the „OS“ we support for WASM. I think @MaxDesiatov has write access to that repo. I think we should really push ahead with upstreaming as many WASM patches as we can. This is a port that should be fairly easy to support via CI (basically all supported platforms can run WASM, even if it requires tools like wasmtime), and could be extremely useful for bootstrapping the Swift compiler if the driver project is ultimately successful at writing the compiler itself in Swift. |
This PR is based on #20684 which adds the minimal wasm support.
And I added some test case to ensure that
swiftc
acceptswasm32-unknown-unknown-wasm
andwasm64-unknown-unknown-wasm
.This is my first time to write lit test case, so please let me know if there is a problem.