]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gas/config/tc-score.c
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gas / config / tc-score.c
index 822b9cfd5baecafcbd875631650dc625e06fb15b..b48fd7a5d8ad7cb1e64a6800a2585859a9dd5932 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-score.c -- Assembler for Score
-   Copyright 2006, 2007, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
+   Copyright (C) 2006-2021 Free Software Foundation, Inc.
    Contributed by:
    Brain.lin (brain.lin@sunplusct.com)
    Mei Ligang (ligang@sunnorth.com.cn)
@@ -61,7 +61,7 @@ static void s3_assemble (char *str);
 static void s3_operand (expressionS *);
 static void s3_begin (void);
 static void s3_number_to_chars (char *buf, valueT val, int n);
-static char *s3_atof (int type, char *litP, int *sizeP);
+static const char *s3_atof (int type, char *litP, int *sizeP);
 static void s3_frag_check (fragS * fragp ATTRIBUTE_UNUSED);
 static void s3_validate_fix (fixS *fixP);
 static int s3_force_relocation (struct fix *fixp);
@@ -300,7 +300,6 @@ size_t md_longopts_size = sizeof (md_longopts);
                              ? s3_INSN16_SIZE : (s3_GET_INSN_CLASS (type) == INSN_CLASS_48) \
                                              ? s3_INSN48_SIZE : s3_INSN_SIZE)
 
-#define s3_MAX_LITTLENUMS 6
 #define s3_INSN_NAME_LEN 16
 
 /* Relax will need some padding for alignment.  */
@@ -334,7 +333,7 @@ enum s3_insn_type_for_dependency
 
 struct s3_insn_to_dependency
 {
-  char *insn_name;
+  const char *insn_name;
   enum s3_insn_type_for_dependency type;
 };
 
@@ -351,13 +350,13 @@ struct s3_data_dependency
 
 static const struct s3_insn_to_dependency s3_insn_to_dependency_table[] =
 {
-  /* move spectial instruction.  */
+  /* move special instruction.  */
   {"mtcr",      s3_D_mtcr},
 };
 
 static const struct s3_data_dependency s3_data_dependency_table[] =
 {
-  /* Status regiser.  */
+  /* Status register.  */
   {s3_D_mtcr, "cr0", s3_D_all_insn, "", 5, 1, 0},
 };
 
@@ -460,7 +459,7 @@ struct s3_reg_map
 {
   const struct s3_reg_entry *names;
   int max_regno;
-  struct hash_control *htab;
+  htab_t htab;
   const char *expected;
 };
 
@@ -471,8 +470,8 @@ static struct s3_reg_map s3_all_reg_maps[] =
   {s3_score_crn_table, 31, NULL, N_("S+core co-processor register expected")},
 };
 
-static struct hash_control *s3_score_ops_hsh = NULL;
-static struct hash_control *s3_dependency_insn_hsh = NULL;
+static htab_t s3_score_ops_hsh = NULL;
+static htab_t s3_dependency_insn_hsh = NULL;
 
 
 struct s3_datafield_range
@@ -1028,7 +1027,7 @@ s3_end_of_line (char *str)
 }
 
 static int
-s3_score_reg_parse (char **ccp, struct hash_control *htab)
+s3_score_reg_parse (char **ccp, htab_t htab)
 {
   char *start = *ccp;
   char c;
@@ -1045,7 +1044,7 @@ s3_score_reg_parse (char **ccp, struct hash_control *htab)
     c = *p++;
 
   *--p = 0;
-  reg = (struct s3_reg_entry *) hash_find (htab, start);
+  reg = (struct s3_reg_entry *) str_hash_find (htab, start);
   *p = c;
 
   if (reg)
@@ -1071,7 +1070,7 @@ s3_reg_required_here (char **str, int shift, enum s3_score_reg_type reg_type)
         {
           if ((reg == 1) && (s3_nor1 == 1) && (s3_inst.bwarn == 0))
             {
-              as_warn (_("Using temp register(r1)"));
+              as_warn (_("Using temp register (r1)"));
               s3_inst.bwarn = 1;
             }
         }
@@ -2079,7 +2078,7 @@ s3_reglow_required_here (char **str, int shift)
 
   /* Restore the start point, we may have got a reg of the wrong class.  */
   *str = start;
-  sprintf (buff, _("low register(r0-r15)expected, not '%.100s'"), start);
+  sprintf (buff, _("low register (r0-r15) expected, not '%.100s'"), start);
   s3_inst.error = buff;
   return (int) s3_FAIL;
 }
@@ -2204,7 +2203,8 @@ s3_dependency_type_from_insn (char *insn_name)
   const struct s3_insn_to_dependency *tmp;
 
   strcpy (name, insn_name);
-  tmp = (const struct s3_insn_to_dependency *) hash_find (s3_dependency_insn_hsh, name);
+  tmp = (const struct s3_insn_to_dependency *)
+    str_hash_find (s3_dependency_insn_hsh, name);
 
   if (tmp)
     return tmp->type;
