diff options
author | Claudiu Zissulescu <claziss@gmail.com> | 2020-07-14 14:51:15 +0300 |
---|---|---|
committer | Claudiu Zissulescu <claziss@gmail.com> | 2020-07-14 14:51:15 +0300 |
commit | 570b0ed6d5368f4653bf019c60fa277ed7e983bf (patch) | |
tree | 396601d110cffb36b44f2395bcec4b14a3f0efe7 /opcodes | |
parent | bfbd943845684ac374c41797154d2c53cc338145 (diff) | |
download | fsf-binutils-gdb-570b0ed6d5368f4653bf019c60fa277ed7e983bf.zip fsf-binutils-gdb-570b0ed6d5368f4653bf019c60fa277ed7e983bf.tar.gz fsf-binutils-gdb-570b0ed6d5368f4653bf019c60fa277ed7e983bf.tar.bz2 |
arc: Detect usage of illegal double register pairs
ARC can use odd-even double register pairs in some selected
instructions. Although the GNU assembler doesn't allow even-odd
registers to be used, there may be cases when the disassembler is
presented with such situation. This patch add a test and detects such
cases.
opcodes/
2020-07-14 Claudiu Zissulescu <claziss@gmail.com>
* arc-dis.c (print_insn_arc): Detect and emit a warning when a
faulty double register pair is detected.
binutils/
2020-07-14 Claudiu Zissulescu <claziss@gmail.com>
* testsuite/binutils-all/arc/double_regs.s: New test.
* testsuite/binutils-all/arc/objdump.exp: Add the above test.
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 5 | ||||
-rw-r--r-- | opcodes/arc-dis.c | 14 |
2 files changed, 16 insertions, 3 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 3a38bb2..f571884 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2020-07-14 Claudiu Zissulescu <claziss@gmail.com> + + * arc-dis.c (print_insn_arc): Detect and emit a warning when a + faulty double register pair is detected. + 2020-07-14 Jan Beulich <jbeulich@suse.com> * i386-dis.c (OP_D): Print dr<N> instead of db<N> in Intel mode. diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c index bf31940..27852e8 100644 --- a/opcodes/arc-dis.c +++ b/opcodes/arc-dis.c @@ -1269,11 +1269,19 @@ print_insn_arc (bfd_vma memaddr, if (!rname) rname = regnames[value]; (*info->fprintf_func) (info->stream, "%s", rname); + + /* Check if we have a double register to print. */ if (operand->flags & ARC_OPERAND_TRUNCATE) { - rname = arcExtMap_coreRegName (value + 1); - if (!rname) - rname = regnames[value + 1]; + if ((value & 0x01) == 0) + { + rname = arcExtMap_coreRegName (value + 1); + if (!rname) + rname = regnames[value + 1]; + } + else + rname = _("\nWarning: illegal use of double register " + "pair.\n"); (*info->fprintf_func) (info->stream, "%s", rname); } if (value == 63) |