[AArch64] use subseg_text_p to check .text
[binutils-gdb.git] / gas / config / tc-arc.c
index 17f67391a12d9c418f1a735dfda3f4ddf3e5c7de..df3ed1f0d22358ad89b87feb995e11a94cc95adc 100644 (file)
@@ -1,13 +1,12 @@
 /* tc-arc.c -- Assembler for the ARC
-   Copyright 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-   Free Software Foundation, Inc.
+   Copyright (C) 1994-2015 Free Software Foundation, Inc.
    Contributed by Doug Evans (dje@cygnus.com).
 
    This file is part of GAS, the GNU Assembler.
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    GAS is distributed in the hope that it will be useful,
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
-   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
-#include <stdio.h>
-#include "libiberty.h"
 #include "as.h"
 #include "struc-symbol.h"
 #include "safe-ctype.h"
@@ -49,7 +46,7 @@ const struct syntax_classes
 {
   char *name;
   int  len;
-  int  class;
+  int  s_class;
 } syntaxclass[] =
 {
   { "SYNTAX_3OP|OP1_MUST_BE_IMM", 26, SYNTAX_3OP|OP1_MUST_BE_IMM|SYNTAX_VALID },
@@ -193,7 +190,7 @@ md_begin (void)
   target_big_endian = byte_order == BIG_ENDIAN;
 
   if (!bfd_set_arch_mach (stdoutput, bfd_arch_arc, arc_mach_type))
-    as_warn ("could not set architecture and machine");
+    as_warn (_("could not set architecture and machine"));
 
   /* This call is necessary because we need to initialize `arc_operand_map'
      which may be needed before we see the first insn.  */
@@ -211,10 +208,10 @@ init_opcode_tables (int mach)
   char *last;
 
   if ((arc_suffix_hash = hash_new ()) == NULL)
-    as_fatal ("virtual memory exhausted");
+    as_fatal (_("virtual memory exhausted"));
 
   if (!bfd_set_arch_mach (stdoutput, bfd_arch_arc, mach))
-    as_warn ("could not set architecture and machine");
+    as_warn (_("could not set architecture and machine"));
 
   /* This initializes a few things in arc-opc.c that we need.
      This must be called before the various arc_xxx_supported fns.  */
@@ -246,7 +243,7 @@ init_opcode_tables (int mach)
         output registers into the object file's symbol table.  */
       symbol_table_insert (symbol_create (arc_reg_names[i].name,
                                          reg_section,
-                                         (int) &arc_reg_names[i],
+                                         (valueT) &arc_reg_names[i],
                                          &zero_address_frag));
     }
 