@@ -2344,7 +2344,7 @@ s3_handle_dependency (struct s3_score_it *theinst)
              if (remainder_bubbles <= 2)
                {
                  if (s3_warn_fix_data_dependency)
-                   as_warn (_("Fix data dependency: %s %s -- %s %s  (insert %d nop!/%d)"),
+                   as_warn (_("Fix data dependency: %s %s -- %s %s (insert %d nop!/%d)"),
                             s3_dependency_vector[i].name, s3_dependency_vector[i].reg,
                             s3_dependency_vector[0].name, s3_dependency_vector[0].reg,
                             remainder_bubbles, bubbles);
@@ -2363,7 +2363,7 @@ s3_handle_dependency (struct s3_score_it *theinst)
              else
                {
                  if (s3_warn_fix_data_dependency)
-                   as_warn (_("Fix data dependency: %s %s -- %s %s  (insert 1 pflush/%d)"),
+                   as_warn (_("Fix data dependency: %s %s -- %s %s (insert 1 pflush/%d)"),
                             s3_dependency_vector[i].name, s3_dependency_vector[i].reg,
                             s3_dependency_vector[0].name, s3_dependency_vector[0].reg,
                             bubbles);
@@ -2379,14 +2379,14 @@ s3_handle_dependency (struct s3_score_it *theinst)
             {
              if (warn_or_error)
                {
-                  as_bad (_("data dependency: %s %s -- %s %s  (%d/%d bubble)"),
+                  as_bad (_("data dependency: %s %s -- %s %s (%d/%d bubble)"),
                          s3_dependency_vector[i].name, s3_dependency_vector[i].reg,
                          s3_dependency_vector[0].name, s3_dependency_vector[0].reg,
                          remainder_bubbles, bubbles);
                }
              else
                {
-                  as_warn (_("data dependency: %s %s -- %s %s  (%d/%d bubble)"),
+                  as_warn (_("data dependency: %s %s -- %s %s (%d/%d bubble)"),
                            s3_dependency_vector[i].name, s3_dependency_vector[i].reg,
                            s3_dependency_vector[0].name, s3_dependency_vector[0].reg,
                            remainder_bubbles, bubbles);
@@ -2595,7 +2595,7 @@ s3_gen_insn_frag (struct s3_score_it *part_1, struct s3_score_it *part_2)
   /* Here, we must call frag_grow in order to keep the instruction frag type is
      rs_machine_dependent.
      For, frag_var may change frag_now->fr_type to rs_fill by calling frag_grow which
-     acturally will call frag_wane.
+     actually will call frag_wane.
      Calling frag_grow first will create a new frag_now which free size is 20 that is enough
      for frag_var.  */
   frag_grow (20);
@@ -2663,7 +2663,8 @@ s3_parse_16_32_inst (char *insnstr, bfd_boolean gen_frag_p)
   c = *p;
   *p = '\0';
 
-  opcode = (const struct s3_asm_opcode *) hash_find (s3_score_ops_hsh, operator);
+  opcode = (const struct s3_asm_opcode *) str_hash_find (s3_score_ops_hsh,
+                                                        operator);
   *p = c;
 
   memset (&s3_inst, '\0', sizeof (s3_inst));
@@ -2709,7 +2710,8 @@ s3_parse_48_inst (char *insnstr, bfd_boolean gen_frag_p)
   c = *p;
   *p = '\0';
 
-  opcode = (const struct s3_asm_opcode *) hash_find (s3_score_ops_hsh, operator);
+  opcode = (const struct s3_asm_opcode *) str_hash_find (s3_score_ops_hsh,
+                                                        operator);
   *p = c;
 
   memset (&s3_inst, '\0', sizeof (s3_inst));
@@ -3775,7 +3777,7 @@ s3_do16_rpush (char *str)
     return;
 
   /* 0: indicate 32.
-     1: invalide value.
+     1: invalid value.
      2: to 31: normal value.  */
   val = s3_inst.instruction & 0x1f;
   if (val == 1)
@@ -3803,7 +3805,7 @@ s3_do16_rpop (char *str)
     return;
 
   /* 0: indicate 32.
-     1: invalide value.
+     1: invalid value.
      2: to 31: normal value.  */
   val = s3_inst.instruction & 0x1f;
   if (val == 1)
@@ -4096,7 +4098,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
       /* Fix part
          For an external symbol: lw rD, <sym>($gp)
         (BFD_RELOC_SCORE_GOT15 or BFD_RELOC_SCORE_CALL15)  */
-      sprintf (tmp, "lw_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+      sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
       if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
        return;
 
@@ -4110,7 +4112,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
         addi rD, <sym>       (BFD_RELOC_GOT_LO16) */
       s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
       memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
-      sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+      sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
       if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
        return;
 
@@ -4120,7 +4122,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
   else if (add_number >= -0x8000 && add_number <= 0x7fff)
     {
       /* Insn 1: lw rD, <sym>($gp)    (BFD_RELOC_SCORE_GOT15)  */
-      sprintf (tmp, "lw_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+      sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
       if (s3_append_insn (tmp, TRUE) == (int) s3_FAIL)
        return;
 
@@ -4137,7 +4139,8 @@ s3_build_la_pic (int reg_rd, expressionS exp)
 
       /* Var part
         For a local symbol: addi rD, <sym>+<constant>    (BFD_RELOC_GOT_LO16)  */
-      sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd, add_symbol->bsym->name, (int)add_number);
+      sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd,
+              S_GET_NAME (add_symbol), (int) add_number);
       if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
        return;
 
@@ -4150,7 +4153,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
       int lo = add_number & 0x0000FFFF;
 
       /* Insn 1: lw rD, <sym>($gp)    (BFD_RELOC_SCORE_GOT15)  */
-      sprintf (tmp, "lw_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+      sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
       if (s3_append_insn (tmp, TRUE) == (int) s3_FAIL)
        return;
 
@@ -4167,7 +4170,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
 
       /* Var part
         For a local symbol: ldis r1, HI%<constant>
-         but, if lo is outof 16 bit, make hi plus 1  */
+         but, if lo is out of 16 bit, make hi plus 1  */
       if ((lo < -0x8000) || (lo > 0x7fff))
        {
          hi += 1;
@@ -4192,7 +4195,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
 
       /* Var part
         For a local symbol: addi r1, <sym>+LO%<constant>    (BFD_RELOC_GOT_LO16)  */
-      sprintf (tmp, "addi_u_pic r1, %s + %d", add_symbol->bsym->name, lo);
+      sprintf (tmp, "addi_u_pic r1, %s + %d", S_GET_NAME (add_symbol), lo);
       if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
        return;
 
@@ -4485,9 +4488,9 @@ static void
 s3_do_macro_bcmp (char *str)
 {
   int reg_a , reg_b;
-  char keep_data[s3_MAX_LITERAL_POOL_SIZE];
-  char* ptemp;
-  int i = 0;
+  char *keep_data;
+  size_t keep_data_size;
+  int i;
   struct s3_score_it inst_expand[2];
   struct s3_score_it inst_main;
 
@@ -4498,26 +4501,23 @@ s3_do_macro_bcmp (char *str)
       ||(reg_b = s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
       || s3_skip_past_comma (&str) == (int) s3_FAIL)
     return;
-  ptemp = str;
-  while (*ptemp != 0)
-    {
-      keep_data[i] = *ptemp;
-      i++;
-      ptemp++;
-    }
-  keep_data[i] = 0;
+
+  keep_data_size = strlen (str) + 1;
+  keep_data = xmalloc (keep_data_size * 2 + 14);
+  memcpy (keep_data, str, keep_data_size);
+
   if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
       ||reg_b == 0
       || s3_end_of_line (str) == (int) s3_FAIL)
-    return;
+    goto out;
   else if (s3_inst.reloc.exp.X_add_symbol == 0)
     {
       s3_inst.error = _("lacking label  ");
-      return;
+      goto out;
     }
   else
     {
-      char append_str[s3_MAX_LITERAL_POOL_SIZE];
+      char *append_str = keep_data + keep_data_size;
       s3_SET_INSN_ERROR (NULL);
 
       s3_inst.reloc.type = BFD_RELOC_SCORE_BCMP;
@@ -4536,15 +4536,16 @@ s3_do_macro_bcmp (char *str)
           /* support bcmp --> cmp!+beq (bne) */
           if (s3_score_pic == s3_NO_PIC)
             {
-              sprintf (&append_str[0], "cmp! r%d, r%d", reg_a, reg_b);
-              if (s3_append_insn (&append_str[0], TRUE) == (int) s3_FAIL)
-                return;
-              if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
-                sprintf (&append_str[1], "beq %s", keep_data);
-              else
-                sprintf (&append_str[1], "bne %s", keep_data);
-              if (s3_append_insn (&append_str[1], TRUE) == (int) s3_FAIL)
-                return;
+             sprintf (append_str, "cmp! r%d, r%d", reg_a, reg_b);
+             if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
+               goto out;
+             if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
+               memcpy (append_str, "beq ", 4);
+             else
+               memcpy (append_str, "bne ", 4);
+             memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
+             if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
+               goto out;
            }
          else
            {
@@ -4552,7 +4553,7 @@ s3_do_macro_bcmp (char *str)
            }
          /* Set bwarn as -1, so macro instruction itself will not be generated frag.  */
          s3_inst.bwarn = -1;
-         return;
+         goto out;
         }
       else
         {
@@ -4567,18 +4568,19 @@ s3_do_macro_bcmp (char *str)
 
       if (s3_score_pic == s3_NO_PIC)
         {
-          sprintf (&append_str[0], "cmp! r%d, r%d", reg_a, reg_b);
-          if (s3_append_insn (&append_str[0], FALSE) == (int) s3_FAIL)
-            return;
-          memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it));
+         sprintf (append_str, "cmp! r%d, r%d", reg_a, reg_b);
+         if (s3_append_insn (append_str, FALSE) == (int) s3_FAIL)
+           goto out;
+         memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it));
 
-          if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
-            sprintf (&append_str[1], "beq %s", keep_data);
-          else
-            sprintf (&append_str[1], "bne %s", keep_data);
-          if (s3_append_insn (&append_str[1], FALSE) == (int) s3_FAIL)
-            return;
-          memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it));
+         if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
+           memcpy (append_str, "beq ", 4);
+         else
+           memcpy (append_str, "bne ", 4);
+         memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
+         if (s3_append_insn (append_str, FALSE) == (int) s3_FAIL)
+           goto out;
+         memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it));
         }
       else
         {
@@ -4634,6 +4636,8 @@ s3_do_macro_bcmp (char *str)
       /* Set bwarn as -1, so macro instruction itself will not be generated frag.  */
       s3_inst.bwarn = -1;
     }
+ out:
+  free (keep_data);
 }
 
 /* Handle bcmpeqz / bcmpnez  */
@@ -4641,9 +4645,9 @@ static void
 s3_do_macro_bcmpz (char *str)
 {
   int reg_a;
-  char keep_data[s3_MAX_LITERAL_POOL_SIZE];
-  char* ptemp;
-  int i = 0;
+  char *keep_data;
+  size_t keep_data_size;
+  int i;
   struct s3_score_it inst_expand[2];
   struct s3_score_it inst_main;
 
@@ -4652,27 +4656,22 @@ s3_do_macro_bcmpz (char *str)
   if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
       || s3_skip_past_comma (&str) == (int) s3_FAIL)
     return;
-  ptemp = str;
-  while (*ptemp != 0)
-    {
-      keep_data[i] = *ptemp;
-      i++;
-      ptemp++;
-    }
 
-  keep_data[i] = 0;
+  keep_data_size = strlen (str) + 1;
+  keep_data = xmalloc (keep_data_size * 2 + 13);
+  memcpy (keep_data, str, keep_data_size);
 
   if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
       || s3_end_of_line (str) == (int) s3_FAIL)
-    return;
+    goto out;
   else if (s3_inst.reloc.exp.X_add_symbol == 0)
     {
       s3_inst.error = _("lacking label  ");
-      return;
+      goto out;
     }
   else
     {
-      char append_str[s3_MAX_LITERAL_POOL_SIZE];
+      char *append_str = keep_data + keep_data_size;
       s3_SET_INSN_ERROR (NULL);
       s3_inst.reloc.type = BFD_RELOC_SCORE_BCMP;
       s3_inst.reloc.pc_rel = 1;
@@ -4687,15 +4686,16 @@ s3_do_macro_bcmpz (char *str)
         {
           if (s3_score_pic == s3_NO_PIC)
             {
-              sprintf (&append_str[0], "cmpi! r%d,0", reg_a);
-              if (s3_append_insn (&append_str[0], TRUE) == (int) s3_FAIL)
-                return;
-              if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
-                sprintf (&append_str[1], "beq %s", keep_data);
-              else
-                sprintf (&append_str[1], "bne %s", keep_data);
-              if (s3_append_insn (&append_str[1], TRUE) == (int) s3_FAIL)
-                return;
+             sprintf (append_str, "cmpi! r%d, 0", reg_a);
+             if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
+               goto out;
+             if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
+               memcpy (append_str, "beq ", 4);
+             else
+               memcpy (append_str, "bne ", 4);
+             memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
+             if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
+               goto out;
             }
           else
             {
@@ -4703,7 +4703,7 @@ s3_do_macro_bcmpz (char *str)
             }
           /* Set bwarn as -1, so macro instruction itself will not be generated frag.  */
           s3_inst.bwarn = -1;
-          return;
+         goto out;
         }
       else
         {
@@ -4718,17 +4718,18 @@ s3_do_macro_bcmpz (char *str)
 
       if (s3_score_pic == s3_NO_PIC)
         {
-          sprintf (&append_str[0], "cmpi! r%d, 0", reg_a);
-          if (s3_append_insn (&append_str[0], FALSE) == (int) s3_FAIL)
-            return;
-          memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it));
-          if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
-            sprintf (&append_str[1], "beq %s", keep_data);
-          else
-            sprintf (&append_str[1], "bne %s", keep_data);
-          if (s3_append_insn (&append_str[1], FALSE) == (int) s3_FAIL)
-            return;
-          memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it));
+         sprintf (append_str, "cmpi! r%d, 0", reg_a);
+         if (s3_append_insn (append_str, FALSE) == (int) s3_FAIL)
+           goto out;
+         memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it));
+         if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
+           memcpy (append_str, "beq ", 4);
+         else
+           memcpy (append_str, "bne ", 4);
+         memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
+         if (s3_append_insn (append_str, FALSE) == (int) s3_FAIL)
+           goto out;
+         memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it));
         }
       else
         {
@@ -4784,6 +4785,8 @@ s3_do_macro_bcmpz (char *str)
       /* Set bwarn as -1, so macro instruction itself will not be generated frag.  */
       s3_inst.bwarn = -1;
     }
