PATCH: Add -n option to i386 assembler

Alan Modra amodra@bigpond.net.au
Tue Jun 10 01:36:00 GMT 2003


On Mon, Jun 09, 2003 at 10:09:59AM -0700, H. J. Lu wrote:
> +* A new command line option for the i386 assembler, -n,  will turn off
> +  code alignment optimization.

"turn off code alignment optimization" doesn't really say what this
switch does.  I suggest:

* Added -n switch for x86 assembler.  By default, x86 GAS replaces
  multiple nop instructions used for alignment within code sections with
  multi-byte nop instructions such as leal 0(%esi,1),%esi.  This switch
  disables the optimization.

> +extern int optimize_align_code;
> +
>  #define md_do_align(n, fill, len, max, around)				\
>  if ((n) && !need_pass_2							\
> -    && (!(fill) || ((char)*(fill) == (char)0x90 && (len) == 1))		\
> +    && (!(fill)								\
> +	|| (optimize_align_code						\
> +	    && (char)*(fill) == (char)0x90				\
> +	    && (len) == 1))						\
>      && subseg_text_p (now_seg))						\
>    {									\
>      frag_align_code ((n), (max));					\

Looks wrong to me.  Surely optimize_align_code should affect the
!(fill) case too?  You should also fix the formatting.

> --- gas/doc/c-i386.texi.nop	2001-03-09 11:17:14.000000000 -0800
> +++ gas/doc/c-i386.texi	2003-06-09 09:55:10.000000000 -0700
> @@ -61,6 +61,10 @@ These options are only available with th
>  require that the necessary BFD support has been included (on a 32-bit
>  platform you have to add --enable-64-bit-bfd to configure enable 64-bit
>  usage and use x86-64 as target platform).
> +
> +@item -n
> +When this option is used, code alignment optimization will be turned
> +off.
>  @end table
>  
>  @node i386-Syntax

Use the expanded description here too.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list