Bug 1202 - mcore disassembler: wrong address loopt
Summary: mcore disassembler: wrong address loopt
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.16
: P2 normal
Target Milestone: 2.37
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-16 13:15 UTC by Olaf Bonorden
Modified: 2021-06-03 03:51 UTC (History)
2 users (show)

See Also:
Host:
Target: mcore-elf
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Bonorden 2005-08-16 13:15:50 UTC
objdump shows wrong address vor loopt opcode

Address is 1-extended, see mcore reference.

Patch:

diff -Naur binutils-2.16/opcodes/mcore-dis.c binutils-2.16.new/opcodes/mcore-dis.c
--- binutils-2.16/opcodes/mcore-dis.c   2005-08-15 17:44:46.000000000 +0200
+++ binutils-2.16.new/opcodes/mcore-dis.c       2005-08-16 14:32:02.000000000 +0200
@@ -190,7 +190,7 @@
            long val;
            val = (inst & 0x000F);
            fprintf (stream, "\t%s, 0x%x",
-                   grname[(inst >> 4) & 0xF], memaddr - (val << 1));
+                   grname[(inst >> 4) & 0xF], memaddr + 2 + ((~ (unsigned long)
0x1f) |
(val << 1)) );
          }
          break;
Comment 1 Sourceware Commits 2021-06-03 03:50:23 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a38d139645fe557563c3c513b9175e07ceb5f5f8

commit a38d139645fe557563c3c513b9175e07ceb5f5f8
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Jun 3 12:03:09 2021 +0930

    PR1202, mcore disassembler: wrong address loopt
    
    Fixes a 16 year old bug report, which even came with a patch.
    
    opcodes/
            PR 1202
            * mcore-dis.c (print_insn_mcore): Correct loopt disassembly.
            Use unsigned int for inst.
    gas/
            PR 1202
            * testsuite/gas/mcore/allinsn.d: Correct loopt expected output.
Comment 2 Alan Modra 2021-06-03 03:51:23 UTC
Fixed, finally.  We need more target maintainers.