Description
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.