-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update Emscripten system types #1478
Conversation
These changes bring the types up to parity with recent Emscripten versions using the upstream LLVM wasm backend. These changes should be coordinated with the upgrade of rustc's Emscripten support. See https://internals.rust-lang.org/t/upgrading-rust-s-emscripten-support/10684
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @gnzlbg (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@tlively sorry that it took so long to come back to this. @sunfishcode @alexcrichton this is probably going to be a pain to land since it is a backward incompatible change to the target. It appears to me that merging this and releasing a new libc version would be required to be able to merge a rust-lang/rust PR updating emscripten, but in the time-frame between the libc version release and the merge of an upstream PR, libc would be broken for the target. Also, new libc versions with these changes would be broken for older Rust toolchains - do any stable Rust toolchains support the wasm32-unknown-emscripten and asmjs-unknown-emscripten targets ? If the answer is "no", I think that once there is an upstream PR in rust-lang/rust for which "bors try" passes with these changes, we can make the changes here, do a release, and update the upstream PR to the released libc version and merge it with p=infinity. If the answer is "yes, we have some stable toolchains for x-unknown-emscripten" then... this is going to require a bit more work. We could add one such toolchain to CI, and in the |
So the answer is yes, both of these targets are supported in stable Rust, and this change here would probably be a breaking change for older toolchains. The |
I think it's good to acknowledge the breakage that will happen here and develop a roll-out plan accordingly, but I won't pretend like we have a policy around this for each target. If the maintainers of Emscripten recommend we upgrade/change, though, and if Emscripten itself changed, then it seems like we should follow-suit. |
I just did a test and it turns out both fastcomp and upstream backends use the types introduced in this PR since April, so everything was just totally broken on recent Emscripten releases anyway and no one noticed. I therefore don't think we need to worry too much about breaking people. |
Is that with the Emscripten LLVM that's shipped with the Rust toolchain ? What's the first released Rust toolchain where that change landed ? |
The moment we land this on libc, all users of the emscripten targets using a stable Rust toolchain, or an older nightly toolchain, will have to either migrate to using the latest nightly toolchain, or pin their libc to an older version. I have no idea how many users this toolchain has beyond that it is available on stable. If it has no or few users, we can just make this change and call it a day. If it has more, we could give the change a try, and if people complain, we can roll it back. But rolling it back is going to be a pain because this change is tied to a change in rust-lang/rust. I'd rather just avoid all these headaches by adding something like: #[cfg(libc_emscripten_{version})]
pub type ino64_t = u32;
#[cfg(libc_emscripten_{newer_version})]
pub type ino64_t = u64; where the It is unfortunate to have to maintain this, but that removes the headaches, and allow us to land this here and have CI pass before landing this on rust-lang/rust (once this lands upstream, maybe we can add a second CI build job here to test the "newer_version" ?). Alternatively, I'd rather just temporarily disable the emscripten build jobs here, land this change as is, and do a new libc release - without changing anything in rust-lang/rust upstream. We can wait one week and see if somebody complains, and if somebody complains, we just revert this here and yank the version, without having to do anything in rust-lang/rust. Thoughts ? |
@bors: try |
Update Emscripten system types These changes bring the types up to parity with recent Emscripten versions using the upstream LLVM wasm backend. These changes should be coordinated with the upgrade of rustc's Emscripten support. See https://internals.rust-lang.org/t/upgrading-rust-s-emscripten-support/10684
💔 Test failed - status-azure |
I don't personally feel like I have a good grasp on the number of Rust users of the emscripten targets nor what the reaction would be to breakage. In that sense I want to be clear that I'm not assuming that there will be a huge uproar if we just land breaking changes. If @gnzlbg you'd like to do the work smoothing over the transition, seems fine to me! I probably wouldn't personally do it but I'm always a bit too strapped for tiem... |
FWIW me neither. I have no idea how many users these backends have. |
Does Rust even ship an emscripten? My impression is that it calls out to whatever version of emscripten the user happens to have installed separately, but I could be wrong. |
Rust doesn't ship an emscripten, no, you're right in that we just use whatever @gnzlbg FWIW these are header-level details which don't have to do with the LLVM backend, the emscripten LLVM backend in rustc is basically purely selected to ensure that the Rust-generated LLVM IR is generated by the same LLVM version as what emscripten is using internally. |
Ah! I thought we would just ship the whole thing! Then we can't be compatible with both old and new emscripten toolchains because when building libc we don't know which one will be used right? Then this LGTM. |
Yes the standard library certainy has no recourse here. While theoretically possible that the crates.io crate could have a build script to dynamically switch, I wouldn't personally bother with such complications. I'd just merge the PR myself. |
I don't think this is worth it either. |
It turns out the CI is broken due to an emsdk bug 🙃 Fix is up: emscripten-core/emsdk#328 |
This reverts commit 89e8ae6.
So the tests are actually running now, which is nice. But they're failing with this output:
I get that the |
False alarm, fixing ino_t was enough. Yay! It looks like the bsd errors are unrelated, so I’m hoping this should be good to go now. |
Yes, the *BSD errors are being resolved upstream. This LGTM.
It means that when passing an initialized pthread_condattr_t with some byte pattern to C, the C code receiving it by argument did not read the same byte pattern, which obviously happened because |
@gnzlbg What are the next steps for this PR? |
It can land once CI is green, but CI is currently broken because of an unrelated bug in rust-lang/rust. I'll check that out and will approve this as soon as that's fixed. |
rust-lang/rust#64019 is in the homu queue with the fix, should land on nightly sometime soon: https://buildbot2.rust-lang.org/homu/queue/rust |
Since that can often take some time, can the freebsd builders be pinned to an older working nightly so this can land in the meantime? |
Sure! |
@bors: r+ |
📌 Commit 06c980e has been approved by |
Update Emscripten system types These changes bring the types up to parity with recent Emscripten versions using the upstream LLVM wasm backend. These changes should be coordinated with the upgrade of rustc's Emscripten support. See https://internals.rust-lang.org/t/upgrading-rust-s-emscripten-support/10684
💔 Test failed - checks-cirrus-freebsd-12 |
☀️ Test successful - checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, status-azure |
These changes bring the types up to parity with recent Emscripten
versions using the upstream LLVM wasm backend. These changes should be
coordinated with the upgrade of rustc's Emscripten support. See
https://internals.rust-lang.org/t/upgrading-rust-s-emscripten-support/10684