Repository navigation
Add option to strip binaries - #8191
GabrielMajeri wants to merge 1 commit into
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
|
Thanks for the PR! This might be best done as a rust-lang/rust PR first which has access to target information to know what flag should be passed to the linker. For example this could be added as |
|
Thanks for the suggestion! I am closing this PR for now and opening rust-lang/rust#71757 |
Add option to strip binaries This PR adds a Cargo option for stripping symbols from generated binaries. This is based on the `-Z strip` flag for `rustc`, which has been [recently implemented](rust-lang/rust#71757). Notes for reviewers: I'm not entirely sure how we test this, I've created a crate locally and it seems to be working. Supersedes my previous work in #8191. Fixes #3483.
I want to help add an option to Cargo to strip symbols from built binaries. Currently this PR just adds a linker flag, as suggested in this comment.
Questions for reviewers:
I've tried looking at the existing code to add a new
Cargo.tomloption, and I've added this to the[profile.*]section. Please tell me if it would be better to move it somewhere else.How do we handle this on non-*NIX/non-
ldplatforms? I'm guessing we'll need to detect the configured linker for the respective platform.How do we test this? I could add a test for the config option, but a real test would check that the produced binaries are stripped.
If merged, this closes #3483.