This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] x86: fix handling of %eip/%rip
On Tue, Sep 25, 2007 at 09:30:15AM -0700, H.J. Lu wrote:
> On Tue, Sep 25, 2007 at 05:04:37PM +0100, Jan Beulich wrote:
> > Along with allowing (the admittedly somewhat odd, but possible) %eip-
> > relative addressing to be encoded just like other 32-bit addressing
> > modes, this also fixes the problem of the identifier 'rip' not having
> > been available for programmer use in Intel-syntax 32-bit code.
> >
> > Built and tested on x86_64-unknown-linux-gnu.
> >
> > gas/
> > 2007-09-25 Jan Beulich <jbeulich@novell.com>
> >
> > * config/tc-i386.c (build_modrm_byte): Also check for RegEip
> > when considering IP-relative addressing.
> >
> > gas/testsuite/
> > 2007-09-25 Jan Beulich <jbeulich@novell.com>
> >
> > * gas/i386/reloc64.s: Adjust for %eip-relative addressing no
> > longer generating errors.
> > * gas/i386/reloc64.d, gas/i386/reloc64.l: Update.
> > * gas/i386/x86-64-addr32.s: Remove explicit addr32 prefix
> > for %eip-realtive addressing case.
> >
> > opcodes/
> > 2007-09-25 Jan Beulich <jbeulich@novell.com>
> >
> > * i386-opc.h (RegEip): Define.
> > (RegEiz): Adjust.
> > * i386-reg.tbl: Add eip. Mark rip and eip with RegRex64.
> > * i386-tbl.h: Re-generate.
>
> It looks good. I only have one question.
>
> > --- 2007-09-25/opcodes/i386-reg.tbl 2007-09-25 16:27:55.000000000 +0200
> > +++ 2007-09-25/opcodes/i386-reg.tbl 2007-09-25 17:19:30.000000000 +0200
> > @@ -187,9 +187,10 @@ xmm12, RegXMM, RegRex, 4
> > xmm13, RegXMM, RegRex, 5
> > xmm14, RegXMM, RegRex, 6
> > xmm15, RegXMM, RegRex, 7
> > -// No type will make this register rejected for all purposes except
> > -// for addressing. This saves creating one extra type for RIP.
> > -rip, BaseIndex, 0, RegRip
> > +// No type will make these registers rejected for all purposes except
> > +// for addressing. This saves creating one extra type for RIP/EIP.
> > +rip, BaseIndex, RegRex64, RegRip
> > +eip, BaseIndex, RegRex64, RegEip
>
> Why is RegRex64 needed?
One more thing. Can you update disassemble to use %eip?
Thanks.
H.J.