-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Initial emscripten work #30453
Initial emscripten work #30453
Conversation
r? @jroesch (rust_highfive has picked a reviewer for you, use r? to override) |
cc @rust-lang/compiler because of the new target option. |
The libstd/rand/os.rs file also needs some changes. Since emscripten is considered as Unfortunately this is pretty important because creating a hashmap uses this code. |
I just found out this issue: emscripten-core/emscripten#2439 which claims that |
@brson did you add a feature flag or something for the new target? do we want one? I didn't see it in the patch, but I didn't really look that closely. |
The libc changes look good to me (just a doc fix needed to get them pushed), and the LLVM changes also look pretty innocuous. When paired with #30448 it may "just work" as that updates to LLVM 3.8. Definitely looking forward to getting a builder up and running executing the test suite here, in theory it shouldn't be too hard as we've at least got Android to work off! (e.g. android is running target-only tests in a weird fashion today already). |
CFG_JEMALLOC_CFLAGS_asmjs-unknown-emscripten := -m32 $(CFLAGS) | ||
# NB: The EMSCRIPTEN environment variable is set by the emscripten SDK. | ||
# This is only needed here to so the compiler-rt build can find unwind.h, | ||
# but the asmjs target *doesn't even link to compiler-rt*. |
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.
There's a custom target option to disable compiler-rt, so perhaps we could avoid building compiler-rt and avoid linking it entirely?
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 it looks like no_compiler_rt
is already set, I wonder if we could avoid building compiler-rt like libbacktrace is avoided?
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.
I'll look into it. I punted on it last time I looked at rt.mk just because that file was so difficult.
Looks good to me! r=me when the stars are aligned (e.g. libc is landed and this is rebased) |
☔ The latest upstream changes (presumably #30381) made this pull request unmergeable. Please resolve the merge conflicts. |
@nikomatsakis No, I did not add a feature flag. It's not something we've done before for targets. |
8d00b67
to
e0d8802
Compare
Backtraces, and the compilation of libbacktrace for asmjs, are disabled. This port doesn't use jemalloc so, like pnacl, it disables jemalloc *for all targets* in the configure file. It updates libc to not link to -m and -rt since all emscripten runtime components are part of libc. Emscripten libc is musl. It disables stack protection.
This tells trans::back::write not to LLVM codegen to create .o files but to put LLMV bitcode in .o files. Emscripten's emcc supports .o in this format, and this is, I think, slightly easier than making rlibs work without .o files.
e0d8802
to
b723bad
Compare
@alexcrichton r? I've added another commit that uses alloc_system in stage0 to make --disable-jemalloc work |
@@ -1 +1 @@ | |||
Subproject commit f84e30927284b0c500ed3eaf09e8e159da20ddaf | |||
Subproject commit e24a1a025a1f214e40eedafe3b9c7b1d69937922 |
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.
Accidental update?
Looks like two perhaps spurious updates to submodules, but otherwise r=me |
std doesn't build after the rebase either |
I'm going to close this until I get the 32-bit musl libc bindings correct. |
Add the asmjs-unknown-emscripten triple. Add cfgs to libs. target_arch = "asmjs". target_os = "emscripten".
Backtraces, and the compilation of libbacktrace for asmjs, are disabled.
This port doesn't use jemalloc so, like pnacl, it disables jemalloc for all targets in the configure file.
It updates libc to not link to -m and -rt since all emscripten runtime components are part of libc. Emscripten libc is musl.
It disables stack protection.
This adds a weird new target option: obj_is_bitcode. This tells
trans::back::write
not to LLVM codegen to create .o files but to put LLMV bitcode in .o files. Emscripten's emcc supports .o in this format, and this is, I think, slightly easier than making rlibs work without .o files.Note this badness where the makefiles depend on the
EMSCRIPTEN
environment variable.Depends on rust-lang/libc#107.
This isn't enough to compile code with emscripten. It still needs 4 patches to add emscripten's LLVM fork to the tree. But note that there are bugs in that fork that cause even hello.rs not to build at the moment.
cc @kripken