diff options
author | Andrew Oates <andrew@andrewoates.com> | 2025-02-24 15:36:54 +0800 |
---|---|---|
committer | Nelson Chu <nelson@rivosinc.com> | 2025-03-03 11:25:43 +0800 |
commit | ade87b8e6293f146f754629101cf4e367aec5da9 (patch) | |
tree | 68a6dcbf86bc2ac321cb67b73af2efead4f14a1f /sim/m32r/readx.c | |
parent | 759b09f492d764edfba15c49d12a6f8adfeda019 (diff) | |
download | gdb-ade87b8e6293f146f754629101cf4e367aec5da9.zip gdb-ade87b8e6293f146f754629101cf4e367aec5da9.tar.gz gdb-ade87b8e6293f146f754629101cf4e367aec5da9.tar.bz2 |
RISC-V: Re-define mapping symbol $x to the file elf architecture attribute
The mapping symbol "$x" without an ISA string "means using ISA
configuration from ELF attribute."[1]. Currently the code does not
reset the subset_list. This means that a previous mapping symbol that
overrides the ISA string will continue to be used, rather than the
default string set in the ELF file's .riscv.attributes section. This
can cause incorrect or failed instruction decodings.
In practice, this causes problems when disassembling code generated by
LLVM, which (unlike gas) does not emit explicit mapping symbols at the
start of each section.
This change stores the default architecture string seen at the beginning
of disassembly in the global parse data struct, and restores that to
subset_list whenever a bare "$x" symbol is seen.
[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#mapping-symbol
Before this patch, the mapping-x.s was dumped as,
00000000 <.text>:
0: 00000013 nop
4: 0001 .insn 2, 0x0001
6: 0001 .insn 2, 0x0001
Which is caused by the definiation of $x was conflict with the psABI.
Diffstat (limited to 'sim/m32r/readx.c')
0 files changed, 0 insertions, 0 deletions