+ out:
+  free (keep_data);
 }
 
 static int
@@ -4864,7 +4867,7 @@ s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
       /* Fix part
          For an external symbol: lw rD, <sym>($gp)
         (BFD_RELOC_SCORE_GOT15)  */
-      sprintf (tmp, "lw_pic r1, %s", add_symbol->bsym->name);
+      sprintf (tmp, "lw_pic r1, %s", S_GET_NAME (add_symbol));
       if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
         return;
 
@@ -4876,7 +4879,7 @@ s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
         addi rD, <sym>       (BFD_RELOC_GOT_LO16) */
       s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
       memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
-      sprintf (tmp, "addi_s_pic r1, %s", add_symbol->bsym->name);
+      sprintf (tmp, "addi_s_pic r1, %s", S_GET_NAME (add_symbol));
       if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
         return;
 
@@ -5228,7 +5231,7 @@ s3_do_branch (char *str)
   else if (!(s3_inst.reloc.exp.X_add_number >= -524288
             && s3_inst.reloc.exp.X_add_number <= 524287))
     {
-      s3_inst.error = _("invalid constant: 20 bit expression not in range -2^19..2^19");
+      s3_inst.error = _("invalid constant: 20 bit expression not in range -2^19..2^19-1");
       return;
     }
 
