Bug in objdump disassemble?
H.J. Lu
hjl.tools@gmail.com
Wed Mar 27 18:52:00 GMT 2013
On Wed, Mar 27, 2013 at 10:40 AM, Stavros Filargyropoulos
<stafil@gmail.com> wrote:
> Hey,
>
> I am running objdump with "-m i8086" and the opcode "67 66 c7 04 24 01
> 00 00 00" is translated to " movl $0x1,(%eax,%eax,1)". It should be
> "movl $0x1,(%esp)" I believe.
>
Thanks for the bug report. We didn't check address size prefix when
retrieving the SIB byte. I checked in this patch to fix it.
--
H.J.
---
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 58fb22f..8206282 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gas/i386/addr32.s: Add an SIB test.
+ * gas/i386/addr32.d: Updated.
+
2013-03-27 Alexis Deruelle <alexis.deruelle@gmail.com>
PR binutils/15068
diff --git a/gas/testsuite/gas/i386/addr32.d b/gas/testsuite/gas/i386/addr32.d
index 5866a30..8553fc3 100644
--- a/gas/testsuite/gas/i386/addr32.d
+++ b/gas/testsuite/gas/i386/addr32.d
@@ -12,4 +12,5 @@ Disassembly of section .text:
[ ]*13:[ ]+67 a2 98 08 60 00[ ]+addr32[ ]+mov[ ]+%al,0x600898
[ ]*19:[ ]+67 a3 98 08 60 00[ ]+addr32[ ]+mov[ ]+%ax,0x600898
[ ]*1f:[ ]+67 66 a3 98 08 60 00[ ]+addr32[ ]+mov[ ]+%eax,0x600898
+[ ]*26:[ ]+67 66 c7 04 24 01 00 00 00[ ]+movl[ ]+\$0x1,\(%esp\)
#pass
diff --git a/gas/testsuite/gas/i386/addr32.s b/gas/testsuite/gas/i386/addr32.s
index 3dab339..b899ebd 100644
--- a/gas/testsuite/gas/i386/addr32.s
+++ b/gas/testsuite/gas/i386/addr32.s
@@ -6,3 +6,4 @@
addr32 mov %al,0x600898
addr32 mov %ax,0x600898
addr32 mov %eax,0x600898
+ addr32 movl $0x1,(%esp)
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 533c4a3..39c256e 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-dis.c (get_sib): Add the sizeflag argument. Properly
+ check address mode.
+ (print_insn): Pass sizeflag to get_sib.
+
2013-03-27 Alexis Deruelle <alexis.deruelle@gmail.com>
PR binutils/15068
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 5a77255..eeaf22e 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -11285,11 +11285,11 @@ get_valid_dis386 (const struct dis386 *dp,
disassemble_info *info)
}
static void
-get_sib (disassemble_info *info)
+get_sib (disassemble_info *info, int sizeflag)
{
/* If modrm.mod == 3, operand must be register. */
if (need_modrm
- && address_mode != mode_16bit
+ && ((sizeflag & AFLAG) || address_mode == mode_64bit)
&& modrm.mod != 3
&& modrm.rm == 4)
{
@@ -11574,7 +11574,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
if (dp->name == NULL && dp->op[0].bytemode == FLOATCODE)
{
- get_sib (info);
+ get_sib (info, sizeflag);
dofloat (sizeflag);
}
else
@@ -11582,7 +11582,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
dp = get_valid_dis386 (dp, info);
if (dp != NULL && putop (dp->name, sizeflag) == 0)
{
- get_sib (info);
+ get_sib (info, sizeflag);
for (i = 0; i < MAX_OPERANDS; ++i)
{
obufp = op_out[i];
More information about the Binutils
mailing list