This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: New .nops directive, to aid Linux alternatives patching?
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Andrew Cooper <andrew dot cooper3 at citrix dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Thu, 8 Feb 2018 12:27:04 -0800
- Subject: Re: New .nops directive, to aid Linux alternatives patching?
- Authentication-results: sourceware.org; auth=none
- References: <9aef8e7e-bb7c-3e8e-ddb6-4501801d4bca@citrix.com> <CAMe9rOpd-3-rAhjDaTSSquE6AmfdgcK1=OBT8btGHjkKd=zLrQ@mail.gmail.com> <9b3d3a35-7c63-a133-befe-2ff366c762e4@citrix.com>
On Thu, Feb 8, 2018 at 12:18 PM, Andrew Cooper
<andrew.cooper3@citrix.com> wrote:
> On 08/02/2018 20:10, H.J. Lu wrote:
>> On Thu, Feb 8, 2018 at 11:26 AM, Andrew Cooper
>> <andrew.cooper3@citrix.com> wrote:
>>> Hello,
>>>
>>> I realise this is a little bit niche, but how feasible would it be to
>>> introduce a new .nops directive which takes a size parameter, and
>>> outputs long nops covering the number of specified bytes?
>>>
>> Sounds to me you want a pseudo NOP instruction:
>>
>> pseudo-NOP N
>>
>> which generates a long NOP with N byte. Is that correct. If yes,
>> what is the range of N?
>
> Currently 255 based on other implementation limits, and I expect that
> ought to be long enough for anyone. There is one existing user for
> N=43, and I expect that to grow a bit.
>
> The real answer properly depends at what point it is more efficient to
> jmp rather than wasting decode bandwidth decoding nops, and I don't know
> the answer, but expect that it isn't larger than 255.
>
How about
{nop} N
If N is less than 15 bytes, it generates a long nop. Otherwise, we use a jump
instruction over nops. Does it work for you?
--
H.J.