gas/ChangeLog:
[binutils-gdb.git] / gas / config / tc-i386.c
index 183e244a25f63e010c83c0f8efcc73cc28d6ac1f..4defd015cc8f35e7f015305796b617bf49bc7a1b 100644 (file)
@@ -1008,6 +1008,7 @@ md_begin ()
     operand_chars['?'] = '?';
 #endif
     digit_chars['-'] = '-';
+    mnemonic_chars['-'] = '-';
     identifier_chars['_'] = '_';
     identifier_chars['.'] = '.';
 
@@ -3320,23 +3321,23 @@ output_insn ()
       char *p;
       unsigned char *q;
 
-      /* All opcodes on i386 have either 1 or 2 bytes, PadLock instructions
-        have 3 bytes.  We may use one more higher byte to specify a prefix
-        the instruction requires.  */
-      if ((i.tm.cpu_flags & CpuPadLock) != 0
-         && (i.tm.base_opcode & 0xff000000) != 0)
-        {
-         unsigned int prefix;
-         prefix = (i.tm.base_opcode >> 24) & 0xff;
-
-         if (prefix != REPE_PREFIX_OPCODE
-             || i.prefix[LOCKREP_PREFIX] != REPE_PREFIX_OPCODE)
-           add_prefix (prefix);
+      /* All opcodes on i386 have either 1 or 2 bytes.  We may use one
+        more higher byte to specify a prefix the instruction
+        requires.  */
+      if ((i.tm.base_opcode & 0xff0000) != 0)
+       {
+         if ((i.tm.cpu_flags & CpuPadLock) != 0)
+           {
+             unsigned int prefix;
+             prefix = (i.tm.base_opcode >> 16) & 0xff;
+
+             if (prefix != REPE_PREFIX_OPCODE
+                 || i.prefix[LOCKREP_PREFIX] != REPE_PREFIX_OPCODE)
+               add_prefix (prefix);
+           }
+         else
+           add_prefix ((i.tm.base_opcode >> 16) & 0xff);
        }
-      else
-       if ((i.tm.cpu_flags & CpuPadLock) == 0
-           && (i.tm.base_opcode & 0xff0000) != 0)
-         add_prefix ((i.tm.base_opcode >> 16) & 0xff);
 
       /* The prefix bytes.  */
       for (q = i.prefix;
@@ -3357,13 +3358,7 @@ output_insn ()
        }
       else
        {
-         if ((i.tm.cpu_flags & CpuPadLock) != 0)
-           {
-             p = frag_more (3);
-             *p++ = (i.tm.base_opcode >> 16) & 0xff;
-           }
-         else
-           p = frag_more (2);
+         p = frag_more (2);
 
          /* Put out high byte first: can't use md_number_to_chars!  */
          *p++ = (i.tm.base_opcode >> 8) & 0xff;
@@ -3567,7 +3562,8 @@ output_imm (insn_start_frag, insn_start_off)
              int sign = 0;
 
              if ((i.types[n] & (Imm32S))
-                 && i.suffix == QWORD_MNEM_SUFFIX)
+                 && (i.suffix == QWORD_MNEM_SUFFIX
+                     || (!i.suffix && (i.tm.opcode_modifier & No_lSuf))))
                sign = 1;
              if (i.types[n] & (Imm8 | Imm8S | Imm16 | Imm64))
                {
@@ -5379,6 +5375,13 @@ tc_gen_reloc (section, fixp)
 #endif
       code = fixp->fx_r_type;
       break;
+    case BFD_RELOC_X86_64_32S:
+      if (!fixp->fx_pcrel)
+       {
+         /* Don't turn BFD_RELOC_X86_64_32S into BFD_RELOC_32.  */
+         code = fixp->fx_r_type;
+         break;
+       }
     default:
       if (fixp->fx_pcrel)
        {