Skip to content

Add compiler option to strip symbols from generated binaries #71757

Closed
@GabrielMajeri

Description

@GabrielMajeri

There's a long standing Cargo issue, requesting the ability to strip symbols from built Rust binaries.

@alexcrichton suggested here that

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 -C strip or something like that. We could then add a profile setting for Cargo to configure that on the Cargo side of things afterwards.

I'm opening this issue to discuss adding such a -C strip flag and to track its implementation in the compiler.

Right now, it could be a simple boolean flag, which passes an additional option to the linker (since, AFAIK, most linkers have some sort of flag for stripping symbols from the final binaries).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)A-linkageArea: linking into static, shared libraries and binariesC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions