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

Jan Beulich jbeulich@suse.com
Fri Feb 14 12:06:00 GMT 2020


On 14.02.2020 13:02, H.J. Lu wrote:
> 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]?

Yes it does - that's why there are two different forms of LEA.
It was actually me not seeing the warning on one of the forms
that prompted me to see what's wrong with the condition.

>  If yes, patch is OK.

Thanks.

Jan



More information about the Binutils mailing list