@@ -301,7 +298,7 @@ arc_insert_operand (arc_insn insn,
       errmsg = NULL;
       insn = (*operand->insert) (insn, operand, mods, reg, (long) val, &errmsg);
       if (errmsg != (const char *) NULL)
-       as_warn (errmsg);
+       as_warn ("%s", errmsg);
     }
   else
     insn |= (((long) val & ((1 << operand->bits) - 1))
@@ -431,7 +428,7 @@ arc_extoper (int opertype)
 
   if (*input_line_pointer != ',')
     {
-      as_bad ("expected comma after operand name");
+      as_bad (_("expected comma after operand name"));
       ignore_rest_of_line ();
       free (name);
       return;
@@ -442,7 +439,7 @@ arc_extoper (int opertype)
 
   if (number < 0)
     {
-      as_bad ("negative operand number %d", number);
+      as_bad (_("negative operand number %d"), number);
       ignore_rest_of_line ();
       free (name);
       return;
@@ -454,7 +451,7 @@ arc_extoper (int opertype)
 
       if (*input_line_pointer != ',')
        {
-         as_bad ("expected comma after register-number");
+         as_bad (_("expected comma after register-number"));
          ignore_rest_of_line ();
          free (name);
          return;
@@ -479,7 +476,7 @@ arc_extoper (int opertype)
            {
              if (strncmp (mode, "w", 1))
                {
-                 as_bad ("invalid mode");
+                 as_bad (_("invalid mode"));
                  ignore_rest_of_line ();
                  free (name);
                  return;
@@ -496,7 +493,7 @@ arc_extoper (int opertype)
        {
          if (*input_line_pointer != ',')
            {
-             as_bad ("expected comma after register-mode");
+             as_bad (_("expected comma after register-mode"));
              ignore_rest_of_line ();
              free (name);
              return;
@@ -513,7 +510,7 @@ arc_extoper (int opertype)
            {
              if (strncmp (input_line_pointer, "can_shortcut", 12))
                {
-                 as_bad ("shortcut designator invalid");
+                 as_bad (_("shortcut designator invalid"));
                  ignore_rest_of_line ();
                  free (name);
                  return;
@@ -528,7 +525,7 @@ arc_extoper (int opertype)
 
   if ((opertype == 1) && number > 60)
     {
-      as_bad ("core register value (%d) too large", number);
+      as_bad (_("core register value (%d) too large"), number);
       ignore_rest_of_line ();
       free (name);
       return;
@@ -536,13 +533,14 @@ arc_extoper (int opertype)
 
   if ((opertype == 0) && number > 31)
     {
-      as_bad ("condition code value (%d) too large", number);
+      as_bad (_("condition code value (%d) too large"), number);
       ignore_rest_of_line ();
       free (name);
       return;
     }
 
-  ext_oper = xmalloc (sizeof (struct arc_ext_operand_value));
+  ext_oper = (struct arc_ext_operand_value *)
+      xmalloc (sizeof (struct arc_ext_operand_value));
 
   if (opertype)
     {
@@ -550,10 +548,10 @@ arc_extoper (int opertype)
       if ((symbolP = symbol_find (name)))
        {
          if (S_GET_SEGMENT (symbolP) == reg_section)
-           S_SET_VALUE (symbolP, (int) &ext_oper->operand);
+           S_SET_VALUE (symbolP, (valueT) &ext_oper->operand);
          else
            {
-             as_bad ("attempt to override symbol: %s", name);
+             as_bad (_("attempt to override symbol: %s"), name);
              ignore_rest_of_line ();
              free (name);
              free (ext_oper);
@@ -564,7 +562,8 @@ arc_extoper (int opertype)
        {
          /* If its not there, add it.  */
          symbol_table_insert (symbol_create (name, reg_section,
-                                             (int) &ext_oper->operand, &zero_address_frag));
+                                             (valueT) &ext_oper->operand,
+                                             &zero_address_frag));
        }
     }
 
@@ -623,7 +622,7 @@ arc_extoper (int opertype)
       strcpy (p, name);
       break;
     default:
-      as_bad ("invalid opertype");
+      as_bad (_("invalid opertype"));
       ignore_rest_of_line ();
       free (name);
       return;
@@ -647,7 +646,7 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
   int suffixcode = -1;
   int opcode, subopcode;
   int i;
-  int class = 0;
+  int s_class = 0;
   int name_len;
   struct arc_opcode *ext_op;
 
@@ -668,7 +667,7 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
 
   if (*input_line_pointer != ',')
     {
-      as_bad ("expected comma after operand name");
+      as_bad (_("expected comma after operand name"));
       ignore_rest_of_line ();
       return;
     }
@@ -680,7 +679,7 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
 
   if (*input_line_pointer != ',')
     {
-      as_bad ("expected comma after opcode");
+      as_bad (_("expected comma after opcode"));
       ignore_rest_of_line ();
       return;
     }
@@ -690,7 +689,7 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
 
   if (subopcode < 0)
     {
-      as_bad ("negative subopcode %d", subopcode);
+      as_bad (_("negative subopcode %d"), subopcode);
       ignore_rest_of_line ();
       return;
     }
@@ -699,7 +698,7 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
     {
       if (3 != opcode)
        {
-         as_bad ("subcode value found when opcode not equal 0x03");
+         as_bad (_("subcode value found when opcode not equal 0x03"));
          ignore_rest_of_line ();
          return;
        }
@@ -707,7 +706,7 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
        {
          if (subopcode < 0x09 || subopcode == 0x3f)
            {
-             as_bad ("invalid subopcode %d", subopcode);
+             as_bad (_("invalid subopcode %d"), subopcode);
              ignore_rest_of_line ();
              return;
            }
@@ -718,7 +717,7 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
 
   if (*input_line_pointer != ',')
     {
-      as_bad ("expected comma after subopcode");
+      as_bad (_("expected comma after subopcode"));
       ignore_rest_of_line ();
       return;
     }
@@ -737,7 +736,7 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
 
   if (-1 == suffixcode)
     {
-      as_bad ("invalid suffix class");
+      as_bad (_("invalid suffix class"));
       ignore_rest_of_line ();
       return;
     }
@@ -746,7 +745,7 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
 
   if (*input_line_pointer != ',')
     {
-      as_bad ("expected comma after suffix class");
+      as_bad (_("expected comma after suffix class"));
       ignore_rest_of_line ();
       return;
     }
@@ -757,22 +756,22 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
     {
       if (!strncmp (syntaxclass[i].name,input_line_pointer, syntaxclass[i].len))
        {
-         class = syntaxclass[i].class;
+         s_class = syntaxclass[i].s_class;
          input_line_pointer += syntaxclass[i].len;
          break;
        }
     }
 
-  if (0 == (SYNTAX_VALID & class))
+  if (0 == (SYNTAX_VALID & s_class))
     {
-      as_bad ("invalid syntax class");
+      as_bad (_("invalid syntax class"));
       ignore_rest_of_line ();
       return;
     }
 
-  if ((0x3 == opcode) & (class & SYNTAX_3OP))
+  if ((0x3 == opcode) & (s_class & SYNTAX_3OP))
     {
-      as_bad ("opcode 0x3 and SYNTAX_3OP invalid");
+      as_bad (_("opcode 0x3 and SYNTAX_3OP invalid"));
       ignore_rest_of_line ();
       return;
     }
@@ -792,23 +791,23 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
       strcat (syntax, " ");
       break;
     default:
-      as_bad ("unknown suffix class");
+      as_bad (_("unknown suffix class"));
       ignore_rest_of_line ();
       return;
       break;
     };
 
-  strcat (syntax, ((opcode == 0x3) ? "%a,%b" : ((class & SYNTAX_3OP) ? "%a,%b,%c" : "%b,%c")));
+  strcat (syntax, ((opcode == 0x3) ? "%a,%b" : ((s_class & SYNTAX_3OP) ? "%a,%b,%c" : "%b,%c")));
   if (suffixcode < 2)
     strcat (syntax, "%F");
   strcat (syntax, "%S%L");
 
-  ext_op = xmalloc (sizeof (struct arc_opcode));
+  ext_op = (struct arc_opcode *) xmalloc (sizeof (struct arc_opcode));
   ext_op->syntax = xstrdup (syntax);
 
   ext_op->mask  = I (-1) | ((0x3 == opcode) ? C (-1) : 0);
   ext_op->value = I (opcode) | ((0x3 == opcode) ? C (subopcode) : 0);
-  ext_op->flags = class;
+  ext_op->flags = s_class;
   ext_op->next_asm = arc_ext_opcodes;
   ext_op->next_dis = arc_ext_opcodes;
   arc_ext_opcodes = ext_op;
@@ -830,7 +829,7 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
   p = frag_more (1);
   *p = subopcode;
   p = frag_more (1);
-  *p = (class & (OP1_MUST_BE_IMM | OP1_IMM_IMPLIED) ? IGNORE_FIRST_OPD : 0);
+  *p = (s_class & (OP1_MUST_BE_IMM | OP1_IMM_IMPLIED) ? IGNORE_FIRST_OPD : 0);
   p = frag_more (name_len);
   strncpy (p, syntax, name_len);
   p = frag_more (1);
@@ -859,7 +858,7 @@ arc_common (int localScope)
 
   if (*input_line_pointer != ',')
     {
-      as_bad ("expected comma after symbol name");
+      as_bad (_("expected comma after symbol name"));
       ignore_rest_of_line ();
       return;
     }
@@ -869,7 +868,7 @@ arc_common (int localScope)
 
   if (size < 0)
     {
-      as_bad ("negative symbol length");
+      as_bad (_("negative symbol length"));
       ignore_rest_of_line ();
       return;
     }
@@ -880,17 +879,17 @@ arc_common (int localScope)
 
   if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP))
     {
-      as_bad ("ignoring attempt to re-define symbol");
+      as_bad (_("ignoring attempt to re-define symbol"));
       ignore_rest_of_line ();
       return;
     }
   if (((int) S_GET_VALUE (symbolP) != 0) \
       && ((int) S_GET_VALUE (symbolP) != size))
     {
-      as_warn ("length of symbol \"%s\" already %ld, ignoring %d",
+      as_warn (_("length of symbol \"%s\" already %ld, ignoring %d"),
               S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size);
     }
-  assert (symbolP->sy_frag == &zero_address_frag);
+  gas_assert (symbolP->sy_frag == &zero_address_frag);
 
   /* Now parse the alignment field.  This field is optional for
      local and global symbols. Default alignment is zero.  */
@@ -901,7 +900,7 @@ arc_common (int localScope)
       if (align < 0)
        {
          align = 0;
-         as_warn ("assuming symbol alignment of zero");
+         as_warn (_("assuming symbol alignment of zero"));
        }
     }
   else
@@ -934,7 +933,7 @@ arc_common (int localScope)
       S_SET_SIZE       (symbolP, size);
       S_SET_SEGMENT    (symbolP, bss_section);
       S_CLEAR_EXTERNAL (symbolP);
-      symbolP->local = 1;
+      symbol_get_obj (symbolP)->local = 1;
       subseg_set (old_sec, old_subsec);
     }
   else
@@ -968,7 +967,7 @@ arc_option (int ignore ATTRIBUTE_UNUSED)
   /* If an instruction has already been seen, it's too late.  */
   if (cpu_tables_init_p)
     {
-      as_bad ("\".option\" directive must appear before any instructions");
+      as_bad (_("\".option\" directive must appear before any instructions"));
       ignore_rest_of_line ();
       return;
     }
@@ -978,7 +977,7 @@ arc_option (int ignore ATTRIBUTE_UNUSED)
 
   if (mach_type_specified_p && mach != arc_mach_type)
     {
-      as_bad ("\".option\" directive conflicts with initial definition");
+      as_bad (_("\".option\" directive conflicts with initial definition"));
       ignore_rest_of_line ();
       return;
     }
@@ -986,64 +985,24 @@ arc_option (int ignore ATTRIBUTE_UNUSED)
     {
       /* The cpu may have been selected on the command line.  */
       if (mach != arc_mach_type)
-       as_warn ("\".option\" directive overrides command-line (default) value");
+       as_warn (_("\".option\" directive overrides command-line (default) value"));
       arc_mach_type = mach;
       if (!bfd_set_arch_mach (stdoutput, bfd_arch_arc, mach))
-       as_fatal ("could not set architecture and machine");
+       as_fatal (_("could not set architecture and machine"));
       mach_type_specified_p = 1;
     }
   demand_empty_rest_of_line ();
   return;
 
  bad_cpu:
-  as_bad ("invalid identifier for \".option\"");
+  as_bad (_("invalid identifier for \".option\""));
   ignore_rest_of_line ();
 }
 \f
-/* Turn a string in input_line_pointer into a floating point constant
-   of type TYPE, and store the appropriate bytes in *LITP.  The number
-   of LITTLENUMS emitted is stored in *SIZEP.  An error message is
-   returned, or NULL on OK.  */
-
-/* Equal to MAX_PRECISION in atof-ieee.c  */
-#define MAX_LITTLENUMS 6
-
 char *
 md_atof (int type, char *litP, int *sizeP)
 {
-  int prec;
-  LITTLENUM_TYPE words[MAX_LITTLENUMS];
-  LITTLENUM_TYPE *wordP;
-  char *t;
-
-  switch (type)
-    {
-    case 'f':
-    case 'F':
-      prec = 2;
-      break;
-
-    case 'd':
-    case 'D':
-      prec = 4;
-      break;
-
-    default:
-      *sizeP = 0;
-      return "bad call to md_atof";
-    }
-
-  t = atof_ieee (input_line_pointer, type, words);
-  if (t)
-    input_line_pointer = t;
-  *sizeP = prec * sizeof (LITTLENUM_TYPE);
-  for (wordP = words; prec--;)
-    {
-      md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
-      litP += sizeof (LITTLENUM_TYPE);
-    }
-
-  return NULL;
+  return ieee_md_atof (type, litP, sizeP, TRUE);
 }
 
 /* Write a value out to the object file, using the appropriate
@@ -1074,7 +1033,7 @@ int
 md_estimate_size_before_relax (fragS *fragp ATTRIBUTE_UNUSED,
                               asection *seg ATTRIBUTE_UNUSED)
 {
-  as_fatal (_("md_estimate_size_before_relax\n"));
+  as_fatal (_("relaxation not supported\n"));
   return 1;
 }
 
@@ -1085,7 +1044,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
                 asection *sec ATTRIBUTE_UNUSED,
                 fragS *fragp ATTRIBUTE_UNUSED)
 {
-  as_fatal (_("md_convert_frag\n"));
+  abort ();
 }
 
 static void
@@ -1118,7 +1077,7 @@ arc_code_symbol (expressionS *expressionP)
       expressionP->X_op_symbol = make_expr_symbol (&two);
     }
   else
-    as_bad ("expression too complex code symbol");
+    as_bad (_("expression too complex code symbol"));
 }
 
 /* Parse an operand that is machine-specific.
@@ -1145,7 +1104,7 @@ md_operand (expressionS *expressionP)
       expression (expressionP);
       if (*input_line_pointer != ')')
        {
-         as_bad ("missing ')' in %%-op");
+         as_bad (_("missing ')' in %%-op"));
          return;
        }
       ++input_line_pointer;
@@ -1165,7 +1124,7 @@ md_operand (expressionS *expressionP)
            {
              input_line_pointer += l + 1;
              expressionP->X_op = O_register;
-             expressionP->X_add_number = (int) &ext_oper->operand;
+             expressionP->X_add_number = (offsetT) &ext_oper->operand;
              return;
            }
          ext_oper = ext_oper->next;
@@ -1177,7 +1136,7 @@ md_operand (expressionS *expressionP)
            {
              input_line_pointer += l + 1;
              expressionP->X_op = O_register;
-             expressionP->X_add_number = (int) &arc_reg_names[i];
+             expressionP->X_add_number = (offsetT) &arc_reg_names[i];
              break;
            }
        }
@@ -1201,7 +1160,7 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
    Values for the status register are specified with %st(label).
    `label' will be right shifted by 2.  */
 
-void
+bfd_reloc_code_real_type
 arc_parse_cons_expression (expressionS *exp,
                           unsigned int nbytes ATTRIBUTE_UNUSED)
 {
@@ -1214,12 +1173,13 @@ arc_parse_cons_expression (expressionS *exp,
        code_symbol_fix = 1;
        strcpy (p, ";   ");
       }
-  expr (0, exp);
+  expression_and_evaluate (exp);
   if (code_symbol_fix)
     {
       arc_code_symbol (exp);
       input_line_pointer = p;
     }
+  return BFD_RELOC_NONE;
 }
 
 /* Record a fixup for a cons expression.  */
@@ -1228,7 +1188,8 @@ void
 arc_cons_fix_new (fragS *frag,
                  int where,
                  int nbytes,
-                 expressionS *exp)
+                 expressionS *exp,
+                 bfd_reloc_code_real_type r ATTRIBUTE_UNUSED)
 {
   if (nbytes == 4)
     {
@@ -1237,7 +1198,8 @@ arc_cons_fix_new (fragS *frag,
 
       /* This may be a special ARC reloc (eg: %st()).  */
       reloc_type = get_arc_exp_reloc_type (1, BFD_RELOC_32, exp, &exptmp);
-      fix_new_exp (frag, where, nbytes, &exptmp, 0, reloc_type);
+      fix_new_exp (frag, where, nbytes, &exptmp, 0,
+                   (enum bfd_reloc_code_real) reloc_type);
     }
   else
     {
@@ -1269,7 +1231,7 @@ md_pcrel_from (fixS *fixP)
    that, we determine the correct reloc code and put it back in the fixup.  */
 
 void
-md_apply_fix3 (fixS *fixP, valueT * valP, segT seg)
+md_apply_fix (fixS *fixP, valueT * valP, segT seg)
 {
   valueT value = * valP;
 
@@ -1324,21 +1286,21 @@ md_apply_fix3 (fixS *fixP, valueT * valP, segT seg)
         limm values.  */
       if (operand->fmt == 'B')
        {
-         assert ((operand->flags & ARC_OPERAND_RELATIVE_BRANCH) != 0
+         gas_assert ((operand->flags & ARC_OPERAND_RELATIVE_BRANCH) != 0
                  && operand->bits == 20
                  && operand->shift == 7);
          fixP->fx_r_type = BFD_RELOC_ARC_B22_PCREL;
        }
       else if (operand->fmt == 'J')
        {
-         assert ((operand->flags & ARC_OPERAND_ABSOLUTE_BRANCH) != 0
+         gas_assert ((operand->flags & ARC_OPERAND_ABSOLUTE_BRANCH) != 0
                  && operand->bits == 24
                  && operand->shift == 32);
          fixP->fx_r_type = BFD_RELOC_ARC_B26;
        }
       else if (operand->fmt == 'L')
        {
-         assert ((operand->flags & ARC_OPERAND_LIMM) != 0
+         gas_assert ((operand->flags & ARC_OPERAND_LIMM) != 0
                  && operand->bits == 32
                  && operand->shift == 32);
          fixP->fx_r_type = BFD_RELOC_32;
@@ -1346,7 +1308,7 @@ md_apply_fix3 (fixS *fixP, valueT * valP, segT seg)
       else
        {
          as_bad_where (fixP->fx_file, fixP->fx_line,
-                       "unresolved expression that must be resolved");
+                       _("unresolved expression that must be resolved"));
          fixP->fx_done = 1;
          return;
        }
@@ -1391,8 +1353,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
 {
   arelent *reloc;
 
-  reloc = xmalloc (sizeof (arelent));
-  reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+  reloc = (arelent *) xmalloc (sizeof (arelent));
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
 
   *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
   reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
@@ -1400,13 +1362,13 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
   if (reloc->howto == (reloc_howto_type *) NULL)
     {
       as_bad_where (fixP->fx_file, fixP->fx_line,
-                   "internal error: can't export reloc type %d (`%s')",
+                   _("internal error: can't export reloc type %d (`%s')"),
                    fixP->fx_r_type,
                    bfd_get_reloc_code_name (fixP->fx_r_type));
       return NULL;
     }
 
-  assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
+  gas_assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
 
   /* Set addend to account for PC being advanced one insn before the
      target address is computed.  */
@@ -1532,7 +1494,7 @@ md_assemble (char *str)
            }
          operand = arc_operands + arc_operand_map[(int) *syn];
          if (operand->fmt == 0)
-           as_fatal ("unknown syntax format character `%c'", *syn);
+           as_fatal (_("unknown syntax format character `%c'"), *syn);
 
          if (operand->flags & ARC_OPERAND_FAKE)
            {
@@ -1545,11 +1507,11 @@ md_assemble (char *str)
                      last_errmsg = errmsg;
                      if (operand->flags & ARC_OPERAND_ERROR)
                        {
-                         as_bad (errmsg);
+                         as_bad ("%s", errmsg);
                          return;
                        }
                      else if (operand->flags & ARC_OPERAND_WARN)
-                       as_warn (errmsg);
+                       as_warn ("%s", errmsg);
                      break;
                    }
                  if (limm_reloc_p
@@ -1609,7 +1571,8 @@ md_assemble (char *str)
              if ((suf = get_ext_suffix (s)))
                ext_suffix_p = 1;
              else
-               suf = hash_find (arc_suffix_hash, s);
+               suf = (const struct arc_operand_value *)
+                    hash_find (arc_suffix_hash, s);
              if (!suf)
                {
                  /* This can happen in "blle foo" and we're currently using
@@ -1670,7 +1633,7 @@ md_assemble (char *str)
              else
                {
                  if (num_suffixes == MAX_SUFFIXES)
-                   as_bad ("too many suffixes");
+                   as_bad (_("too many suffixes"));
                  else
                    insn_suffixes[num_suffixes++] = suffix;
                }
@@ -1700,16 +1663,16 @@ md_assemble (char *str)
              input_line_pointer = hold;
 
              if (exp.X_op == O_illegal)
-               as_bad ("illegal operand");
+               as_bad (_("illegal operand"));
              else if (exp.X_op == O_absent)
-               as_bad ("missing operand");
+               as_bad (_("missing operand"));
              else if (exp.X_op == O_constant)
                value = exp.X_add_number;
              else if (exp.X_op == O_register)
                reg = (struct arc_operand_value *) exp.X_add_number;
 #define IS_REG_DEST_OPERAND(o) ((o) == 'a')
              else if (IS_REG_DEST_OPERAND (*syn))
-               as_bad ("symbol as destination register");
+               as_bad (_("symbol as destination register"));
              else
                {
                  if (!strncmp (str, "@h30", 4))
@@ -1719,7 +1682,7 @@ md_assemble (char *str)
                    }
                  /* We need to generate a fixup for this expression.  */
                  if (fc >= MAX_FIXUPS)
-                   as_fatal ("too many fixups");
+                   as_fatal (_("too many fixups"));
                  fixups[fc].exp = exp;
                  /* We don't support shimm relocs. break here to force
                     the assembler to output a limm.  */
@@ -1762,11 +1725,11 @@ md_assemble (char *str)
                      last_errmsg = errmsg;
                      if (operand->flags & ARC_OPERAND_ERROR)
                        {
-                         as_bad (errmsg);
+                         as_bad ("%s", errmsg);
                          return;
                        }
                      else if (operand->flags & ARC_OPERAND_WARN)
-                       as_warn (errmsg);
+                       as_warn ("%s", errmsg);
                      break;
                    }
                }
@@ -1794,7 +1757,7 @@ md_assemble (char *str)
            ++str;
 
          if (!is_end_of_line[(unsigned char) *str])
-           as_bad ("junk at end of line: `%s'", str);
+           as_bad (_("junk at end of line: `%s'"), str);
 
          /* Is there a limm value?  */
          limm_p = arc_opcode_limm_p (&limm);
@@ -1833,10 +1796,10 @@ md_assemble (char *str)
               be legal, but let's warn the user anyway.  Ditto for 8 byte
               jumps with delay slots.  */
            if (in_delay_slot_p && limm_p)
-             as_warn ("8 byte instruction in delay slot");
+             as_warn (_("8 byte instruction in delay slot"));
            if (delay_slot_type != ARC_DELAY_NONE
                && limm_p && arc_insn_not_jl (insn)) /* except for jl  addr */
-             as_warn ("8 byte jump instruction with delay slot");
+             as_warn (_("8 byte jump instruction with delay slot"));
            in_delay_slot_p = (delay_slot_type != ARC_DELAY_NONE) && !limm_p;
 
            /* Warn when a conditional branch immediately follows a set of
@@ -1844,7 +1807,7 @@ md_assemble (char *str)
               insn that sets the condition codes uses a limm.  */
            if (cond_branch_p && conditional != 0 /* 0 = "always" */
                && prev_insn_needs_cc_nop_p && arc_mach_type == bfd_mach_arc_5)
-             as_warn ("conditional branch follows set of flags");
+             as_warn (_("conditional branch follows set of flags"));
            prev_insn_needs_cc_nop_p =
              /* FIXME: ??? not required:
                 (delay_slot_type != ARC_DELAY_NONE) &&  */
@@ -1884,7 +1847,7 @@ md_assemble (char *str)
                 operands residing in the insn, but instead just use the
                 operand index.  This lets us easily handle fixups for any
                 operand type, although that is admittedly not a very exciting
-                feature.  We pick a BFD reloc type in md_apply_fix3.
+                feature.  We pick a BFD reloc type in md_apply_fix.
 
                 Limm values (4 byte immediate "constants") must be treated
                 normally because they're not part of the actual insn word
@@ -1928,7 +1891,7 @@ md_assemble (char *str)
     }
 
   if (NULL == last_errmsg)
-    as_bad ("bad instruction `%s'", start);
+    as_bad (_("bad instruction `%s'"), start);
   else
-    as_bad (last_errmsg);
+    as_bad ("%s", last_errmsg);
 }