Allow symbol and label names to be enclosed in double quotes.
[deliverable/binutils-gdb.git] / gas / config / tc-m68hc11.c
index d2aee868c02f92c9142c31ee7001ad9bb791fb68..43cf6b692981a9c2d6b4f3b1b8bd4afe0c246b4d 100644 (file)
@@ -1,7 +1,5 @@
 /* tc-m68hc11.c -- Assembler code for the Motorola 68HC11 & 68HC12.
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
-   2011, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 1999-2015 Free Software Foundation, Inc.
    Written by Stephane Carrez (stcarrez@nerim.fr)
    XGATE and S12X added by James Murray (jsm@jsm-net.demon.co.uk)
 
@@ -1603,11 +1601,8 @@ fixup8 (expressionS *oper, int mode, int opmode)
 
       if (mode == M6811_OP_JUMP_REL)
        {
-         fixS *fixp;
-
-         fixp = fix_new_exp (frag_now, f - frag_now->fr_literal, 1,
-                             oper, TRUE, BFD_RELOC_8_PCREL);
-         fixp->fx_pcrel_adjust = 1;
+         fix_new_exp (frag_now, f - frag_now->fr_literal, 1,
+                      oper, TRUE, BFD_RELOC_8_PCREL);
        }
       else
        {
@@ -1676,8 +1671,7 @@ fixup16 (expressionS *oper, int mode, int opmode ATTRIBUTE_UNUSED)
                          reloc == BFD_RELOC_16_PCREL,
                           reloc);
       number_to_chars_bigendian (f, 0, 2);
-      if (reloc == BFD_RELOC_16_PCREL)
-       fixp->fx_pcrel_adjust = 2;
+
       if (reloc == BFD_RELOC_M68HC11_LO16)
         fixp->fx_no_overflow = 1;
     }
@@ -1756,23 +1750,17 @@ fixup8_xg (expressionS *oper, int mode, int opmode)
     {
       if (mode == M68XG_OP_REL9)
         {
-          fixS *fixp;
-
           /* Future improvement:
             This fixup/reloc isn't adding on constants to symbols.  */
-          fixp = fix_new_exp (frag_now, f - frag_now->fr_literal -1, 2,
-                             oper, TRUE, BFD_RELOC_M68HC12_9_PCREL);
-          fixp->fx_pcrel_adjust = 1;
+          fix_new_exp (frag_now, f - frag_now->fr_literal -1, 2,
+                      oper, TRUE, BFD_RELOC_M68HC12_9_PCREL);
        }
       else if (mode == M68XG_OP_REL10)
         {
-          fixS *fixp;
-
           /* Future improvement:
             This fixup/reloc isn't adding on constants to symbols.  */
-          fixp = fix_new_exp (frag_now, f - frag_now->fr_literal -1, 2,
-             oper, TRUE, BFD_RELOC_M68HC12_10_PCREL);
-          fixp->fx_pcrel_adjust = 1;
+          fix_new_exp (frag_now, f - frag_now->fr_literal -1, 2,
+                      oper, TRUE, BFD_RELOC_M68HC12_10_PCREL);
         }
       else
         {
@@ -2153,8 +2141,8 @@ build_indexed_byte (operand *op, int format ATTRIBUTE_UNUSED, int move_insn)
          if (!check_range (val, M6812_OP_IDX))
            as_bad (_("Offset out of 16-bit range: %ld."), val);
 
-         if (move_insn && !(val >= -16 && val <= 15) 
-             && ((!(mode & M6812_OP_IDX) && !(mode & M6812_OP_D_IDX_2)) 
+         if (move_insn && !(val >= -16 && val <= 15)
+             && ((!(mode & M6812_OP_IDX) && !(mode & M6812_OP_D_IDX_2))
                  || !(current_architecture & cpu9s12x)))
            {
              as_bad (_("Offset out of 5-bit range for movw/movb insn: %ld."),
@@ -2229,9 +2217,9 @@ build_indexed_byte (operand *op, int format ATTRIBUTE_UNUSED, int move_insn)
                  byte <<= 3;
                  byte |= 0xe2;
                  number_to_chars_bigendian (f, byte, 1);
+                 f = frag_more (2);
                  fix_new (frag_now, f - frag_now->fr_literal, 2,
                           sym, off, 0, BFD_RELOC_M68HC12_16B);
-                 f = frag_more (2);
                  return 1;
                }
              else
@@ -2432,7 +2420,7 @@ build_insn_xg (struct m68hc11_opcode *opcode,
       f = m68hc11_new_insn (1);
       number_to_chars_bigendian (f, opcode->opcode >> 8, 1); /* High byte.  */
       fixup8_xg (&operands[0].exp, format, M68XG_OP_REL9);
-    } 
+    }
   else if (format & M68XG_OP_REL10)
     {
       f = m68hc11_new_insn (1);
@@ -2961,7 +2949,7 @@ md_assemble (char *str)
                }
              else
                as_bad ("No opcode found\n");
-              
+
               return;
             }
           else
@@ -2985,7 +2973,7 @@ md_assemble (char *str)
                {
                  opcode_local.opcode |= (operands[0].exp.X_add_number);
                  operands[0].mode = M68XG_OP_IMM3;
-  
+
                  opcode = find (opc, operands, 1);
                   if (opcode)
                     {
@@ -3079,7 +3067,7 @@ md_assemble (char *str)
 
       if (opc->format & (M68XG_OP_REL9 | M68XG_OP_REL10))
         {
-          opcode_local.format = opc->format; 
+          opcode_local.format = opc->format;
           input_line_pointer = skip_whites (input_line_pointer);
           expression (&operands[0].exp);
           if (operands[0].exp.X_op == O_illegal)
@@ -3105,12 +3093,12 @@ md_assemble (char *str)
       if ((*input_line_pointer == '\n') || (*input_line_pointer == '\r')
           || (*input_line_pointer == '\0'))
         return; /* nothing left */
-      
+
       if (*input_line_pointer == '#')
         {
           as_bad ("No register specified before hash\n");
           return;
-        } 
+        }
 
       /* first operand is expected to be a register */
       if ((*input_line_pointer == 'R') || (*input_line_pointer == 'r'))
@@ -3177,12 +3165,12 @@ md_assemble (char *str)
                   if (opcode)
                    opcode_local.opcode = opcode->opcode
                      | (operands[0].reg1 << 8);
-                  
+
                   if (operands[0].exp.X_op != O_constant)
                     as_bad ("Only constants supported at for IMM4 mode\n");
                   else
                     {
-                      if (check_range 
+                      if (check_range
                           (operands[0].exp.X_add_number,M68XG_OP_R_IMM4))
                         opcode_local.opcode
                          |= (operands[0].exp.X_add_number << 4);
@@ -3238,7 +3226,7 @@ md_assemble (char *str)
                              com RD, RS alias for xnor RD,R0,RS
                              mov RD, RS alias for or RD, R0, RS
                              neg RD, RS alias for sub RD, R0, RS */
-                          opcode_local.opcode = opcode->opcode 
+                          opcode_local.opcode = opcode->opcode
                             | (operands[0].reg1 << 8) | (operands[1].reg1 << 2);
                         }
                       else if ((strncmp (opc->opcode->name, "cmp",3) == 0)
@@ -3247,7 +3235,7 @@ md_assemble (char *str)
                           /* special cases for:
                              cmp RS1, RS2 alias for sub R0, RS1, RS2
                              cpc RS1, RS2 alias for sbc R0, RS1, RS2 */
-                          opcode_local.opcode = opcode->opcode 
+                          opcode_local.opcode = opcode->opcode
                            | (operands[0].reg1 << 5) | (operands[1].reg1 << 2);
                         }
                       else
@@ -3289,7 +3277,7 @@ md_assemble (char *str)
                       opcode = find (opc, operands, 1);
                       if (opcode)
                         {
-                          opcode_local.opcode = opcode->opcode 
+                          opcode_local.opcode = opcode->opcode
                             | (operands[0].reg1 << 8) | (operands[1].reg1 << 5)
                             | (operands[2].reg1 << 2);
                           opcode_local.format = M68XG_OP_NONE;
@@ -3326,7 +3314,7 @@ md_assemble (char *str)
                 }
 
               input_line_pointer = skip_whites (input_line_pointer);
-              
+
               if (*input_line_pointer != ',')
                 {
                   as_bad (_("Missing operand."));
@@ -3361,7 +3349,7 @@ md_assemble (char *str)
                     {
                       input_line_pointer++;
                     }
-                      
+
                   /* Ok so far, can only be one mode. */
                   opcode_local.format = M68XG_OP_R_R_OFFS5;
                   operands[0].mode = M68XG_OP_R_R_OFFS5;
@@ -3772,10 +3760,9 @@ s_m68hc11_mark_symbol (int mark)
 
   do
     {
-      name = input_line_pointer;
-      c = get_symbol_end ();
+      c = get_symbol_name (&name);
       symbolP = symbol_find_or_make (name);
-      *input_line_pointer = c;
+      (void) restore_line_pointer (c);
 
       SKIP_WHITESPACE ();
 
@@ -3965,13 +3952,12 @@ void
 md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec ATTRIBUTE_UNUSED,
                  fragS *fragP)
 {
-  fixS *fixp;
   long value;
   long disp;
   char *buffer_address = fragP->fr_literal;
 
   /* Address in object code of the displacement.  */
-  register int object_address = fragP->fr_fix + fragP->fr_address;
+  int object_address = fragP->fr_fix + fragP->fr_address;
 
   buffer_address += fragP->fr_fix;
 
@@ -4018,10 +4004,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec ATTRIBUTE_UNUSED,
       fragP->fr_opcode[1] = fragP->fr_opcode[0];
       fragP->fr_opcode[0] = M6811_OPCODE_PAGE2;
 
-      fixp = fix_new (fragP, fragP->fr_fix, 2,
-                     fragP->fr_symbol, fragP->fr_offset, 1,
+      fix_new (fragP, fragP->fr_fix, 2,
+              fragP->fr_symbol, fragP->fr_offset, 1,
                      BFD_RELOC_16_PCREL);
-      fixp->fx_pcrel_adjust = 2;
       fragP->fr_fix += 2;
       break;
 
@@ -4060,9 +4045,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec ATTRIBUTE_UNUSED,
           && fragP->fr_symbol != 0
           && S_GET_SEGMENT (fragP->fr_symbol) != absolute_section)
        {
-         fixp = fix_new (fragP, fragP->fr_fix, 2,
-                         fragP->fr_symbol, fragP->fr_offset,
-                         1, BFD_RELOC_16_PCREL);
+         fix_new (fragP, fragP->fr_fix, 2,
+                  fragP->fr_symbol, fragP->fr_offset,
+                  1, BFD_RELOC_16_PCREL);
        }
       else
        {
@@ -4447,7 +4432,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
                      value);
       if (value >= 0)
        where[0] |= value;
-      else 
+      else
        where[0] |= (0x10 | (16 + value));
       break;
 
@@ -4459,7 +4444,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
         /* sign bit already in xb postbyte */
       if (value >= 0)
         where[1] = value;
-      else 
+      else
         where[1] = (256 + value);
       break;
 
@@ -4471,8 +4456,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
       if (value < 0)
         value += 65536;
 
-      where[1] = (value >> 8);
-      where[2] = (value & 0xff);
+      where[0] = (value >> 8);
+      where[1] = (value & 0xff);
       break;
 
     case BFD_RELOC_M68HC11_RL_JUMP:
This page took 0.032778 seconds and 4 git commands to generate.