FWIW, you can configure this in Cargo.toml:
[profile.release] strip = true
FWIW, you can configure this in Cargo.toml:
[profile.release] strip = true
That change will be live on 21st March, so manual strips won't be required after that.
i.e. all programs are larger by 275KB, not larger by 20x.
Rust doesn’t have the privilege of having a system-wide shared stdlib to make hello world executables equally small.
The overhead comes from Rust having more complex type-safe printf, and error handling code for when the print fails. C doesn’t handle the print error, and C doesn’t print stack traces on error. Most of that 200KB Rust overhead is a parser for dwarf debug info to print the stack trace.
linux-vdso.so.1 (0x00007fff25cb8000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe5f08d9000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe5f0ae2000)
And for Rust linux-vdso.so.1 (0x00007ffc109f9000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f8eda404000)
libc.so.6 => /lib64/libc.so.6 (0x00007f8eda222000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8eda4a8000)
Rather Rust has 1 more dynamically linked library than C.Dynamically linked libs rarely contribute heavily to binary bloat
More generally, you statically link something to avoid distribution hassles of various kinds, not because you care about the specific number.