@@ -5304,7 +5307,7 @@ s3_pic_need_relax (symbolS *sym, asection *segtype)
   linkonce = FALSE;
   if (symsec != segtype && ! S_IS_LOCAL (sym))
     {
-      if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE) != 0)
+      if ((bfd_section_flags (symsec) & SEC_LINK_ONCE) != 0)
        linkonce = TRUE;
 
       /* The GNU toolchain uses an extension for ELF: a section
@@ -5362,8 +5365,8 @@ s3_parse_pce_inst (char *insnstr)
         || ((pec_part_1.size == s3_INSN_SIZE) && (s3_inst.size == s3_INSN16_SIZE))
         || ((pec_part_1.size == s3_INSN16_SIZE) && (s3_inst.size == s3_INSN_SIZE)))
     {
-      s3_inst.error = _("pce instruction error (16 bit || 16 bit)'");
-      sprintf (s3_inst.str, insnstr);
+      s3_inst.error = _("pce instruction error (16 bit || 16 bit).");
+      sprintf (s3_inst.str, "%s", insnstr);
       return;
     }
 
@@ -5550,7 +5553,7 @@ static void
 s3_score_s_section (int ignore)
 {
   obj_elf_section (ignore);
-  if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
+  if ((bfd_section_flags (now_seg) & SEC_CODE) != 0)
     record_alignment (now_seg, 2);
 
 }
@@ -5573,14 +5576,16 @@ s3_s_change_sec (int sec)
     {
     case 'r':
       seg = subseg_new (s3_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ());
-      bfd_set_section_flags (stdoutput, seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA));
+      bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY
+                                  | SEC_RELOC | SEC_DATA));
       if (strcmp (TARGET_OS, "elf") != 0)
         record_alignment (seg, 4);
       demand_empty_rest_of_line ();
       break;
     case 's':
       seg = subseg_new (".sdata", (subsegT) get_absolute_expression ());
-      bfd_set_section_flags (stdoutput, seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA);
+      bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_RELOC
+                                  | SEC_DATA | SEC_SMALL_DATA));
       if (strcmp (TARGET_OS, "elf") != 0)
         record_alignment (seg, 4);
       demand_empty_rest_of_line ();
@@ -5619,10 +5624,9 @@ s3_get_symbol (void)
   char *name;
   symbolS *p;
 
-  name = input_line_pointer;
-  c = get_symbol_end ();
+  c = get_symbol_name (&name);
   p = (symbolS *) symbol_find_or_make (name);
-  *input_line_pointer = c;
+  (void) restore_line_pointer (c);
   return p;
 }
 
@@ -5690,17 +5694,10 @@ s3_s_score_ent (int aent)
   if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-')
     s3_get_number ();
 
-#ifdef BFD_ASSEMBLER
-  if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
+  if ((bfd_section_flags (now_seg) & SEC_CODE) != 0)
     maybe_text = 1;
   else
     maybe_text = 0;
-#else
-  if (now_seg != data_section && now_seg != bss_section)
-    maybe_text = 1;
-  else
-    maybe_text = 0;
-#endif
   if (!maybe_text)
     as_warn (_(".ent or .aent not in text section."));
   if (!aent && s3_cur_proc_ptr)
@@ -5799,17 +5796,10 @@ s3_s_score_end (int x ATTRIBUTE_UNUSED)
   else
     p = NULL;
 
-#ifdef BFD_ASSEMBLER
-  if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
-    maybe_text = 1;
-  else
-    maybe_text = 0;
-#else
-  if (now_seg != data_section && now_seg != bss_section)
+  if ((bfd_section_flags (now_seg) & SEC_CODE) != 0)
     maybe_text = 1;
   else
     maybe_text = 0;
-#endif
 
   if (!maybe_text)
     as_warn (_(".end not in text section"));
@@ -6095,10 +6085,9 @@ s3_s_score_lcomm (int bytes_p)
   segT bss_seg = bss_section;
   int needs_align = 0;
 
-  name = input_line_pointer;
-  c = get_symbol_end ();
+  c = get_symbol_name (&name);
   p = input_line_pointer;
-  *p = c;
+  (void) restore_line_pointer (c);
 
   if (name == p)
     {
@@ -6134,15 +6123,14 @@ s3_s_score_lcomm (int bytes_p)
   if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour || OUTPUT_FLAVOR == bfd_target_elf_flavour)
     {
       /* For Score and Alpha ECOFF or ELF, small objects are put in .sbss.  */
