[PATCH] x86: Handle {disp32} for (%bp)/(%ebp)/(%rbp)

Jan Beulich jbeulich@suse.com
Tue Jul 28 18:43:27 GMT 2020


On 28.07.2020 01:23, H.J. Lu via Binutils wrote:
> Since (%bp)/(%ebp)/(%rbp) are encoded as 0(%bp)/0(%ebp)/0(%rbp), use
> disp32/disp16 on 0(%bp)/0(%ebp)/0(%rbp) for {disp32}.

Same for (%r13d) / (%r13) afaict?

> Note: Since there is no disp32 on 0(%bp), use disp16 instead.

What use is it to fix the special case of (%bp) when the more general
case ((%bx), (%si), etc) doesn't work? I anyway think that instead of
...

> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -8151,7 +8151,12 @@ build_modrm_byte (void)
>   		      if (operand_type_check (i.types[op], disp) == 0)
>   			{
>   			  /* fake (%bp) into 0(%bp)  */
> -			  i.types[op].bitfield.disp8 = 1;
> +			  if (i.disp_encoding == disp_encoding_32bit)
> +			    /* NB: Use disp16 since there is no disp32
> +			       in 16-bit mode.  */
> +			    i.types[op].bitfield.disp16 = 1;
> +			  else
> +			    i.types[op].bitfield.disp8 = 1;
>   			  fake_zero_displacement = 1;
>   			}

... the comment you add here, support for {disp16} should be added.

Jan


More information about the Binutils mailing list