diff options
author | Sung-hun Kim <sfoon.kim@samsung.com> | 2024-05-13 17:11:49 +0900 |
---|---|---|
committer | Nelson Chu <nelson@rivosinc.com> | 2024-05-20 10:50:20 +0800 |
commit | 3ce12d6d4adb0e3dbdf90628a3e0d37a6ea21512 (patch) | |
tree | 8aaf33205e5e2adcdac3e1a61ab8a233762bf5d2 /bfd/peXXigen.c | |
parent | fe9f9ff5a0b537d45f985c8c399e78e62b5d5429 (diff) | |
download | gdb-3ce12d6d4adb0e3dbdf90628a3e0d37a6ea21512.zip gdb-3ce12d6d4adb0e3dbdf90628a3e0d37a6ea21512.tar.gz gdb-3ce12d6d4adb0e3dbdf90628a3e0d37a6ea21512.tar.bz2 |
RISC-V: PR31733, Change initial CFI operation from DW_CFA_def_cfa_register to DW_CFA_def_cfa
The DWARF specification (especially, DWARF4 and 5 [1,2]) states that
DW_CFA_def_cfa_register cannot be used as the first CFI operation.
It said DW_CFA_def_cfa_register as follows:
... This operation is valid only if the current CFA rule is defined
to use a register and offset.
So, DW_CFA_def_cfa_register can be used after that other definition
operation such as DW_CFA_def_cfa is called. However, the current gas
code emits DW_CFA_def_cfa_register as an initial CFI operation for RISCV.
In the libgcc, the unwinding function does not care about it, so it can
unwind the call stack. However, on the third party library such as
libunwindstack in Android, it causes a fatal error.
This patch changes the initial CFI operation to DW_CFA_def_cfa with
offset 0. It works as same as the previous one, but it does not have
any limitation so it satisfies the DWARF spec. This change resolves
the compatibility issue while preserving the original behaviour.
[1] DWARF4 specification, https://dwarfstd.org/doc/DWARF4.pdf
[2] DWARF5 specification, https://dwarfstd.org/doc/DWARF5.pdf
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
Approved-By: Nelson Chu <nelson@rivosinc.com>
gas/
PR 31733
config/tc-riscv.c (riscv_cfi_frame_initial_instructions): Use
DW_CFA_def_cfa rather than DW_CFA_def_cfa_register.
Diffstat (limited to 'bfd/peXXigen.c')
0 files changed, 0 insertions, 0 deletions