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

Emscripten support take 2 (with bonus i686-unknown-linux-musl). #30629

Merged
merged 4 commits into from Feb 6, 2016

Conversation

Projects
None yet
5 participants
@brson
Contributor

brson commented Dec 30, 2015

Here's another go at adding emscripten support. This needs to wait again on new libc definitions landing. To get the libc definitions right I had to add support for i686-unknown-linux-musl, which are very similar to emscripten's, which are derived from arm/musl.

This branch additionally removes the makefile dependency on the EMSCRIPTEN environment variable by not building the unused compiler-rt.

Again, this is not sufficient for actually compiling to asmjs since it needs additional LLVM patches.

r? @alexcrichton

src/librustc_trans/back/write.rs
- llvm::LLVMWriteBitcodeToFile(llmod, out.as_ptr());
+ // Change what we write and cleanup based on whether obj files are
+ // just llvm bitcode. In that case write bitcode, and possibly
+ // delete the bitcode if it wasn't requisted. Don't generate the

This comment has been minimized.

@aidanhs

aidanhs Jan 8, 2016

Member

requested (sorry about the nit, my eyes just fell on it)

@aidanhs

aidanhs Jan 8, 2016

Member

requested (sorry about the nit, my eyes just fell on it)

@@ -180,7 +182,7 @@ pub mod guard {
}
-#[cfg(any(target_os = "linux",
+#[cfg(any(all(target_os = "linux", not(target_env = "musl")),

This comment has been minimized.

@aidanhs

aidanhs Jan 8, 2016

Member

Unfortunately I'm without the ability to build musl-rust right now, so I'm forced to ask rather than just trying - what about this won't work on musl?

@aidanhs

aidanhs Jan 8, 2016

Member

Unfortunately I'm without the ability to build musl-rust right now, so I'm forced to ask rather than just trying - what about this won't work on musl?

This comment has been minimized.

@brson

brson Jan 21, 2016

Contributor

I haven't looked too deeply, but I was getting crashes in one of the pthread calls in this code path, and since it's some hairy code I just punted.

@brson

brson Jan 21, 2016

Contributor

I haven't looked too deeply, but I was getting crashes in one of the pthread calls in this code path, and since it's some hairy code I just punted.

+ // To deal with these circular dependencies we just force the compiler to
+ // link everything as a group, not stripping anything out until everything
+ // is processed. The linker will still perform a pass to strip out object
+ // files but it won't do so until all objects/archives have been processed.

This comment has been minimized.

@alexcrichton

alexcrichton Jan 10, 2016

Member

Could the comments in this file be deduplicated with the 64-bit MUSL? e.g. just leave pointers saying that an explanation of all the weird options are over there.

@alexcrichton

alexcrichton Jan 10, 2016

Member

Could the comments in this file be deduplicated with the 64-bit MUSL? e.g. just leave pointers saying that an explanation of all the weird options are over there.

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jan 10, 2016

Member

r=me with one minor nit, but otherwise this'll just need libc to land first as well

Member

alexcrichton commented Jan 10, 2016

r=me with one minor nit, but otherwise this'll just need libc to land first as well

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Jan 13, 2016

Contributor