-      if ((unsigned)temp <= bfd_get_gp_size (stdoutput))
-        {
-          bss_seg = subseg_new (".sbss", 1);
-          seg_info (bss_seg)->bss = 1;
-#ifdef BFD_ASSEMBLER
-          if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC))
-            as_warn (_("error setting flags for \".sbss\": %s"), bfd_errmsg (bfd_get_error ()));
-#endif
-        }
+      if ((unsigned) temp <= bfd_get_gp_size (stdoutput))
+       {
+         bss_seg = subseg_new (".sbss", 1);
+         seg_info (bss_seg)->bss = 1;
+         if (!bfd_set_section_flags (bss_seg, SEC_ALLOC | SEC_SMALL_DATA))
+           as_warn (_("error setting flags for \".sbss\": %s"),
+                    bfd_errmsg (bfd_get_error ()));
+       }
     }
 #endif
 
@@ -6219,14 +6207,9 @@ s3_s_score_lcomm (int bytes_p)
   *p = c;
 
   if (
-#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT)    \
-     || defined (OBJ_BOUT) || defined (OBJ_MAYBE_BOUT))
-#ifdef BFD_ASSEMBLER
+#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
       (OUTPUT_FLAVOR != bfd_target_aout_flavour
        || (S_GET_OTHER (symbolP) == 0 && S_GET_DESC (symbolP) == 0)) &&
-#else
-      (S_GET_OTHER (symbolP) == 0 && S_GET_DESC (symbolP) == 0) &&
-#endif
 #endif
       (S_GET_SEGMENT (symbolP) == bss_seg || (!S_IS_DEFINED (symbolP) && S_GET_VALUE (symbolP) == 0)))
     {
@@ -6271,12 +6254,12 @@ s3_s_score_lcomm (int bytes_p)
 }
 
 static void
-s3_insert_reg (const struct s3_reg_entry *r, struct hash_control *htab)
+s3_insert_reg (const struct s3_reg_entry *r, htab_t htab)
 {
   int i = 0;
   int len = strlen (r->name) + 2;
-  char *buf = xmalloc (len);
-  char *buf2 = xmalloc (len);
+  char *buf = XNEWVEC (char, len);
+  char *buf2 = XNEWVEC (char, len);
 
   strcpy (buf + i, r->name);
   for (i = 0; buf[i]; i++)
@@ -6285,8 +6268,8 @@ s3_insert_reg (const struct s3_reg_entry *r, struct hash_control *htab)
     }
   buf2[i] = '\0';
 
-  hash_insert (htab, buf, (void *) r);
-  hash_insert (htab, buf2, (void *) r);
+  str_hash_insert (htab, buf, r, 0);
+  str_hash_insert (htab, buf2, r, 0);
 }
 
 static void
@@ -6294,14 +6277,9 @@ s3_build_reg_hsh (struct s3_reg_map *map)
 {
   const struct s3_reg_entry *r;
 
-  if ((map->htab = hash_new ()) == NULL)
-    {
-      as_fatal (_("virtual memory exhausted"));
-    }
+  map->htab = str_htab_create ();
   for (r = map->names; r->name != NULL; r++)
-    {
-      s3_insert_reg (r, map->htab);
-    }
+    s3_insert_reg (r, map->htab);
 }
 
 /* Iterate over the base tables to create the instruction patterns.  */
