It's getting closer. First, the --compile=all and --dump-bitcode=yes options to Julia are a big help in dumping LLVM bitcodes. The contrib/build_sysimg.jl code is useful for this after modifying it to include these Julia command-line options.
There are a few issues with using Emscripten with Julia code:
* 32-bit code -- Emscripten expects 32-bit bitcode. On a 64-bit platform, Julia generates 64-bit bitcode. I tried using the build_sysimg.jl script with a target of i686, but Emscripten still gave me errors.
* Symbol naming -- Code generated by Julia has a lot of symbols like #sym that Emscripten doesn't like. This can be handled by either Emscripten or on the Julia side.
Lastly, libjulia bitcode needs to be generated. I've gotten about 80% of it to compile after stripping out the libuv stuff. There are also libraries like BLAS, but these can be added as needed.