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 emscriptenfastcomp 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 kripken/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.