Repository navigation
Emscripten: link with -sWASM_BIGINT - #131736
Conversation
commented
Oct 15, 2024
|
I'm going to ask Alex to review this because I don't know much about this. r? @alexcrichton If Alex thinks this is a good idea, then we can go ahead and also mark this with relnotes. |
commented
Oct 15, 2024
|
@sbc100 have you thought about making |
commented
Oct 15, 2024
|
If #131582 lands first, this PR should probably update the enabled WASM features section |
commented
Oct 15, 2024
Yes, |
commented
Oct 15, 2024
See emscripten-core/emscripten#19156 and |
commented
Oct 16, 2024
|
I'm not an expert on the Emscripten side of things so in terms of "is this the right time?" I'd defer to the folks who know more, so sounds like this is a green-light there and good to go. One question I would have though is that you mention that this changes the ABI. Does that mean that this would impact C/C++/Rust code being linked together (statically, not dynamically)? For example does the |
commented
Oct 16, 2024
|
It's only a link flag so no action is needed for static libraries. Any dynamic libraries also need to be linked with this flag. |
commented
Oct 16, 2024
|
Ok great! If this is going to be the default in Emscripten soon though should rustc follow Emscripten's defaults rather than having its own configuration? If Emscripten switches by default then users would only "just" need to upgrade their Emscripten toolchain, right? If we do go the rustc route though mind modifying the target definition instead of the linker definition? |
306e7b4 to
7f4f3d8
Compare
commented
Oct 16, 2024
|
These commits modify compiler targets. |
commented
Oct 16, 2024
|
This flag does make a significant in the quality of the linked executable so people should be using it unless they have a reason not to. But we could indeed wait and stay with the Emscripten defaults if they are switching it soon. |
|
@alexcrichton Now I remember Rust dynamic libraries linked without On this basis, I'd say we should move forward with merging this. |
|
@hoodmane Can you confirm whether we might want updates to the Obviously not when it becomes the default, so I think we're fine just merging this now. I don't even know that we actually want to patch |
commented
Oct 16, 2024
Sounds good to me! r=me assuming the answer to @workingjubilee's question is "no breakage" (which give my understanding is the answer, but would be good for @hoodmane you to confirm) |
commented
Oct 17, 2024
|
Yeah. |
commented
Oct 17, 2024
|
Actually, linking with |
commented
Oct 17, 2024
|
Cool, let's... Oh, we can't actually merge this? Damn. |
commented
Oct 17, 2024
Yes, the explicit |
|
Okay I opened an Emscripten PR to hopefully this: emscripten-core/emscripten#22765 In the meantime, can we adjust the I think if we insert this with a comment saying that it's a hack around emscripten-core/emscripten#22758 and we can remove it when we drop support for Emscripten 3.1.69 it should be okay? |
|
Also opened a PR to work around it on Rust's side: #131885 |
When linking an executable without dynamic linking, this is a pure improvement. It significantly reduces code size and avoids a lot of buggy behaviors. It is supported in all browsers for many years and in all maintained versions of Node. It does change the ABI, so people who are dynamically linking with a library or executable that uses the old ABI may need to turn it off. It can be disabled if needed by passing `-Clink-arg -sWASM_BIGINT=0` to `rustc`. But few people will want to turn it off.
7f4f3d8 to
b071f64
Compare
commented
Nov 11, 2024
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
commented
Nov 12, 2024
|
Cherry picking #132720 on top of this, I get: so one fewer ui test failure than on the main branch. So @alexcrichton @workingjubilee if the bump to libc 0.2.162 is okay then I think this can be merged. |
commented
Nov 20, 2024
|
@alexcrichton @workingjubilee ping. Can we merge this? |
commented
Nov 20, 2024
|
Oh! Hi. |
commented
Nov 20, 2024
|
Yeah, I think we're good here. @bors r+ rollup |
commented
Nov 20, 2024
commented
Nov 21, 2024
|
Thanks @workingjubilee and @alexcrichton! |
When linking an executable without dynamic linking, this is a pure improvement. It significantly reduces code size and avoids a lot of buggy behaviors. It is supported in all browsers for many years and in all maintained versions of Node.
It does change the ABI, so people who are dynamically linking with a library or executable that uses the old ABI may need to turn it off. It can be disabled if needed by passing
-Clink-arg -sWASM_BIGINT=0torustc. But few people will want to turn it off.Note this includes a libc bump to 0.2.162!