[Bug gas/22874] GAS does not emit multibyte nops before a function symbol

2018-03-31 Thread jeremip11 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22874

Jeremi  changed:

   What|Removed |Added

 CC||jeremip11 at gmail dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/22874] GAS does not emit multibyte nops before a function symbol

2018-03-07 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22874

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |2.31

--- Comment #6 from H.J. Lu  ---
Fixed for 2.31.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/22874] GAS does not emit multibyte nops before a function symbol

2018-03-07 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22874

--- Comment #5 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3ae729d5a4f63740ed9a778960b17c2912b0bbdd

commit 3ae729d5a4f63740ed9a778960b17c2912b0bbdd
Author: H.J. Lu 
Date:   Wed Mar 7 04:18:45 2018 -0800

x86: Rewrite NOP generation for fill and alignment

Rewrite NOP generation for fill and code alignment by:

1. Add a 11-byte NOP with another 0x66 prefix.
2. Remove the multi-byte NOP entries which consist of 2 instructions.
3. Select proper NOPs based on ISA and processor tuning.
4. Generate multiple NOPs with the longer NOPs first followed by the
shorter NOP.
5. Use jump for larger NOP padding:
   a. > 8 bytes (2 NOPs) in 16-bit mode.
   b. > 14 bytes (2 NOPs) for older processors.
   c. > 77 bytes (7 NOPs) for newer processors.
6. Update MAX_MEM_FOR_RS_ALIGN_CODE to 4095.

PR gas/22874
* config/tc-i386.c (f32_5): Removed.
(f32_8): Likewise.
(f32_9): Likewise.
(f32_10): Likewise.
(f32_11): Likewise.
(f32_12): Likewise.
(f32_13): Likewise.
(f32_14): Likewise.
(f16_5): Likewise.
(f16_6): Likewise.
(f16_7): Likewise.
(f16_8): Likewise.
(jump_31): Likewise.
(alt64_11): Likewise.
(alt64_patt): Likewise.
(jump_disp8): New.
(jump32_disp32): Likewise.
(jump16_disp32): Likewise.
(alt_11): Likewise.
(f32_patt): Updated.
(f16_patt): Likewise.
(alt_patt): Add alt_11.
(i386_align_code): Merged with ...
(i386_generate_nops): This.  Rewritten.
(fits_in_imm7): Moved before i386_generate_nops.
(fits_in_imm31): Likewise.
* config/tc-i386.h (MAX_MEM_FOR_RS_ALIGN_CODE): Updated to
4095.
(i386_align_code): Removed.
(HANDLE_ALIGN): Rewritten with i386_generate_nops.
* doc/as.texinfo: Update limits of control byte for x86 .nops
directive.
* testsuite/gas/i386/i386.exp: Run nops-7 and x86-64-nops-7.
* gas/testsuite/gas/i386/noavx-3.l: Updated.
* gas/testsuite/gas/i386/nop-1.d: Likewise.
* gas/testsuite/gas/i386/nop-1.s: Likewise.
* gas/testsuite/gas/i386/nop-2.d: Likewise.
* gas/testsuite/gas/i386/nop-2.s: Likewise.
* gas/testsuite/gas/i386/nop-3.d: Likewise.
* gas/testsuite/gas/i386/nop-4.d: Likewise.
* gas/testsuite/gas/i386/nop-5.d: Likewise.
* gas/testsuite/gas/i386/nop-5.s: Likewise.
* gas/testsuite/gas/i386/nop-6.d: Likewise.
* gas/testsuite/gas/i386/nop-bad-1.l: Likewise.
* gas/testsuite/gas/i386/nops-1-core2.d: Likewise.
* gas/testsuite/gas/i386/nops-1-i386-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-1-i386.d: Likewise.
* gas/testsuite/gas/i386/nops-1-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-1-k8.d: Likewise.
* gas/testsuite/gas/i386/nops-1.d: Likewise.
* gas/testsuite/gas/i386/nops-2-core2.d: Likewise.
* gas/testsuite/gas/i386/nops-2-i386.d: Likewise.
* gas/testsuite/gas/i386/nops-2.d: Likewise.
* gas/testsuite/gas/i386/nops-3-i386.d: Likewise.
* gas/testsuite/gas/i386/nops-3-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-3.d: Likewise.
* gas/testsuite/gas/i386/nops-4-i386.d: Likewise.
* gas/testsuite/gas/i386/nops-4-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-4.d: Likewise.
* gas/testsuite/gas/i386/nops-4a-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-5-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-5.d: Likewise.
* gas/testsuite/gas/i386/nops-6.d: Likewise.
* gas/testsuite/gas/i386/nops16-1.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nop-1.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nop-2.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nop-5.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-1-core2.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-1-g64.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-1-k8.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-1-pentium.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-1.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-2.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-3.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-4-core2.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-4-k8.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-4.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-5-k8.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-5.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise.
* 

[Bug gas/22874] GAS does not emit multibyte nops before a function symbol

2018-02-26 Thread mliska at suse dot cz
https://sourceware.org/bugzilla/show_bug.cgi?id=22874

--- Comment #4 from Martin Liska  ---
(In reply to H.J. Lu from comment #1)
> The limit of multibyte nop for code alignment is
> 
> #define MAX_MEM_FOR_RS_ALIGN_CODE  31

Thanks, I can confirm that:

004004c0 :
  4004c0:   eb fe   jmp4004c0 
  4004c2:   66 2e 0f 1f 84 00 00nopw   %cs:0x0(%rax,%rax,1)
  4004c9:   00 00 00 
  4004cc:   66 2e 0f 1f 84 00 00nopw   %cs:0x0(%rax,%rax,1)
  4004d3:   00 00 00 
  4004d6:   66 2e 0f 1f 84 00 00nopw   %cs:0x0(%rax,%rax,1)
  4004dd:   00 00 00 

004004e0 :
  4004e0:   f3 c3   repz retq 
  4004e2:   66 2e 0f 1f 84 00 00nopw   %cs:0x0(%rax,%rax,1)
  4004e9:   00 00 00 
  4004ec:   0f 1f 40 00 nopl   0x0(%rax)

So the logical question is why is it limited? Does it have any disadvantages to
emit also big paddings in between symbols?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/22874] GAS does not emit multibyte nops before a function symbol

2018-02-22 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22874

--- Comment #3 from Alan Modra  ---
Argh, I wish I could delete comments..  Same source file, these are indeed gas
inserted nops.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/22874] GAS does not emit multibyte nops before a function symbol

2018-02-22 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22874

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com
   Severity|normal  |enhancement

--- Comment #2 from Alan Modra  ---
Those nops are emitted by the linker, not the assembler.  We currently have no
generic infrastructure for emitting fancy nop sequences in linker generated
padding, but see emultempl/ppc32elf.em:no_zero_padding.

However, I question whether emitting multi-byte nops in padding on x86 is a
good idea.  If you somehow execute those nops, what happens when you jump into
the middle of a multi-byte nop?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/22874] GAS does not emit multibyte nops before a function symbol

2018-02-22 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22874

H.J. Lu  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #1 from H.J. Lu  ---
The limit of multibyte nop for code alignment is

#define MAX_MEM_FOR_RS_ALIGN_CODE  31

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils