bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/658] New: i386 assembler and disassembler can't handle SIB with


From: hjl at lucon dot org
Subject: [Bug gas/658] New: i386 assembler and disassembler can't handle SIB with INDEX==4
Date: 13 Jan 2005 19:29:46 -0000

SIB with INDEX==4 is a special case. i386 assembler doesn't support
it directly and disassembler generates assembly code which assembler
doesn't support:

address@hidden i386]$ cat x.s
        .byte   0x8B, 0x04, 0x23        # effect is: movl (%ebx), %eax
        .byte   0x8B, 0x04, 0x63        # effect is: movl (%ebx), %eax
        .byte   0x8B, 0x04, 0xA3        # effect is: movl (%ebx), %eax
        .byte   0x8B, 0x04, 0xE3        # effect is: movl (%ebx), %eax
address@hidden i386]$ gcc -c x.s
address@hidden i386]$ objdump -d x.o

x.o:     file format elf32-i386

Disassembly of section .text:

00000000 <.text>:
   0:   8b 04 23                mov    (%ebx),%eax
   3:   8b 04 63                mov    (%ebx,2),%eax
   6:   8b 04 a3                mov    (%ebx,4),%eax
   9:   8b 04 e3                mov    (%ebx,8),%eax
address@hidden i386]$ objdump -d -m i386:intel x.o

x.o:     file format elf32-i386

Disassembly of section .text:

00000000 <.text>:
   0:   8b 04 23                mov    eax,DWORD PTR [ebx]
   3:   8b 04 63                mov    eax,DWORD PTR [ebx*2]
   6:   8b 04 a3                mov    eax,DWORD PTR [ebx*4]
   9:   8b 04 e3                mov    eax,DWORD PTR [ebx*8]
address@hidden i386]$ cat z.s
        mov    (%ebx,1),%eax
        mov    (%ebx,2),%eax
        mov    (%ebx,4),%eax
        mov    (%ebx,8),%eax
address@hidden i386]$ gcc -c z.s
z.s: Assembler messages:
z.s:2: Warning: scale factor of 2 without an index register
z.s:3: Warning: scale factor of 4 without an index register
z.s:4: Warning: scale factor of 8 without an index register
address@hidden i386]$ objdump -d z.o

z.o:     file format elf32-i386

Disassembly of section .text:

00000000 <.text>:
   0:   8b 03                   mov    (%ebx),%eax
   2:   8b 03                   mov    (%ebx),%eax
   4:   8b 03                   mov    (%ebx),%eax
   6:   8b 03                   mov    (%ebx),%eax

It is odd for assembler to accept (%ebx,1), but warn (%ebx,2). I'd like
to change dissembly to display

address@hidden i386]$
/export/build/gnu/binutils-debug/build-i686-linux/binutils/objdump -d x.o

x.o:     file format elf32-i386

Disassembly of section .text:

00000000 <.text>:
   0:   8b 04 23                mov    (%ebx,1),%eax
   3:   8b 04 63                mov    (%ebx,2),%eax
   6:   8b 04 a3                mov    (%ebx,4),%eax
   9:   8b 04 e3                mov    (%ebx,8),%eax
address@hidden i386]$
/export/build/gnu/binutils-debug/build-i686-linux/binutils/objdump -d -m
i386:intel  x.o

x.o:     file format elf32-i386

Disassembly of section .text:

00000000 <.text>:
   0:   8b 04 23                mov    eax,DWORD PTR [ebx*1]
   3:   8b 04 63                mov    eax,DWORD PTR [ebx*2]
   6:   8b 04 a3                mov    eax,DWORD PTR [ebx*4]
   9:   8b 04 e3                mov    eax,DWORD PTR [ebx*8]

and make the assembler to accept (%ebx,[1248]) as SIB with INDEX==4. It
will change the binary generated by assembler. Will it a be problem?

-- 
           Summary: i386 assembler and disassembler can't handle SIB with
                    INDEX==4
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: hjl at lucon dot org
                CC: bug-binutils at gnu dot org
GCC target triplet: i686-pc-linux-gnu


http://sources.redhat.com/bugzilla/show_bug.cgi?id=658

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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