This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] x86: Add .nop directive to assembler
On 19/02/18 13:41, Florian Weimer wrote:
> On 02/12/2018 08:38 PM, H.J. Lu wrote:
>> +@cindex @code{nop} directive
>> +@cindex filling memory with NOP
>> +This directive emits @var{size} bytes filled with @code{NOP}
>> +instructions. @var{size} is absolute expression, which must be
>> +between 0 and 512. @var{limit} specifies the size limit of a
>> +single @code{NOP} instruction. If the comma and @var{limit} are
>> +omitted, @var{limit} is assumed to the maximum supported size of
>> +a single @code{NOP} instruction. The valid values of @var{limit}
>> +are between 1 and 8 for 16-bit mode, between 1 and 10 for 32-bit mode,
>> +between 1 and 11 for 64-bit mode. This directive is only allowed
>> +in text sections.
>
> The documentation doesn't say if it is safe to execute those NOPs on
> all future CPUs, or if these NOPs can only be used for non-executing
> padding. I think it's worth clarifying that.
Ah - the usecase I proposed requires them to be usable for executable
padding. Certainly in the 64bit case, the nop sequences do match the
recommended nops from the Intel and AMD optimisation manuals.
~Andrew