This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 6/6] x86/MPX: bndmk, bndldx, and bndstx don't allow RIP-relative addressing
- From: "Jan Beulich" <JBeulich at suse dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: <kirill dot yukhin at intel dot com>,"Binutils" <binutils at sourceware dot org>
- Date: Wed, 09 Oct 2013 08:40:03 +0100
- Subject: Re: [PATCH 6/6] x86/MPX: bndmk, bndldx, and bndstx don't allow RIP-relative addressing
- Authentication-results: sourceware.org; auth=none
- References: <5254349502000078000F9A3D at nat28 dot tlf dot novell dot com> <5254367002000078000F9A61 at nat28 dot tlf dot novell dot com> <CAMe9rOqkjFGjAeZdausWzzZxP1mxiU_XAg+wjAfi-Y_PeqjH6g at mail dot gmail dot com>
>>> On 08.10.13 at 18:13, "H.J. Lu" <hjl.tools@gmail.com> wrote:
> On Tue, Oct 8, 2013 at 7:44 AM, Jan Beulich <JBeulich@suse.com> wrote:
>> gas/
>> 2013-10-08 Jan Beulich <jbeulich@suse.com>
>>
>> * tc-i386.c (i386_index_check): Reject RIP-relative addressing for
>> bndmk, bndldx, and bndstx. Warn about register scaling by other
>> than 1 for bndldx and bndstx.
>>
>> --- 2013-10-07/gas/config/tc-i386.c
>> +++ 2013-10-07/gas/config/tc-i386.c
>> @@ -8360,6 +8375,25 @@ bad_address:
>> || i.index_reg->reg_num == RegEiz))
>> || !i.index_reg->reg_type.bitfield.baseindex)))
>> goto bad_address;
>> +
>> + /* bndmk, bndldx, and bndstx have special restrictions. */
>> + if (current_templates->start->base_opcode == 0xf30f1b
>> + || (current_templates->start->base_opcode & ~1) == 0x0f1a)
>> + {
>> + /* They cannot use RIP-relative addressing. */
>> + if (i.base_reg
>> + && i.base_reg->reg_num == (addr_mode == CODE_64BIT ? RegRip
>> + : RegEip))
>> + {
>> + as_bad (_("`%s' cannot be used here"), operand_string);
>> + return 0;
>> + }
>
> RegEip should be disallowed much earlier since address size
> prefix doesn't work for MPX.
Only if that diagnostic gets converted back to an error, which I
don't agree to so far.
>> + /* bndldx and bndstx ignore their scale factor. */
>> + if (current_templates->start->base_opcode != 0xf30f1b
>> + && i.log2_scale_factor)
>> + as_warn (_("register scaling is being ignored here"));
>
> Scaling factor is still encoded. I am not sure if it belongs to assembler.
That's why it's a warning - it's providing a hint to the programmer
that what (s)he wrote makes no sense, but is being accepted. I
wouldn't, however, mind hiding this one when quiet_warnings is set.
Jan