Skip to content

Commit b071f64

Browse files
committed
Emscripten: link with -sWASM_BIGINT
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.
1 parent d4822c2 commit b071f64

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use crate::spec::{
55
pub(crate) fn target() -> Target {
66
// Reset flags for non-Em flavors back to empty to satisfy sanity checking tests.
77
let pre_link_args = LinkArgs::new();
8-
let post_link_args = TargetOptions::link_args(LinkerFlavor::EmCc, &["-sABORTING_MALLOC=0"]);
8+
let post_link_args =
9+
TargetOptions::link_args(LinkerFlavor::EmCc, &["-sABORTING_MALLOC=0", "-sWASM_BIGINT"]);
910

1011
let opts = TargetOptions {
1112
os: "emscripten".into(),

library/Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ dependencies = [
158158

159159
[[package]]
160160
name = "libc"
161-
version = "0.2.161"
161+
version = "0.2.162"
162162
source = "registry+https://github.com/rust-lang/crates.io-index"
163-
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
163+
checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398"
164164
dependencies = [
165165
"rustc-std-workspace-core",
166166
]

library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ miniz_oxide = { version = "0.7.0", optional = true, default-features = false }
3434
addr2line = { version = "0.22.0", optional = true, default-features = false }
3535

3636
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
37-
libc = { version = "0.2.161", default-features = false, features = [
37+
libc = { version = "0.2.162", default-features = false, features = [
3838
'rustc-dep-of-std',
3939
], public = true }
4040

0 commit comments

Comments
 (0)