This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Patch H8/300 : Objdump bug for plain H8/300 target
- From: "Anil Paranjape" <AnilP1 at KPITCummins dot com>
- To: <binutils at sources dot redhat dot com>
- Date: Mon, 12 Apr 2004 18:29:30 +0530
- Subject: Patch H8/300 : Objdump bug for plain H8/300 target
Hi,
I had reported a bug in objdump for plain h8/300 target.
In case of "adds" and "subs" instructions, "erX" is generated in objdump instead of "rX".
Following patch fixes this bug,
ChangeLog
2004-06-04 Anil Paranjpe <anilp1@kpitcummins.com>
opcodes/h8300-dis.c (bfd_h8_disassemble) : Treat "adds" & "subs" separately.
--- opcodes/h8300-dis.c.orig Thu Nov 20 01:14:58 2003
+++ opcodes/h8300-dis.c Tue Apr 6 22:12:39 2004
@@ -716,8 +716,18 @@ bfd_h8_disassemble (addr, info, mach)
int hadone = 0;
int nargs;
- for (nargs = 0;
- nargs < 3 && args[nargs] != (op_type) E;
+ if (strcmp (qi->opcode->name, "adds") == 0
+ || strcmp (qi->opcode->name, "subs") == 0)
+ {
+
+ outfn (stream, "#%d,%s", cst[0], pregnames[regno[1] & 0x7]);
+ return qi->length;
+ }
+ else
+ {
+
+ for (nargs = 0;
+ nargs < 3 && args[nargs] != (op_type) E;
nargs++)
{
int x = args[nargs];
@@ -732,6 +742,7 @@ bfd_h8_disassemble (addr, info, mach)
hadone = 1;
}
+ }
}
return qi->length;
Following is objdump of test case after patch,
***********************************************************************
a.out: file format elf32-h8300
Disassembly of section .text:
00000100 <_main>:
100: 6d f6 mov.w r6,@-r7
102: 0d 76 mov.w r7,r6
104: 1b 87 subs #2,r7
106: 6f 62 ff fe mov.w @(0xfffe:16,r6),r2
10a: 1b 82 subs #2,r2
10c: 6f e2 ff fe mov.w r2,@(0xfffe:16,r6)
110: 0d 20 mov.w r2,r0
112: 0b 87 adds #2,r7
114: 6d 76 mov.w @r7+,r6
116: 54 70 rts
***********************************************************************
No new regressions found in dejagnu testing.
Regards,
Anil Paranjpe
-----Original Message-----
From: Anil Paranjape
Sent: Tuesday, April 06, 2004 11:37 AM
To: 'binutils@sources.redhat.com'
Subject: Objdump bug for plain H8/300 target
Hi,
I found a bug in objdump utility for plain H8/300 target.
I have used binutils snapshot dated 25 March 2004.
Following is test case,
*******************************************
int main
{
int a;
a -= 2;
}
*******************************************
Build commands used are,
h8300-elf-gcc -nostartfiles test.c
h8300-elf-objdump -d --no-show-raw-insn a.out > a.dmp
Object dump file
**************************************************************************************
a.out: file format elf32-h8300
Disassembly of section .text:
00000100 <_main>:
100: 6d f6 mov.w r6,@-r7
102: 0d 76 mov.w r7,r6
104: 1b 87 subs #2,er7
106: 6f 62 ff fe mov.w @(0xfffe:16,r6),r2
10a: 1b 82 subs #2,er2
10c: 6f e2 ff fe mov.w r2,@(0xfffe:16,r6)
110: 0d 20 mov.w r2,r0
112: 0b 87 adds #2,er7
114: 6d 76 mov.w @r7+,r6
116: 54 70 rts
**************************************************************************************
Register "er7" and "er2" are invalid registers in case of plain H8/300.
This bug is observed only when instructions "adds" or "subs" are used.
It should be "r7" instead of "er7" and "r2" instead of "er2".
Regards,
Anil Paranjpe