Skip to content

Commit

Permalink
Emscripten: link with -sWASM_BIGINT
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hoodmane committed Oct 15, 2024
1 parent 17a19e6 commit 306e7b4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,7 @@ impl<'a> Linker for EmLinker<'a> {
_crate_type: CrateType,
_out_filename: &Path,
) {
self.cmd.arg("-sWASM_BIGINT");
}

fn link_dylib_by_name(&mut self, name: &str, _verbatim: bool, _as_needed: bool) {
Expand Down

0 comments on commit 306e7b4

Please sign in to comment.