[PATCH] x86: Check register operand for AddrPrefixOpReg

H.J. Lu hjl.tools@gmail.com
Thu Oct 1 11:35:07 GMT 2020


On Thu, Oct 1, 2020 at 1:22 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 01.10.2020 01:30, H.J. Lu via Binutils wrote:
> > I am checking in this patch and backporting it to 2.35 branch.
>
> But this is wrong, as can be seen from e.g. ...
> > + +[a-f0-9]+: 66 0f 38 f8 0d 00 00 00 00      movdir64b 0x0\(%rip\),%rcx        #.*
> > + +[a-f0-9]+: 67 66 0f 38 f8 0d 00 00 00 00   movdir64b 0x0\(%eip\),%ecx        #.*
> > + +[a-f0-9]+: 67 66 0f 38 f8 0d 00 00 00 00   movdir64b 0x0\(%eip\),%ecx        #.*
>
> ... the middle line here not matching up with
>
> > +     movdir64b foo(%rip),%rcx
> > +     movdir64b foo(%rip),%ecx
> > +     movdir64b foo(%eip),%ecx
>
> ... what was written here. Without your change this
>
>         movdir64b (%rbp), %rax
>         movdir64b (%rbp), %eax
>         movdir64b (%ebp), %rax
>         movdir64b (%ebp), %eax
>
>         movdir64b (%rip), %rax
>         movdir64b (%rip), %eax
>         movdir64b (%eip), %rax
>         movdir64b (%eip), %eax
>
> yields consistent results for both blocks - the middle two entries
> get an error issued.
>
> Please revert, and once again please don't commit (let alone
> backport) patches without giving people at least _a little bit_ of
> time to look at them.
>

The fix is correct.   This specific case came from

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97257

The address prefix changes the register operand in these instructions.
(%rip) is a special case.

-- 
H.J.


More information about the Binutils mailing list