https://sourceware.org/bugzilla/show_bug.cgi?id=33776

--- Comment #2 from bigmagicreadsun <bigmagicreadsun at gmail dot com> ---
(In reply to Andreas Schwab from comment #1)
> Please provide the assembler input and full command line.

Test Source Code (main.c):

__attribute__((noinline)) int test_frame() {
    int local = 0xDEADBEEF;
    return local;
}

Compilation Command (Problematic Case):

riscv64-unknown-elf-gcc -O0 -march=rv32imac -mabi=ilp32 -g -Wa,-adhlns=main.lst
-c main.c

Problematic Debug Frame Output:

$ riscv64-unknown-elf-readelf --debug-dump=frames main.o
readelf: Warning: unable to apply unsupported reloc type 56 to section
.debug_frame
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
  Version:               3
  Augmentation:          ""
  Code alignment factor: 1
  Data alignment factor: -4
  Return address column: 1
  DW_CFA_def_cfa: r2 (sp) ofs 0
00000010 00000024 00000000 FDE cie=00000000 pc=00000000..00000022
  DW_CFA_advance_loc: 2 to 00000002
  DW_CFA_def_cfa_offset: 26           
  DW_CFA_advance_loc: 4 to 00000006
  DW_CFA_offset: r1 (ra) at cfa-4
  DW_CFA_offset: r8 (s0) at cfa-8
  DW_CFA_advance_loc: 2 to 00000008
  DW_CFA_def_cfa: r8 (s0) ofs 0
  DW_CFA_??? (User defined call frame op: 0x36)

Compilation Command (Correct Case):

riscv64-unknown-elf-gcc -O0 -march=rv32imac -mabi=ilp32 -g -c main.c

Correct Debug Frame Output:

$ riscv64-unknown-elf-readelf --debug-dump=frames main.o
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
  Version:               3
  Augmentation:          ""
  Code alignment factor: 1
  Data alignment factor: -4
  Return address column: 1
  DW_CFA_def_cfa: r2 (sp) ofs 0
00000010 00000024 00000000 FDE cie=00000000 pc=00000000..00000022
  DW_CFA_advance_loc: 2 to 00000002
  DW_CFA_def_cfa_offset: 32          
  DW_CFA_advance_loc: 4 to 00000006
  DW_CFA_offset: r1 (ra) at cfa-4
  DW_CFA_offset: r8 (s0) at cfa-8
  DW_CFA_advance_loc: 2 to 00000008
  DW_CFA_def_cfa: r8 (s0) ofs 0
  DW_CFA_advance_loc: 20 to 0000001c  
  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
  DW_CFA_advance_loc: 2 to 00000020
  DW_CFA_def_cfa_offset: 0
  DW_CFA_nop
  DW_CFA_nop

riscv64-unknown-elf-gcc -v

...

Thread model: single
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20251215 (experimental) (g03a1951a3)

riscv64-unknown-elf-readelf -v
GNU readelf (GNU Binutils) 2.45.50.20251215
Copyright (C) 2025 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to