☔️ The latest upstream changes (presumably #30601) made this pull request unmergeable. Please resolve the merge conflicts.

Contributor

bors commented Jan 13, 2016

☔️ The latest upstream changes (presumably #30601) made this pull request unmergeable. Please resolve the merge conflicts.

@brson

This comment has been minimized.

Show comment
Hide comment
@brson

brson Feb 6, 2016

Contributor

Rebasing this now.

Contributor

brson commented Feb 6, 2016

Rebasing this now.

@brson

This comment has been minimized.

Show comment
Hide comment
@brson

brson Feb 6, 2016

Contributor

Well, I've rebased and addressed comments, and this builds, but testing against emscripten incoming it no longer produces working js.

Still, I'm up for landing this for the wip.

Contributor

brson commented Feb 6, 2016

Well, I've rebased and addressed comments, and this builds, but testing against emscripten incoming it no longer produces working js.

Still, I'm up for landing this for the wip.

@brson

This comment has been minimized.

Show comment
Hide comment
@brson

brson Feb 6, 2016

Contributor

@bors r=alexcrichton

Contributor

brson commented Feb 6, 2016

@bors r=alexcrichton

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Feb 6, 2016

Contributor

📌 Commit b9dd828 has been approved by alexcrichton

Contributor

bors commented Feb 6, 2016

📌 Commit b9dd828 has been approved by alexcrichton

@brson

This comment has been minimized.

Show comment
Hide comment
@brson

brson Feb 6, 2016

Contributor

@bors r- I've got a commit that changes jemalloc in there.

Contributor

brson commented Feb 6, 2016

@bors r- I've got a commit that changes jemalloc in there.

@brson

This comment has been minimized.

Show comment
Hide comment
Contributor

brson commented Feb 6, 2016

@brson

This comment has been minimized.

Show comment
Hide comment
@brson

brson Feb 6, 2016

Contributor

@bors r=alexcrichton

Contributor

brson commented Feb 6, 2016

@bors r=alexcrichton

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Feb 6, 2016

Contributor

📌 Commit 7afb56f has been approved by alexcrichton

Contributor

bors commented Feb 6, 2016

📌 Commit 7afb56f has been approved by alexcrichton

brson added some commits Nov 26, 2015

Add the asmjs-unknown-emscripten triple. Add cfgs to libs.
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 disables stack protection.
rustc: Add obj_is_bitcode to TargetOptions
This tells trans:🔙: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.
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Feb 6, 2016

Contributor

⌛️ Testing commit 7afb56f with merge 8c604dc...

Contributor

bors commented Feb 6, 2016

⌛️ Testing commit 7afb56f with merge 8c604dc...

bors added a commit that referenced this pull request Feb 6, 2016

Auto merge of #30629 - brson:emscripten-upstream, r=alexcrichton
Here's another go at adding emscripten support. This needs to wait again on new [libc definitions](rust-lang/libc#122) landing. To get the libc definitions right I had to add support for i686-unknown-linux-musl, which are very similar to emscripten's, which are derived from arm/musl.

This branch additionally removes the makefile dependency on the `EMSCRIPTEN` environment variable by not building the unused compiler-rt.

Again, this is not sufficient for actually compiling to asmjs since it needs additional LLVM patches.

r? @alexcrichton

@bors bors merged commit 7afb56f into rust-lang:master Feb 6, 2016

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
homu Test successful
Details
@tamird

This comment has been minimized.

Show comment
Hide comment
@tamird

tamird May 1, 2016

Contributor

@brson @alexcrichton a bit late to this party, but base.pre_link_args.push("-Wl,-melf_i386".to_string()); is the only bit of this that isn't shared with the 64-bit version and it isn't clear why. Can you shed some light on this difference?

Contributor

tamird commented May 1, 2016

@brson @alexcrichton a bit late to this party, but base.pre_link_args.push("-Wl,-melf_i386".to_string()); is the only bit of this that isn't shared with the 64-bit version and it isn't clear why. Can you shed some light on this difference?

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton May 2, 2016

Member

AFAIK that's just to tell the linker to emit a 32-bit executable in case it's default a 64-bit one

Member

alexcrichton commented May 2, 2016

AFAIK that's just to tell the linker to emit a 32-bit executable in case it's default a 64-bit one

@tamird

This comment has been minimized.

Show comment
Hide comment
@tamird

tamird May 3, 2016

Contributor

Does that make it redundant with -m32?

On Mon, May 2, 2016 at 1:10 AM, Alex Crichton notifications@github.com
wrote:

AFAIK that's just to tell the linker to emit a 32-bit executable in case
it's default a 64-bit one


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#30629 (comment)

Contributor

tamird commented May 3, 2016

Does that make it redundant with -m32?

On Mon, May 2, 2016 at 1:10 AM, Alex Crichton notifications@github.com
wrote:

AFAIK that's just to tell the linker to emit a 32-bit executable in case
it's default a 64-bit one


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#30629 (comment)

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton May 3, 2016

Member

In this case, probably yes

Member

alexcrichton commented May 3, 2016

In this case, probably yes

@brson

This comment has been minimized.

Show comment
Hide comment
@brson

brson May 3, 2016

Contributor

@tamird Memory is hazy, but if I didn't write that it didn't work, and I don't know if it's redundant with -m32.

Contributor

brson commented May 3, 2016

@tamird Memory is hazy, but if I didn't write that it didn't work, and I don't know if it's redundant with -m32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment