* tc.h (struct relax_type, relax_typeS): Move from here..
[deliverable/binutils-gdb.git] / gas / config / tc-arc.c
index 67121b2ddb0896665900828f51be50c5b9b4d192..445ea483a116a324d1f95b873e55906ab602137c 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-arc.c -- Assembler for the ARC
-   Copyright 1994, 1995, 1997, 1999, 2000, 2001, 2002
+   Copyright 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
    Contributed by Doug Evans (dje@cygnus.com).
 
@@ -328,17 +328,7 @@ arc_insert_operand (insn, operand, mods, reg, val, file, line)
        test = val;
 
       if (test < (offsetT) min || test > (offsetT) max)
-       {
-         const char *err =
-           "operand out of range (%s not between %ld and %ld)";
-         char buf[100];
-
-         sprint_value (buf, test);
-         if (file == (char *) NULL)
-           as_warn (err, buf, min, max);
-         else
-           as_warn_where (file, line, err, buf, min, max);
-       }
+       as_warn_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line);
     }
 
   if (operand->insert)
@@ -905,11 +895,6 @@ arc_extoper (opertype)
   name = input_line_pointer;
   c = get_symbol_end ();
   name = xstrdup (name);
-  if (NULL == name)
-    {
-      ignore_rest_of_line ();
-      return;
-    }
 
   p = name;
   while (*p)
@@ -1153,11 +1138,6 @@ arc_extinst (ignore)
   name = input_line_pointer;
   c = get_symbol_end ();
   name = xstrdup (name);
-  if (NULL == name)
-    {
-      ignore_rest_of_line ();
-      return;
-    }
   strcpy (syntax, name);
   name_len = strlen (name);
 
@@ -1305,18 +1285,7 @@ arc_extinst (ignore)
   strcat (syntax, "%S%L");
 
   ext_op = (struct arc_opcode *) xmalloc (sizeof (struct arc_opcode));
-  if (NULL == ext_op)
-    {
-      ignore_rest_of_line ();
-      return;
-    }
-
   ext_op->syntax = xstrdup (syntax);
-  if (NULL == ext_op->syntax)
-    {
-      ignore_rest_of_line ();
-      return;
-    }
 
   ext_op->mask  = I (-1) | ((0x3 == opcode) ? C (-1) : 0);
   ext_op->value = I (opcode) | ((0x3 == opcode) ? C (subopcode) : 0);
@@ -1475,7 +1444,6 @@ arc_common (localScope)
   symbolP->bsym->flags |= BSF_OBJECT;
 
   demand_empty_rest_of_line ();
-  return;
 }
 \f
 /* Select the cpu we're assembling for.  */
@@ -1546,7 +1514,6 @@ md_atof (type, litP, sizeP)
   LITTLENUM_TYPE words[MAX_LITTLENUMS];
   LITTLENUM_TYPE *wordP;
   char *t;
-  char * atof_ieee PARAMS ((char *, int, LITTLENUM_TYPE *));
 
   switch (type)
     {
@@ -1678,50 +1645,52 @@ md_operand (expressionP)
 {
   char *p = input_line_pointer;
 
-  if (*p == '%')
-    if (strncmp (p, "%st(", 4) == 0)
-      {
-       input_line_pointer += 4;
-       expression (expressionP);
-       if (*input_line_pointer != ')')
-         {
-           as_bad ("missing ')' in %%-op");
-           return;
-         }
-       ++input_line_pointer;
-       arc_code_symbol (expressionP);
-      }
-    else
-      {
-       /* It could be a register.  */
-       int i, l;
-       struct arc_ext_operand_value *ext_oper = arc_ext_operands;
-       p++;
+  if (*p != '%')
+    return;
 
-       while (ext_oper)
-         {
-           l = strlen (ext_oper->operand.name);
-           if (!strncmp (p, ext_oper->operand.name, l) && !ISALNUM (*(p + l)))
-             {
-               input_line_pointer += l + 1;
-               expressionP->X_op = O_register;
-               expressionP->X_add_number = (int) &ext_oper->operand;
-               return;
-             }
-           ext_oper = ext_oper->next;
-         }
-       for (i = 0; i < arc_reg_names_count; i++)
-         {
-           l = strlen (arc_reg_names[i].name);
-           if (!strncmp (p, arc_reg_names[i].name, l) && !ISALNUM (*(p + l)))
-             {
-               input_line_pointer += l + 1;
-               expressionP->X_op = O_register;
-               expressionP->X_add_number = (int) &arc_reg_names[i];
-               break;
-             }
-         }
-      }
+  if (strncmp (p, "%st(", 4) == 0)
+    {
+      input_line_pointer += 4;
+      expression (expressionP);
+      if (*input_line_pointer != ')')
+       {
+         as_bad ("missing ')' in %%-op");
+         return;
+       }
+      ++input_line_pointer;
+      arc_code_symbol (expressionP);
+    }
+  else
+    {
+      /* It could be a register.  */
+      int i, l;
+      struct arc_ext_operand_value *ext_oper = arc_ext_operands;
+      p++;
+
+      while (ext_oper)
+       {
+         l = strlen (ext_oper->operand.name);
+         if (!strncmp (p, ext_oper->operand.name, l) && !ISALNUM (*(p + l)))
+           {
+             input_line_pointer += l + 1;
+             expressionP->X_op = O_register;
+             expressionP->X_add_number = (int) &ext_oper->operand;
+             return;
+           }
+         ext_oper = ext_oper->next;
+       }
+      for (i = 0; i < arc_reg_names_count; i++)
+       {
+         l = strlen (arc_reg_names[i].name);
+         if (!strncmp (p, arc_reg_names[i].name, l) && !ISALNUM (*(p + l)))
+           {
+             input_line_pointer += l + 1;
+             expressionP->X_op = O_register;
+             expressionP->X_add_number = (int) &arc_reg_names[i];
+             break;
+           }
+       }
+    }
 }
 
 /* We have no need to default values of symbols.
@@ -1833,7 +1802,7 @@ get_arc_exp_reloc_type (data_p, default_type, exp, expnew)
      expressionS *expnew;
 {
   /* If the expression is "symbol >> 2" we must change it to just "symbol",
-     as fix_new_exp can't handle it.  Similarily for (symbol - symbol) >> 2.
+     as fix_new_exp can't handle it.  Similarly for (symbol - symbol) >> 2.
      That's ok though.  What's really going on here is that we're using
      ">> 2" as a special syntax for specifying BFD_RELOC_ARC_B26.  */
 
@@ -1878,9 +1847,6 @@ md_apply_fix3 (fixP, valP, seg)
      valueT * valP;
      segT seg;
 {
-#if 0
-  char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
-#endif
   valueT value = * valP;
 
   if (fixP->fx_addsy == (symbolS *) NULL)
@@ -1979,12 +1945,6 @@ md_apply_fix3 (fixP, valP, seg)
          md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
                              value, 4);
          break;
-#if 0
-       case BFD_RELOC_64:
-         md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
-                             value, 8);
-         break;
-#endif
        case BFD_RELOC_ARC_B26:
          /* If !fixP->fx_done then `value' is an implicit addend.
             We must shift it right by 2 in this case as well because the
@@ -2011,8 +1971,9 @@ tc_gen_reloc (section, fixP)
   arelent *reloc;
 
   reloc = (arelent *) xmalloc (sizeof (arelent));
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
 
-  reloc->sym_ptr_ptr = &fixP->fx_addsy->bsym;
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
   reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
   reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
   if (reloc->howto == (reloc_howto_type *) NULL)
This page took 0.025589 seconds and 4 git commands to generate.