https://sourceware.org/bugzilla/show_bug.cgi?id=33776
Bug ID: 33776
Summary: [RISCV] -Wa,-adhlns option corrupts .eh_frame debug
information
Product: binutils
Version: 2.46 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: bigmagicreadsun at gmail dot com
Target Milestone: ---
I've identified an issue where using the -Wa,-adhlns option with RISC-V
toolchain corrupts debug frame information (--debug-dump=frames output),
specifically in the .eh_frame section. This occurs despite the actual generated
assembly being correct.
Compile this test case with -g but without -adhlns:
__attribute__((noinline)) int test_frame() {
int local = 0xDEADBEEF;
return local;
}
riscv64-unknown-elf-gcc -O0 -g -c frame_test.c
riscv64-unknown-elf-objdump --debug-dump=frames frame_test.o
Actual Behavior with -adhlns:
Contents of the .eh_frame section:
00000000 00000010 00000000 CIE
...
00000014 00000024 00000018 FDE cie=00000000 pc=00000000..00000022
...
DW_CFA_??? (User defined call frame op: 0x36) <-- CORRUPTED OPERATION
Expected Behavior:
Contents of the .eh_frame section:
00000000 00000010 00000000 CIE
...
00000014 00000024 00000018 FDE cie=00000000 pc=00000000..00000022
...
DW_CFA_restore: r1 (ra)
DW_CFA_advance_loc: 2 to 0000001e
DW_CFA_restore: r8 (s0)
DW_CFA_def_cfa: r2 (sp) ofs 32 <-- PROPER UNWINDING
See full comparison and compilation output on Compiler Explorer:
https://godbolt.org/z/1jPfxv74b
The error manifests consistently across toolchain versions when -adhlns is
used. The core issue appears to be that certain options bundled in -adhlns
(particularly -n) interfere with proper CFI state management in RISC-V backend.
--
You are receiving this mail because:
You are on the CC list for the bug.