@@ -6315,7 +6293,7 @@ s3_build_score_ops_hsh (void)
   for (i = 0; i < sizeof (s3_score_insns) / sizeof (struct s3_asm_opcode); i++)
     {
       const struct s3_asm_opcode *insn = s3_score_insns + i;
-      unsigned len = strlen (insn->template_name);
+      size_t len = strlen (insn->template_name);
       struct s3_asm_opcode *new_opcode;
       char *template_name;
       new_opcode = (struct s3_asm_opcode *)
@@ -6329,8 +6307,8 @@ s3_build_score_ops_hsh (void)
       new_opcode->relax_value = insn->relax_value;
       new_opcode->type = insn->type;
       new_opcode->bitmask = insn->bitmask;
-      hash_insert (s3_score_ops_hsh, new_opcode->template_name,
-                   (void *) new_opcode);
+      str_hash_insert (s3_score_ops_hsh, new_opcode->template_name,
+                      new_opcode, 0);
     }
 }
 
@@ -6344,19 +6322,19 @@ s3_build_dependency_insn_hsh (void)
   for (i = 0; i < sizeof (s3_insn_to_dependency_table) / sizeof (s3_insn_to_dependency_table[0]); i++)
     {
       const struct s3_insn_to_dependency *tmp = s3_insn_to_dependency_table + i;
-      unsigned len = strlen (tmp->insn_name);
+      size_t len = strlen (tmp->insn_name);
       struct s3_insn_to_dependency *new_i2n;
+      char *buf;
 
       new_i2n = (struct s3_insn_to_dependency *)
        obstack_alloc (&dependency_obstack,
                       sizeof (struct s3_insn_to_dependency));
-      new_i2n->insn_name = (char *) obstack_alloc (&dependency_obstack,
-                                                   len + 1);
+      buf = (char *) obstack_alloc (&dependency_obstack, len + 1);
 
-      strcpy (new_i2n->insn_name, tmp->insn_name);
+      strcpy (buf, tmp->insn_name);
+      new_i2n->insn_name = buf;
       new_i2n->type = tmp->type;
-      hash_insert (s3_dependency_insn_hsh, new_i2n->insn_name,
-                   (void *) new_i2n);
+      str_hash_insert (s3_dependency_insn_hsh, new_i2n->insn_name, new_i2n, 0);
     }
 }
 
@@ -6524,13 +6502,11 @@ s3_begin (void)
   segT seg;
   subsegT subseg;
 
-  if ((s3_score_ops_hsh = hash_new ()) == NULL)
-    as_fatal (_("virtual memory exhausted"));
+  s3_score_ops_hsh = str_htab_create ();
 
   s3_build_score_ops_hsh ();
 
-  if ((s3_dependency_insn_hsh = hash_new ()) == NULL)
-    as_fatal (_("virtual memory exhausted"));
+  s3_dependency_insn_hsh = str_htab_create ();
 
   s3_build_dependency_insn_hsh ();
 
@@ -6544,8 +6520,8 @@ s3_begin (void)
   seg = now_seg;
   subseg = now_subseg;
   s3_pdr_seg = subseg_new (".pdr", (subsegT) 0);
-  (void)bfd_set_section_flags (stdoutput, s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
-  (void)bfd_set_section_alignment (stdoutput, s3_pdr_seg, 2);
+  bfd_set_section_flags (s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
+  bfd_set_section_alignment (s3_pdr_seg, 2);
   subseg_set (seg, subseg);
 
   if (s3_USE_GLOBAL_POINTER_OPT)
@@ -6658,11 +6634,11 @@ s3_md_chars_to_number (char *buf, int n)
   return result;
 }
 
-static char *
+static const char *
 s3_atof (int type, char *litP, int *sizeP)
 {
   int prec;
-  LITTLENUM_TYPE words[s3_MAX_LITTLENUMS];
+  LITTLENUM_TYPE words[MAX_LITTLENUMS];
   char *t;
   int i;
 
@@ -6807,7 +6783,7 @@ s3_judge_size_before_relax (fragS * fragp, asection *sec)
   if (change == 1)
     {
       /* Only at the first time determining whether s3_GP instruction relax should be done,
-         return the difference between insntruction size and instruction relax size.  */
+         return the difference between instruction size and instruction relax size.  */
       if (fragp->fr_opcode == NULL)
        {
          fragp->fr_fix = s3_RELAX_NEW (fragp->fr_subtype);
@@ -6853,10 +6829,7 @@ s3_relax_branch_inst16 (fragS * fragp)
   if (s == NULL)
     frag_addr = 0;
   else
-    {
-      if (s->bsym != 0)
-        symbol_address = (addressT) s->sy_frag->fr_address;
-    }
+    symbol_address = (addressT) symbol_get_frag (s)->fr_address;
 
   inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN16_SIZE);
   offset = (inst_value & 0x1ff) << 1;
@@ -6868,7 +6841,6 @@ s3_relax_branch_inst16 (fragS * fragp)
   if (relaxable_p
       && (!((value & 0xfffffe00) == 0 || (value & 0xfffffe00) == 0xfffffe00))
       && fragp->fr_fix == 2
-      && (s->bsym != NULL)
       && (S_IS_DEFINED (s)
           && !S_IS_COMMON (s)
           && !S_IS_EXTERNAL (s)))
@@ -6900,10 +6872,7 @@ s3_relax_cmpbranch_inst32 (fragS * fragp)
   if (s == NULL)
     frag_addr = 0;
   else
-    {
-      if (s->bsym != 0)
-        symbol_address = (addressT) s->sy_frag->fr_address;
-    }
+    symbol_address = (addressT) symbol_get_frag (s)->fr_address;
 
   inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN_SIZE);
   offset = (inst_value & 0x1)
@@ -6915,7 +6884,7 @@ s3_relax_cmpbranch_inst32 (fragS * fragp)
 
   value = offset + symbol_address - frag_addr;
   /* change the order of judging rule is because
-     1.not defined symbol or common sysbol or external symbol will change
+     1.not defined symbol or common symbol or external symbol will change
      bcmp to cmp!+beq/bne ,here need to record fragp->fr_opcode
      2.if the flow is as before : it will results to recursive loop
   */
@@ -6924,11 +6893,10 @@ s3_relax_cmpbranch_inst32 (fragS * fragp)
       /* Have already relaxed!  Just return 0 to terminate the loop.  */
       return 0;
     }
-  /* need to translate when extern or not defind or common sysbol */
+  /* need to translate when extern or not defined or common symbol */
   else if ((relaxable_p
            && (!((value & 0xfffffe00) == 0 || (value & 0xfffffe00) == 0xfffffe00))
-           && fragp->fr_fix == 4
-           && (s->bsym != NULL))
+           && fragp->fr_fix == 4)
           || !S_IS_DEFINED (s)
           ||S_IS_COMMON (s)
           ||S_IS_EXTERNAL (s))
