-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Working asmjs and wasm targets #36339
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I have lingering doubts about the modification to Thread::new: why just this function and not others, why an error instead of panic. |
One thing to note about this patch is that debugging crate test failures is quite difficult because many failures result in aborts, not clean test failures. Often this is because of fatal errors in emscripten for various reasons; perhaps some because of the utterly broken unwinding support. |
In my opinion we should pass Other than that, there's the question of |
.. Default::default() | ||
}; | ||
Ok(Target { | ||
llvm_target: "asmjs-unknown-emscripten".to_string(), |
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.
Should this be wasm32-unknown-emscripten
?
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.
Oh wait nevermind, this isn't using the wasm backend of LLVM.
I've realized one further issue where we may not need to actually include the fastcomp backend, but I would prefer to land this ahead of that and we can decide on it later. |
☔ The latest upstream changes (presumably #36369) made this pull request unmergeable. Please resolve the merge conflicts. |
This may also want to use the support added in #36256 to figure out which node to run rather than always using |
I've got a patch to make the test changes, remove the Thread::spawn error handling, and fix libtest. Testing it now. Still have to investigate the jemalloc problems, though this can land without fixes for that. Still have to rebase to incorporate #36256. |
Please don't forget my remark. You may have linking errors and not realize it. |
@tomaka Thanks for the reminder. I will definitely add the |
2ea0371
to
80a1288
Compare
80a1288
to
3a4ac8a
Compare
@alexcrichton I think this is ready to go but still running tests. |
Doing this step for the target results in the build system trying to build rustc for asmjs, which doesn't work.
This is a hack to support building targets that don't support jemalloc alongside hosts that do. The jemalloc build is controlled by a feature of the std crate, and if that feature changes between targets, it invalidates the fingerprint of std's build script (this is a cargo bug); so we must ensure that the feature set used by std is the same across all targets, which means we have to build the alloc_jemalloc crate for targets like emscripten, even if we don't use it.
a5f5f9d
to
afa72b5
Compare
I've confirmed this build works with the smaller LLVM patch. |
@bors r=alexcrichton |
📌 Commit afa72b5 has been approved by |
⌛ Testing commit afa72b5 with merge 8b00355... |
Working asmjs and wasm targets This patch set results in a working standard library for the asmjs-unknown-emscripten and wasm32-unknown-emscripten targets. It is based on the work of @badboy and @rschulman. It does a few things: - Updates LLVM with the emscripten [fastcomp](rust-lang/llvm#50) patches, which include the pnacl IR legalizer and the asm.js backend. This patch is thought not to have any significant effect on existing targets. - Teaches rustbuild to correctly link C code with emscripten - Updates gcc-rs to work correctly with emscripten - Teaches rustbuild to run crate tests for emscripten with node - Modifies Thread::new to return an error on emscripten, to facilitate debugging a common failure mode - Modifies libtest to run in single-threaded mode for emscripten - Ignores a host of tests that don't work yet, mostly dealing with threads and I/O - Updates libc with wasm32 definitions (presently the same as asmjs) - Adds a wasm32-unknown-emscripten target that feeds the output of LLVM's asmjs backend through emcc to generate wasm Notes and caveats: - This is only known to work with `--enable-rustbuild`. - The wasm32 target can't be tested correctly yet because of issues in compiletest and limitations in node emscripten-core/emscripten#4542, but hello.rs does seem to work when run on node via the binaryen interpreter - This requires an up to date installation of the emscripten sdk from its incoming branch - Unwinding is very broken - When enabling the emscripten targets jemalloc is disabled for all targets, which results in test failures for the host Next steps are to fix the jemalloc issue, start building the two emscripten targets on the auto builders, then start producing nightlies. #36317 tracks work on this. Fixes #36515 Fixes #36515 Fixes #36356
This patch set results in a working standard library for the asmjs-unknown-emscripten and wasm32-unknown-emscripten targets. It is based on the work of @badboy and @rschulman.
It does a few things:
Notes and caveats:
--enable-rustbuild
.Next steps are to fix the jemalloc issue, start building the two emscripten targets on the auto builders, then start producing nightlies.
#36317 tracks work on this.
Fixes #36515
Fixes #36515
Fixes #36356