This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Add --alt-nops=short|long to x86/x86-64 assemblers
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 14 Jun 2006 08:01:58 -0700
- Subject: Re: PATCH: Add --alt-nops=short|long to x86/x86-64 assemblers
- References: <20060613190254.GB21884@lucon.org> <448FBB66.7040806@redhat.com>
On Wed, Jun 14, 2006 at 08:31:50AM +0100, Nick Clifton wrote:
> Hi H.J.
>
> >Since Pentium Pro, there are new nops instructions. This patch adds
> >--alt-nops=short|long to x86/x86-64 assemblers. --alt-nops=short
> >will generate a single nop instruction up to 10 bytes for code
> >alignment. --alt-nops=long will generate a single nop instruction up
> >to 15 bytes. Any comments?
>
> I am not familiar with the x86 instruction set, so please can you
> explain why it is necessary to have these two different versions of the
> nop and why the user has to select one ? ie if the space to be padded
> is up to 10 bytes why can't the assembler just use the "short" version
> automatically and if it is longer than 10 bytes use the "long" version ?
x86/x86-64 assemblers need to fill the text section from 1 to
15 bytes for alignment. We have simple nop instructions for 1 to
10 bytes. For 11 to 15 bytes, we can add 0x66 prefix repeatedly
to 10 byte nop to get 11-15byte nops. However some processors
prefer simple nops. That is, 3 0x66 prefixes on the 10 byte nop
are slower on those processors than a 6 byte nop + a 7 byte nop.
User can use --alt-nops=short to avoid repeated 0x66 prefixes.
Maybe we can use something other than short|long. But I don't
have a better name.
H.J.