bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/10419] New: nops[] in binutils/gold/x86_64.cc are not actually


From: anders at kaseorg dot com
Subject: [Bug gold/10419] New: nops[] in binutils/gold/x86_64.cc are not actually x86-64 NOPs
Date: 20 Jul 2009 17:33:50 -0000

>From binutils-2.19/gold/x86_64.cc:
  // Nop sequences of various lengths.
  const char nop1[1] = { 0x90 };                   // nop
  const char nop2[2] = { 0x66, 0x90 };             // xchg %ax %ax
  const char nop3[3] = { 0x8d, 0x76, 0x00 };       // leal 0(%esi),%esi
  const char nop4[4] = { 0x8d, 0x74, 0x26, 0x00};  // leal 0(%esi,1),%esi
  …

This table was copied from i386.cc.  However, most of these sequences are not
actually NOPs on x86-64!  For example, nop3, which actually disassembles to “lea
0(%rsi),%esi”, has the effect of clearing the high 32 bits of %rsi.  This can be
verified with a quick test program:
  unsigned long x = 0x12345678ABCDEF00;                          
  printf("x=%lx\n", x);                                          
  asm volatile (".byte 0x8d, 0x76, 0x00" : "=S" (x) : "S" (x));  
  printf("x=%lx\n", x);                                          
Output:
  x=12345678abcdef00    
  x=abcdef00

-- 
           Summary: nops[] in binutils/gold/x86_64.cc are not actually x86-
                    64 NOPs
           Product: binutils
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
        AssignedTo: ian at airs dot com
        ReportedBy: anders at kaseorg dot com
                CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=10419

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]