Skip to content

no way to not ship panic strings inside the compiled binary  #60105

Closed
@pocesar

Description

@pocesar

Already have panic = "abort" in cargo, and it doesn't seem to leave the panic!() strings out of the compiled binary, even on --release build. I don't care about panic strings, I just want a slim generated exe that fails if something goes wrong.
tokio, crossbeam and chrono are adding a lot of useless strings in the .rdata on Windows, for example. also opt-level = "s" (and "z")
tried to use panic::set_hook as well, it didn't do anything. tried to make the long path names using remap-path-prefix but it seemed to have no effect (the paths are still full absolute paths to current user folder/.cargo/registry). doesn't matter if I use windows paths (eg: C:\Users or Unix C:/Users) and besides the #40552 that's two years old, but a minor issue when you need to rely on std and size optimizations.

also tried a lot of other stuff (like link-arg=-s, debuginfo=0, no-landing-pads, etc), while the generated exe is smaller than a full blown cargo build --release, so it's really an unexpected output from the compiler

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.I-heavyIssue: Problems and improvements with respect to binary size of generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions