bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/12687] New: Incorrect jump address for backward local labels wi


From: M8R-oq0m8v at mailinator dot com
Subject: [Bug gas/12687] New: Incorrect jump address for backward local labels with Intel syntax
Date: Wed, 20 Apr 2011 07:34:45 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=12687

           Summary: Incorrect jump address for backward local labels with
                    Intel syntax
           Product: binutils
           Version: 2.22 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: address@hidden
        ReportedBy: address@hidden


Created attachment 5679
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5679
A test for backward local labels with Intel syntax

File test.asm:

    .intel_syntax
    mov eax, 5
1:
    dec eax
    jnz 1b

    ret


Command line (under MinGW):
   as test.asm -o test.o
   ld test.o -o test.exe


Actual result: jump two bytes forward.

00401000      B8 05000000   mov eax,5
00401005      48            dec eax
00401006 +--- 75 02         jne short test.0040100A ; error
00401008 |    C3            ret
00401009 |    90            nop
0040100A +->  90            nop


Expected result: jump three bytes back:

00401000      B8 05000000   mov eax,5
00401005 +->  48            dec eax
00401006 +--- 75 FD         jne short test.00401005
00401008      C3            ret


Additional information

If you specify -a switch (as test.asm -o test.o -a), the bug disappears. If you
rewrite the assembly code using AT&T syntax, it also disappears:
    mov $5, %eax
1:
    dec %eax
    jnz 1b

    ret

I checked the object file (test.o) generated by the GNU Assembler and found the
erroneous jump address in it (so it's not a linker bug).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

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