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

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

gas i386 wrong displacement with addl $GOT, %eax


From: Kevin Ryde
Subject: gas i386 wrong displacement with addl $GOT, %eax
Date: 29 Oct 2000 08:17:44 +1000
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.5

Using the Debian packaged binutils 2.10.0.18, or the current binutils
cvs, I noticed that assembling a foo.s containing

           .text
    L1:
            addl    $_GLOBAL_OFFSET_TABLE_+[.-L1], %eax
 
produces (with objdump), 

    00000000 <L1>:
       0:   05 02 00 00 00          add    $0x2,%eax
                            1: R_386_GOTPC  _GLOBAL_OFFSET_TABLE_

I think the "2" displacement is incorrect and it should be "1".
Certainly it seems that using this in a program leaves %eax off by 1.

Other registers, like the standard %ebx that gcc uses, work fine as
far as I can tell (generating "2" which is correct for an addl with a
mod/rm byte).



reply via email to

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