rust/compiler/rustc_session/src
bors f437c86ef8 Auto merge of #143613 - Enselic:panic-abort-uwtables, r=petrochenkov
Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default

The linux backtrace unwinder relies on unwind tables to work properly, and generating and printing a backtrace is done by for example the default panic hook.

Begin emitting unwind tables by default again with `-C panic=abort` (see history below) so that backtraces work.

Closes https://github.com/rust-lang/rust/issues/81902 which is **regression-from-stable-to-stable**
Closes https://github.com/rust-lang/rust/issues/94815

### History

Backtraces with `-C panic=abort` used to work in Rust 1.22 but broke in Rust 1.23, because in 1.23 we stopped emitting unwind tables with `-C panic=abort` (see https://github.com/rust-lang/rust/pull/45031 and https://github.com/rust-lang/rust/issues/81902#issuecomment-3046487084).

In 1.45 a workaround in the form of `-C force-unwind-tables=yes` was added (see https://github.com/rust-lang/rust/pull/69984).

`-C panic=abort` was added in [Rust 1.10](https://blog.rust-lang.org/2016/07/07/Rust-1.10/#what-s-in-1-10-stable) and the motivation was binary size and compile time. But given how confusing that behavior has turned out to be, it is better to make binary size optimization opt-in with `-C force-unwind-tables=no` rather than default since the current default breaks backtraces.

Besides, if binary size is a primary concern, there are many other tricks that can be used that has a higher impact.

# Release Note Entry Draft:

## Compatibility Notes

* [Fix backtraces with `-C panic=abort` on Linux by generating unwind tables by default](https://github.com/rust-lang/rust/pull/143613). Build with `-C force-unwind-tables=no` to keep omitting unwind tables.

try-job: aarch64-apple
try-job: armhf-gnu
try-job: aarch64-msvc-1
2025-10-03 15:02:37 +00:00
..
config compiler: remove AbiAlign inside TargetDataLayout 2025-09-27 22:13:53 -07:00
code_stats.rs Document why CodeStats::type_sizes is public 2025-04-21 17:36:36 +02:00
config.rs Auto merge of #146376 - durin42:dwo-specify-path, r=davidtwco 2025-09-29 15:06:55 +00:00
cstore.rs Move NativeLibKind from rustc_session to rustc_hir 2025-08-27 20:24:59 +02:00
errors.rs Improve error messages around invalid literals in attribute arguments 2025-08-28 20:05:04 +02:00
filesearch.rs rustc_session: Add a structure for keeping both explicit and default sysroots 2025-06-24 16:00:04 +03:00
lib.rs move -Ctarget-feature handling into shared code 2025-06-19 09:44:01 +09:00
options.rs Auto merge of #146376 - durin42:dwo-specify-path, r=davidtwco 2025-09-29 15:06:55 +00:00
output.rs Initial support for dynamically linked crates 2025-05-04 22:03:15 +03:00
parse.rs Refactor lint buffering to avoid requiring a giant enum 2025-08-22 01:59:56 -07:00
search_paths.rs Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
session.rs Fix backtraces with -C panic=abort on linux; emit unwind tables by default 2025-10-02 19:46:41 +02:00
utils.rs Move NativeLibKind from rustc_session to rustc_hir 2025-08-27 20:24:59 +02:00