[PATCH v2 1/4] x86: extend LEA's segment override warning

H.J. Lu hjl.tools@gmail.com
Fri Feb 14 12:03:00 GMT 2020


On Fri, Feb 14, 2020 at 3:43 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> For one both possible forms should be warned about. And then, to guard
> against future surprises, qualify the original opcode check by excluding
> VEX/EVEX-like templates.
>
> gas/
> 2020-02-XX  Jan Beulich  <jbeulich@suse.com>
>
>         * config/tc-i386.c (process_operands): Also check insn prefix
>         for ineffectual segment override warning. Don't cover possible
>         VEX/EVEX encoded insns there.
>         * testsuite/gas/i386/lea.s, testsuite/gas/i386/lea.d,
>         testsuite/gas/i386/lea.e: New.
>         * testsuite/gas/i386/i386.exp: Run new test.
> ---
> v2: Move controversial MPX part to separate patch.
>
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -7194,9 +7194,10 @@ duplicate:
>         }
>      }
>
> -  if (i.tm.base_opcode == 0x8d /* lea */
> -      && i.seg[0]
> -      && !quiet_warnings)
> +  if ((i.seg[0] || i.prefix[SEG_PREFIX])

Does your testcase verify that we need to check both
i.seg[0] and i.prefix[SEG_PREFIX]?  If yes, patch is OK.

Thanks.

> +      && !quiet_warnings
> +      && i.tm.base_opcode == 0x8d /* lea */
> +      && !is_any_vex_encoding(&i.tm))
>      as_warn (_("segment override on `%s' is ineffectual"), i.tm.name);
>

-- 
H.J.



More information about the Binutils mailing list