Description
A Firefox developer filed a bug report about Rust symbols not being correctly represented in crash reports:
0 XUL GeckoCrash toolkit/xre/nsAppRunner.cpp:5093 context
1 XUL gkrust_shared::panic_hook toolkit/library/rust/shared/lib.rs:240 frame_pointer
2 XUL core::ops::function::Fn::call src/libcore/ops/function.rs:69 cfi
3 XUL rust_panic_with_hook src/libstd/panicking.rs:482 cfi
4 XUL continue_panic_fmt src/libstd/panicking.rs:385 cfi
5 XUL rust_begin_panic src/libstd/panicking.rs:312 cfi
6 XUL panic_fmt src/libcore/panicking.rs:85 cfi
7 XUL panic src/libcore/panicking.rs:49 cfi
The expectation was that, e.g. rust_panic_with_hook
would have been std::panicking::rust_panic_with_hook
.
We had recently upgraded to Rust 1.34, which led to comparing object files before and after the upgrade. I compared Linux x86-64 binaries; I don't see why the analysis doesn't apply to OS X's Mach-O files, but it's possible the results are different there. (The above crash is from OS X, and we have crashes using Rust 1.33 that do display std::panicking::rust_panic_with_hook
and similar.) The ELF symbol table in both cases lists rust_panic_with_hook
as _ZN3std9panicking20rust_panic_with_hook$UNIQUE_ID
, so that wasn't the problem.
We then looked at the debug information. Rust 1.33 generated, according to readelf --debug-dump=info
:
<3><2155a724>: Abbrev Number: 301 (DW_TAG_subprogram)
<2155a726> DW_AT_low_pc : 0x5738510
<2155a72a> DW_AT_high_pc : 0x6b2
<2155a72e> DW_AT_frame_base : 1 byte block: 54 (DW_OP_reg4 (esp))
<2155a730> DW_AT_linkage_name: (indirect string, offset: 0x9d7fc09): _ZN3std9panicking20rust_panic_with_hook17he447c38467745511E
<2155a734> DW_AT_name : (indirect string, offset: 0x9d7fc45): rust_panic_with_hook
<2155a738> DW_AT_decl_file : 11
<2155a739> DW_AT_decl_line : 447
<2155a73b> DW_AT_external : 1
<2155a73b> DW_AT_noreturn : 1
Notice the existence of both DW_AT_name
and DW_AT_linkage_name
. Rust 1.34, in contrast, generated:
<1><216d7afa>: Abbrev Number: 293 (DW_TAG_subprogram)
<216d7afc> DW_AT_low_pc : 0x5734990
<216d7b00> DW_AT_high_pc : 0x6ae
<216d7b04> DW_AT_name : (indirect string, offset: 0x9db1282): rust_panic_with_hook
which drops the DW_AT_linkage_name
and is also significantly less informative than its predecessor.
I'm not familiar enough with rustc
to know what might have caused this regression. One of my colleagues pointed out #58208, which changed how various bits of panic infrastructure are imported into libstd
. It's not clear to me whether it's that specific change, or how the compiler internally describes crate::
symbols to LLVM, or something else entirely.