-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Rust is inconsistently re-exporting rlib symbols from a binary #84934
Copy link
Copy link
Open
Labels
A-codegenArea: Code generationArea: Code generationA-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.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationA-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.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I noticed some strange behavior while trying to optimize file size. Consider this cargo setup:
Cargo.toml:
src/lib.rs:
examples/big1.rs:
examples/big2.rs:
examples/big3.rs:
On my mac using both
rustc 1.51.0 (2fd73fabe 2021-03-23)andrustc 1.53.0-nightly (42816d61e 2021-04-24), I found that the rust binary for the two examples will be different:Those handful of bytes of difference appears to be because for some reason,
big2binary is re-exporting the_big2function, but thebig1binary does not re-export_big1:Ideally we'd optimize away all these symbols to shave off some bytes, but if that's difficult, we probably should at least make things consistent.