Skip to content

Please default "force-unwind-tables" to "yes" on Linux, so that unwind tables are present even if panic = "abort" #94815

Open
@mstange

Description

@mstange

On Linux, binaries need to contain unwind tables if one wants to get useful and accurate stack traces in profilers, debuggers and crash reports,. This requirement is mostly due to the fact that the Rust compiler, by default, does not use frame pointers on Linux.

When panic is set to "unwind" (the default), the Rust compiler emits unwind tables for all functions. This is good.

However, when building with panic = "abort", the Rust compiler currently does not emit unwind tables for many functions. For example, a Linux x86_64 build of dump_syms with panic = "abort" has unwind tables for 5017 functions with the default settings, and for 9204 functions with -C force-unwind-tables=yes. The generated code for both builds is identical.

I think force-unwind-tables=yes would be a better default. It does not make the generated code any less efficient; it only generates extra information on the side. People who are concerned about binary size and who do not need useful stack traces can still make the trade-off and set -C force-unwind-tables=no.

This problem was also encountered in rust-lang/backtrace-rs#397 and in #81902.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-enhancementCategory: An issue proposing an enhancement or a PR with one.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