This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] x86: fix "REP RET" with -madd-bnd-prefix
On Wed, May 30, 2018 at 7:23 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>> On 30.05.18 at 14:35, <hjl.tools@gmail.com> wrote:
>> On Wed, May 30, 2018 at 12:40 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>> --- a/gas/testsuite/gas/i386/x86-64-mpx-add-bnd-prefix.s
>>> +++ b/gas/testsuite/gas/i386/x86-64-mpx-add-bnd-prefix.s
>>> @@ -8,7 +8,9 @@
>>> jmp *(%rbx)
>>> ret
>>> foo:
>>> - # Use of REPNE prefix - we shouldn't get any error
>>> + # Use of any REP prefix - we shouldn't get any error
>>> + rep ret
>>> + repe ret
>>> repne ret
>>> # BND prefix already exists - we shouldn't get any error here
>>> bnd ret
>>>
>>
>> Assembly code asks for F3 prefix and F2 prefix is generated.
>> It does't look right to me.
>
> Not emitting a BND prefix despite -madd-bnd-prefix looks even worse
> to me: Which REP prefix is used doesn't matter without MPX, but it
> very much does matter with MPX.
Assembler should give a warning in this case.
--
H.J.