bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

objdump BUG: wrong DISASM


From: Frank Klemm
Subject: objdump BUG: wrong DISASM
Date: 03 Sep 2001 18:33:11 +0200

Take the following code:
---------------------------------------------------------------------------------------------
.text

        mul     %eax                    # edx:eax := eax * eax  (unsigned)
        imul    %eax                    # edx:eax := eax * eax  (signed)
        mul     %ebx                    # eax:eax := eax * ebx  (unsigned)
        imul    %ebx                    # eax:eax := eax * ebx  (signed)
        mul     %ecx                    # eax:eax := eax * ecx  (unsigned)
        imul    %ecx                    # eax:eax := eax * ecx  (signed)
        mul     %edx                    # edx:eax := eax * edx  (unsigned)
        imul    %edx                    # edx:eax := eax * edx  (signed)
        imul    %edx, %eax              #     eax := eax * edx  (signed or 
unsigned)
        imul    %ecx, %eax              #     eax := eax * ecx  (signed or 
unsigned)
        imul    %ebx, %eax              #     eax := eax * ebx  (signed or 
unsigned)
        imul    %eax, %eax              #     eax := eax * eax  (signed or 
unsigned)

.end
----------------------------------------------------------------------------------------------------
assemble (use as or gcc)  and then disassemble them (objdump):

---------------------------------------------------------------------------------------------
test.o:     file format elf32-i386

Disassembly of section .text:

00000000 <.text>:
   0:   f7 e0                   mul    %eax,%eax
   2:   f7 e8                   imul   %eax,%eax
   4:   f7 e3                   mul    %ebx,%eax
   6:   f7 eb                   imul   %ebx,%eax
   8:   f7 e1                   mul    %ecx,%eax
   a:   f7 e9                   imul   %ecx,%eax
   c:   f7 e2                   mul    %edx,%eax
   e:   f7 ea                   imul   %edx,%eax        <---- different 
statements, same disasm
  10:   0f af c2                imul   %edx,%eax        <---- different 
statements, same disasm
  13:   0f af c1                imul   %ecx,%eax
  16:   0f af c3                imul   %ebx,%eax
  19:   0f af c0                imul   %eax,%eax
-------------------------------------------------------------------------------------------------
The 64 bit IMULs and the 32 bit IMULs are disassembled to the sample mnemonic.

For the 64 bit mnemonics the follwoing syntax should be used:

        imul    reg
        mul     reg

May be the additional syntax

        imul    reg, %eax, %edx:%eax
        mul     reg, %eax, %edx:%eax

can also be used. But then also the assmbeler should use this syntax.

-- 
Frank Klemm
Carl Zeiss Jena, Advanced Imaging Microscopy
phone:   ++49 (3641) 64-2721
fax:         ++49 (3641) 64-3144 
eMail:     address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]