@@ -7024,8 +6992,8 @@ s3_relax_frag (asection * sec ATTRIBUTE_UNUSED, fragS * fragp, long stretch ATTR
 static void
 s3_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, fragS * fragp)
 {
-  int r_old;
-  int r_new;
+  unsigned int r_old;
+  unsigned int r_new;
   char backup[20];
   fixS *fixp;
 
@@ -7090,17 +7058,17 @@ s3_pcrel_from (fixS * fixP)
 static valueT
 s3_section_align (segT segment ATTRIBUTE_UNUSED, valueT size)
 {
-  int align = bfd_get_section_alignment (stdoutput, segment);
-  return ((size + (1 << align) - 1) & (-1 << align));
+  int align = bfd_section_alignment (segment);
+  return ((size + (1 << align) - 1) & -(1 << align));
 }
 
 static void
 s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
 {
-  offsetT value = *valP;
-  offsetT newval;
-  offsetT content;
-  unsigned short HI, LO;
+  valueT value = *valP;
+  valueT newval;
+  valueT content;
+  valueT HI, LO;
 
   char *buf = fixP->fx_frag->fr_literal + fixP->fx_where;
 
@@ -7131,7 +7099,7 @@ s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
       if (fixP->fx_done)        /* For la rd, imm32.  */
         {
           newval = s3_md_chars_to_number (buf, s3_INSN_SIZE);
-          HI = (value) >> 16;   /* mul to 2, then take the hi 16 bit.  */
+          HI = value >> 16;   /* mul to 2, then take the hi 16 bit.  */
           newval |= (HI & 0x3fff) << 1;
           newval |= ((HI >> 14) & 0x3) << 16;
           s3_md_number_to_chars (buf, newval, s3_INSN_SIZE);
@@ -7141,7 +7109,7 @@ s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
       if (fixP->fx_done)        /* For la rd, imm32.  */
         {
           newval = s3_md_chars_to_number (buf, s3_INSN_SIZE);
-          LO = (value) & 0xffff;
+          LO = value & 0xffff;
           newval |= (LO & 0x3fff) << 1; /* 16 bit: imm -> 14 bit in lo, 2 bit in hi.  */
           newval |= ((LO >> 14) & 0x3) << 16;
           s3_md_number_to_chars (buf, newval, s3_INSN_SIZE);
@@ -7195,7 +7163,7 @@ s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
           if ((value & 0xfffffe00) != 0 && (value & 0xfffffe00) != 0xfffffe00)
             {
               as_bad_where (fixP->fx_file, fixP->fx_line,
-                            _(" branch relocation truncate (0x%x) [-2^9 ~ 2^9]"), (unsigned int)value);
+                            _(" branch relocation truncate (0x%x) [-2^9 ~ 2^9-1]"), (unsigned int) value);
               return;
             }
           content = s3_md_chars_to_number (buf, s3_INSN16_SIZE);
@@ -7210,7 +7178,7 @@ s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
           if ((value & 0xfff80000) != 0 && (value & 0xfff80000) != 0xfff80000)
             {
               as_bad_where (fixP->fx_file, fixP->fx_line,
-                            _(" branch relocation truncate (0x%x) [-2^19 ~ 2^19]"), (unsigned int)value);
+                            _(" branch relocation truncate (0x%x) [-2^19 ~ 2^19-1]"), (unsigned int) value);
               return;
             }
           content = s3_md_chars_to_number (buf, s3_INSN_SIZE);
@@ -7239,7 +7207,7 @@ s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
           if ((value & 0xfff80000) != 0 && (value & 0xfff80000) != 0xfff80000)
             {
               as_bad_where (fixP->fx_file, fixP->fx_line,
-                            _(" branch relocation truncate (0x%x) [-2^19 ~ 2^19]"), (unsigned int)value);
+                            _(" branch relocation truncate (0x%x) [-2^19 ~ 2^19-1]"), (unsigned int) value);
               return;
             }
           content = s3_md_chars_to_number (buf, s3_INSN_SIZE);
@@ -7251,7 +7219,7 @@ s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
         }
       else
         {
-          /* In differnt section.  */
+          /* In different section.  */
           if ((S_GET_SEGMENT (fixP->fx_addsy) != seg) ||
               (fixP->fx_addsy != NULL && S_IS_EXTERNAL (fixP->fx_addsy)))
             value = fixP->fx_offset;
@@ -7261,7 +7229,7 @@ s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
           if ((value & 0xfffffe00) != 0 && (value & 0xfffffe00) != 0xfffffe00)
             {
               as_bad_where (fixP->fx_file, fixP->fx_line,
-                            _(" branch relocation truncate (0x%x)  [-2^9 ~ 2^9]"), (unsigned int)value);
+                            _(" branch relocation truncate (0x%x) [-2^9 ~ 2^9-1]"), (unsigned int) value);
               return;
             }
 
