-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Symbols blow up binary size to an unreasonable degree on x86_64-unknown-linux-gnu #46034
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.O-linuxOperating system: LinuxOperating system: Linux
Metadata
Metadata
Assignees
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.O-linuxOperating system: LinuxOperating system: Linux
Type
Fields
Give feedbackNo fields configured for issues without a type.
Standard hello world program generated with
cargo new --bin mytestBuilt with
cargo build --release, the resulting binary size is 4270408 bytes.This sounds unreasonably large for a hello world program.
After
strip --strip-all, we get 449224.The non-stripped version is almost 10 times larger than the stripped version. Why?
This is with
rustc 1.23.0-nightly (fa26421f5 2017-11-15), installed through rustup.Here is stable
rustc 1.21.0 (3b72af97e 2017-10-09)for good measure:Normal: 4059968
Stripped: 404096
This time, the initial size is lower, but the stripped size is even smaller, making the non-stripped version slightly more than 10 times larger.
(As a sidenote, I've been noticing that binary sizes for the same program have been steadily increasing with every new rustc, at least on
x86_64-unknown-linux-gnu, but that's a separate issue, I suppose)