@@ -7291,7 +7259,7 @@ s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
           if ((value & 0xfff80000) != 0 && (value & 0xfff80000) != 0xfff80000)
             {
               as_bad_where (fixP->fx_file, fixP->fx_line,
-                            _(" branch relocation truncate (0x%x) [-2^19 ~ 2^19]"), (unsigned int)value);
+                            _(" branch relocation truncate (0x%x) [-2^19 ~ 2^19-1]"), (unsigned int) value);
               return;
             }
 
@@ -7316,7 +7284,7 @@ s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
           if ((value & 0xfffffe00) != 0 && (value & 0xfffffe00) != 0xfffffe00)
             {
               as_bad_where (fixP->fx_file, fixP->fx_line,
-                           _(" branch relocation truncate (0x%x)  [-2^9 ~ 2^9]"), (unsigned int)value);
+                           _(" branch relocation truncate (0x%x)  [-2^9 ~ 2^9-1]"), (unsigned int) value);
               return;
             }
 
@@ -7399,12 +7367,12 @@ s3_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
   static arelent *retval[MAX_RELOC_EXPANSION + 1];  /* MAX_RELOC_EXPANSION equals 2.  */
   arelent *reloc;
   bfd_reloc_code_real_type code;
-  char *type;
+  const char *type;
 
-  reloc = retval[0] = xmalloc (sizeof (arelent));
+  reloc = retval[0] = XNEW (arelent);
   retval[1] = NULL;
 
-  reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+  reloc->sym_ptr_ptr = XNEW (asymbol *);
   *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
   reloc->addend = fixp->fx_offset;
@@ -7432,9 +7400,9 @@ s3_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
       newval |= (((off >> 14) & 0x3) << 16);
       s3_md_number_to_chars (buf, newval, s3_INSN_SIZE);
 
-      retval[1] = xmalloc (sizeof (arelent));
+      retval[1] = XNEW (arelent);
       retval[2] = NULL;
-      retval[1]->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+      retval[1]->sym_ptr_ptr = XNEW (asymbol *);
       *retval[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
       retval[1]->address = (reloc->address + s3_RELAX_RELOC2 (fixp->fx_frag->fr_subtype));
 
@@ -7454,6 +7422,7 @@ s3_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
           code = BFD_RELOC_32_PCREL;
           break;
         }
+      /* Fall through.  */
     case BFD_RELOC_HI16_S:
     case BFD_RELOC_LO16:
     case BFD_RELOC_SCORE_JMP:
@@ -7543,7 +7512,7 @@ md_number_to_chars (char *buf, valueT val, int n)
    within the words.  For example, (double) 1.1 in big endian mode is
    the byte sequence 3f f1 99 99 99 99 99 9a, and in little endian mode is
    the byte sequence 99 99 f1 3f 9a 99 99 99.  */
-char *
+const char *
 md_atof (int type, char *litP, int *sizeP)
 {
   if (score3)
@@ -7717,7 +7686,7 @@ score_set_mach (const char *arg)
 }
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
@@ -7808,29 +7777,29 @@ md_show_usage (FILE * fp)
 #endif
 
   fprintf (fp, _("\
-        -FIXDD\t\tassemble code for fix data dependency\n"));
+        -FIXDD\t\tfix data dependencies\n"));
   fprintf (fp, _("\
-        -NWARN\t\tassemble code for no warning message for fix data dependency\n"));
+        -NWARN\t\tdo not print warning message when fixing data dependencies\n"));
   fprintf (fp, _("\
-        -SCORE5\t\tassemble code for target is SCORE5\n"));
+        -SCORE5\t\tassemble code for target SCORE5\n"));
   fprintf (fp, _("\
-        -SCORE5U\tassemble code for target is SCORE5U\n"));
+        -SCORE5U\tassemble code for target SCORE5U\n"));
   fprintf (fp, _("\
-        -SCORE7\t\tassemble code for target is SCORE7, this is default setting\n"));
+        -SCORE7\t\tassemble code for target SCORE7 [default]\n"));
   fprintf (fp, _("\
-        -SCORE3\t\tassemble code for target is SCORE3\n"));
+        -SCORE3\t\tassemble code for target SCORE3\n"));
   fprintf (fp, _("\
-        -march=score7\tassemble code for target is SCORE7, this is default setting\n"));
+        -march=score7\tassemble code for target SCORE7 [default]\n"));
   fprintf (fp, _("\
-        -march=score3\tassemble code for target is SCORE3\n"));
+        -march=score3\tassemble code for target SCORE3\n"));
   fprintf (fp, _("\
         -USE_R1\t\tassemble code for no warning message when using temp register r1\n"));
   fprintf (fp, _("\
-        -KPIC\t\tassemble code for PIC\n"));
+        -KPIC\t\tgenerate PIC\n"));
   fprintf (fp, _("\
-        -O0\t\tassembler will not perform any optimizations\n"));
+        -O0\t\tdo not perform any optimizations\n"));
   fprintf (fp, _("\
-        -G gpnum\tassemble code for setting gpsize and default is 8 byte\n"));
+        -G gpnum\tassemble code for setting gpsize, default is 8 bytes\n"));
   fprintf (fp, _("\
-        -V \t\tSunplus release version \n"));
+        -V \t\tSunplus release version\n"));
 }