More fallout from "Allow symbol and label names to be enclosed in double quotes"
[binutils-gdb.git] / gas / config / tc-tic54x.c
index cfbad03bad2aa8b06021ae4a792f4e784acf102d..d8df85de0b9af9ba1e4fe0ad9371bebe3c8b6588 100644 (file)
@@ -1,12 +1,12 @@
 /* tc-tic54x.c -- Assembly code for the Texas Instruments TMS320C54X
 /* tc-tic54x.c -- Assembly code for the Texas Instruments TMS320C54X
-   Copyright (C) 1999, 2000 Free Software Foundation.
+   Copyright (C) 1999-2015 Free Software Foundation, Inc.
    Contributed by Timothy Wall (twall@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
    Contributed by Timothy Wall (twall@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,
    any later version.
 
    GAS is distributed in the hope that it will be useful,
@@ -16,8 +16,8 @@
 
    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
 
    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.  */
 
 /* Texas Instruments TMS320C54X machine specific gas.
    Written by Timothy Wall (twall@alum.mit.edu).
 
 /* Texas Instruments TMS320C54X machine specific gas.
    Written by Timothy Wall (twall@alum.mit.edu).
    We don't convert '' to '\0'
    We don't allow strings with .byte/.half/.short/.long
    Probably details of the subsym stuff are different
    We don't convert '' to '\0'
    We don't allow strings with .byte/.half/.short/.long
    Probably details of the subsym stuff are different
-   TI sets labels to be data type 4 (T_INT); GAS uses T_NULL.  */
+   TI sets labels to be data type 4 (T_INT); GAS uses T_NULL.
+
+   COFF1 limits section names to 8 characters.
+   Some of the default behavior changed from COFF1 to COFF2.  */
 
 
-#include <stdlib.h>
-#include <limits.h>
-#include <errno.h>
 #include "as.h"
 #include "as.h"
+#include <limits.h>
+#include "safe-ctype.h"
 #include "sb.h"
 #include "macro.h"
 #include "subsegs.h"
 #include "sb.h"
 #include "macro.h"
 #include "subsegs.h"
 #include "obj-coff.h"
 #include <math.h>
 
 #include "obj-coff.h"
 #include <math.h>
 
-#define MAX_LINE 256 /* Lines longer than this are truncated by TI's asm.  */
 
 
-const char comment_chars[] = ";";
-const char line_comment_chars[] = ";*#"; /* At column zero only.  */
-const char line_separator_chars[] = ""; /* Not permitted.  */
+static struct stag
+{
+  symbolS *sym;                        /* Symbol for this stag; value is offset.  */
+  const char *name;            /* Shortcut to symbol name.  */
+  bfd_vma size;                        /* Size of struct/union.  */
+  int current_bitfield_offset;  /* Temporary for tracking fields.  */
+  int is_union;
+  struct stag_field            /* List of fields.  */
+  {
+    const char *name;
+    bfd_vma offset;            /* Of start of this field.  */
+    int bitfield_offset;       /* Of start of this field.  */
+    struct stag *stag;         /* If field is struct/union.  */
+    struct stag_field *next;
+  } *field;
+  /* For nesting; used only in stag construction.  */
+  struct stag *inner;          /* Enclosed .struct.  */
+  struct stag *outer;          /* Enclosing .struct.  */
+} *current_stag = NULL;
 
 
-/* Characters which indicate that this is a floating point constant.  */
-const char FLT_CHARS[] = "fF";
+#define MAX_LINE 256 /* Lines longer than this are truncated by TI's asm.  */
 
 
-/* Characters that can be used to separate mantissa from exp in FP
-   nums.  */
-const char EXP_CHARS[] = "eE";
+typedef struct _tic54x_insn
+{
+  const insn_template *tm;     /* Opcode template.  */
 
 
-/* Only word (et al.), align, or conditionals are allowed within
-   .struct/.union.  */
-#define ILLEGAL_WITHIN_STRUCT()                                        \
-  do                                                           \
-    if (current_stag != NULL)                                  \
-      {                                                        \
-       as_bad (_("pseudo-op illegal within .struct/.union"));  \
-       return;                                                 \
-      }                                                                \
-  while (0)
+  char mnemonic[MAX_LINE];     /* Opcode name/mnemonic.  */
+  char parmnemonic[MAX_LINE];   /* 2nd mnemonic of parallel insn.  */
 
 
-void
-md_show_usage (stream)
-     FILE *stream;
-{
-  fprintf (stream, _("C54x-specific command line  options:\n"));
-  fprintf (stream, _("-mfar-mode | -mf          Use extended addressing\n"));
-  fprintf (stream, _("-mcpu=<CPU version>       Specify the CPU version\n"));
-#if 0
-  fprintf (stream, _("-mcoff-version={0|1|2}    Select COFF version\n"));
-#endif
-  fprintf (stream, _("-merrors-to-file <filename>\n"));
-  fprintf (stream, _("-me <filename>            Redirect errors to a file\n"));
-}
+  int opcount;
+  struct opstruct
+  {
+    char buf[MAX_LINE];
+    enum optype type;
+    expressionS exp;
+  } operands[MAX_OPERANDS];
 
 
-const char *md_shortopts = "";
+  int paropcount;
+  struct opstruct paroperands[MAX_OPERANDS];
+
+  int is_lkaddr;
+  int lkoperand;
+  int words;                   /* Size of insn in 16-bit words.  */
+  int using_default_dst;       /* Do we need to explicitly set an
+                                  omitted OP_DST operand?  */
+  struct
+  {
+    unsigned short word;            /* Final encoded opcode data.  */
+    int unresolved;
+    int r_nchars;                   /* Relocation size.  */
+    bfd_reloc_code_real_type r_type; /* Relocation type.  */
+    expressionS addr_expr;          /* Storage for unresolved expressions.  */
+  } opcode[3];
+} tic54x_insn;
 
 enum cpu_version
 {
 
 enum cpu_version
 {
@@ -105,6 +123,24 @@ enum address_mode
   far_mode  /* >16-bit addresses.  */
 };
 
   far_mode  /* >16-bit addresses.  */
 };
 
+static segT stag_saved_seg;
+static subsegT stag_saved_subseg;
+
+const char comment_chars[] = ";";
+const char line_comment_chars[] = ";*#"; /* At column zero only.  */
+const char line_separator_chars[] = ""; /* Not permitted.  */
+
+int emitting_long = 0;
+
+/* Characters which indicate that this is a floating point constant.  */
+const char FLT_CHARS[] = "fF";
+
+/* Characters that can be used to separate mantissa from exp in FP
+   nums.  */
+const char EXP_CHARS[] = "eE";
+
+const char *md_shortopts = "";
+
 #define OPTION_ADDRESS_MODE     (OPTION_MD_BASE)
 #define OPTION_CPU_VERSION      (OPTION_ADDRESS_MODE + 1)
 #define OPTION_COFF_VERSION     (OPTION_CPU_VERSION + 1)
 #define OPTION_ADDRESS_MODE     (OPTION_MD_BASE)
 #define OPTION_CPU_VERSION      (OPTION_ADDRESS_MODE + 1)
 #define OPTION_COFF_VERSION     (OPTION_CPU_VERSION + 1)
@@ -112,15 +148,12 @@ enum address_mode
 
 struct option md_longopts[] =
 {
 
 struct option md_longopts[] =
 {
-  { "mfar-mode",       no_argument,     NULL, OPTION_ADDRESS_MODE },
-  { "mf",            no_argument,       NULL, OPTION_ADDRESS_MODE },
-  { "mcpu",        required_argument,   NULL, OPTION_CPU_VERSION },
-#if 0
-  { "mcoff-version",   required_argument,   NULL, OPTION_COFF_VERSION },
-#endif
+  { "mfar-mode",       no_argument,        NULL, OPTION_ADDRESS_MODE },
+  { "mf",             no_argument,         NULL, OPTION_ADDRESS_MODE },
+  { "mcpu",           required_argument,   NULL, OPTION_CPU_VERSION },
   { "merrors-to-file", required_argument,   NULL, OPTION_STDERR_TO_FILE },
   { "merrors-to-file", required_argument,   NULL, OPTION_STDERR_TO_FILE },
-  { "me",            required_argument,   NULL, OPTION_STDERR_TO_FILE },
-  { NULL, no_argument, NULL, 0},
+  { "me",             required_argument,   NULL, OPTION_STDERR_TO_FILE },
+  { NULL,              no_argument,         NULL, 0},
 };
 
 size_t md_longopts_size = sizeof (md_longopts);
 };
 
 size_t md_longopts_size = sizeof (md_longopts);
@@ -149,7 +182,7 @@ static symbolS *last_label_seen = NULL;
 /* This ensures that all new labels are unique.  */
 static int local_label_id;
 
 /* This ensures that all new labels are unique.  */
 static int local_label_id;
 
-static struct hash_control *subsym_recurse_hash; /* Prevent infinite recurse. */
+static struct hash_control *subsym_recurse_hash; /* Prevent infinite recurse.  */
 static struct hash_control *math_hash; /* Built-in math functions.  */
 /* Allow maximum levels of macro nesting; level 0 is the main substitution
    symbol table.  The other assembler only does 32 levels, so there!  */
 static struct hash_control *math_hash; /* Built-in math functions.  */
 /* Allow maximum levels of macro nesting; level 0 is the main substitution
    symbol table.  The other assembler only does 32 levels, so there!  */
@@ -177,79 +210,49 @@ static struct hash_control *cc3_hash;
 static struct hash_control *sbit_hash;
 static struct hash_control *misc_symbol_hash;
 
 static struct hash_control *sbit_hash;
 static struct hash_control *misc_symbol_hash;
 
-static char *subsym_substitute PARAMS ((char *line, int forced));
-static char *subsym_lookup PARAMS ((char *name, int nest_level));
-static void subsym_create_or_replace PARAMS ((char *name, char *value));
-static float math_ceil PARAMS ((float, float));
-static float math_cvi PARAMS ((float, float));
-static float math_floor PARAMS ((float, float));
-static float math_fmod PARAMS ((float, float));
-static float math_int PARAMS ((float, float));
-static float math_round PARAMS ((float, float));
-static float math_sgn PARAMS ((float, float));
-static float math_trunc PARAMS ((float, float));
-static float math_acos PARAMS ((float, float));
-static float math_asin PARAMS ((float, float));
-static float math_atan PARAMS ((float, float));
-static float math_atan2 PARAMS ((float, float));
-static float math_cosh PARAMS ((float, float));
-static float math_cos PARAMS ((float, float));
-static float math_cvf PARAMS ((float, float));
-static float math_exp PARAMS ((float, float));
-static float math_fabs PARAMS ((float, float));
-static float math_ldexp PARAMS ((float, float));
-static float math_log10 PARAMS ((float, float));
-static float math_log PARAMS ((float, float));
-static float math_max PARAMS ((float, float));
-static float math_pow PARAMS ((float, float));
-static float math_sin PARAMS ((float, float));
-static float math_sinh PARAMS ((float, float));
-static float math_sqrt PARAMS ((float, float));
-static float math_tan PARAMS ((float, float));
-static float math_tanh PARAMS ((float, float));
+/* Only word (et al.), align, or conditionals are allowed within
+   .struct/.union.  */
+#define ILLEGAL_WITHIN_STRUCT()                                        \
+  do                                                           \
+    if (current_stag != NULL)                                  \
+      {                                                        \
+       as_bad (_("pseudo-op illegal within .struct/.union"));  \
+       return;                                                 \
+      }                                                                \
+  while (0)
 
 
-static struct stag
-{
-  symbolS *sym;                     /* Symbol for this stag; value is offset.  */
-  const char *name;             /* Shortcut to symbol name.  */
-  bfd_vma size;                     /* Size of struct/union.  */
-  int current_bitfield_offset;      /* Temporary for tracking fields.  */
-  int is_union;
-  struct stag_field             /* List of fields.  */
-  {
-    const char *name;
-    bfd_vma offset;             /* Of start of this field.  */
-    int bitfield_offset;           /* Of start of this field.  */
-    struct stag *stag;       /* If field is struct/union.  */
-    struct stag_field *next;
-  } *field;
-  /* For nesting; used only in stag construction.  */
-  struct stag *inner;         /* Enclosed .struct.  */
-  struct stag *outer;         /* Enclosing .struct.  */
-} *current_stag = NULL;
 
 
-static segT stag_saved_seg;
-static subsegT stag_saved_subseg;
+static void subsym_create_or_replace (char *, char *);
+static char *subsym_lookup (char *, int);
+static char *subsym_substitute (char *, int);
+
+
+void
+md_show_usage (FILE *stream)
+{
+  fprintf (stream, _("C54x-specific command line  options:\n"));
+  fprintf (stream, _("-mfar-mode | -mf          Use extended addressing\n"));
+  fprintf (stream, _("-mcpu=<CPU version>       Specify the CPU version\n"));
+  fprintf (stream, _("-merrors-to-file <filename>\n"));
+  fprintf (stream, _("-me <filename>            Redirect errors to a file\n"));
+}
 
 /* Output a single character (upper octect is zero).  */
 
 static void
 
 /* Output a single character (upper octect is zero).  */
 
 static void
-tic54x_emit_char (c)
-     char c;
+tic54x_emit_char (char c)
 {
 {
-  expressionS exp;
+  expressionS expn;
 
 
-  exp.X_op = O_constant;
-  exp.X_add_number = c;
-  emit_expr (&exp, 2);
+  expn.X_op = O_constant;
+  expn.X_add_number = c;
+  emit_expr (&expn, 2);
 }
 
 /* Walk backwards in the frag chain.  */
 
 static fragS *
 }
 
 /* Walk backwards in the frag chain.  */
 
 static fragS *
-frag_prev (frag, seg)
-     fragS *frag;
-     segT seg;
+frag_prev (fragS *frag, segT seg)
 {
   segment_info_type *seginfo = seg_info (seg);
   fragS *fragp;
 {
   segment_info_type *seginfo = seg_info (seg);
   fragS *fragp;
@@ -262,9 +265,7 @@ frag_prev (frag, seg)
 }
 
 static fragS *
 }
 
 static fragS *
-bit_offset_frag (frag, seg)
-     fragS *frag;
-     segT seg;
+bit_offset_frag (fragS *frag, segT seg)
 {
   while (frag != NULL)
     {
 {
   while (frag != NULL)
     {
@@ -282,9 +283,7 @@ bit_offset_frag (frag, seg)
    none. .field/.space/.bes may leave words partially allocated.  */
 
 static int
    none. .field/.space/.bes may leave words partially allocated.  */
 
 static int
-frag_bit_offset (frag, seg)
-     fragS *frag;
-     segT seg;
+frag_bit_offset (fragS *frag, segT seg)
 {
   frag = bit_offset_frag (frag, seg);
 
 {
   frag = bit_offset_frag (frag, seg);
 
@@ -298,14 +297,14 @@ frag_bit_offset (frag, seg)
    expression.  */
 
 static char *
    expression.  */
 
 static char *
-parse_expression (char *str, expressionS * exp)
+parse_expression (char *str, expressionS *expn)
 {
   char *s;
   char *tmp;
 
   tmp = input_line_pointer;    /* Save line pointer.  */
   input_line_pointer = str;
 {
   char *s;
   char *tmp;
 
   tmp = input_line_pointer;    /* Save line pointer.  */
   input_line_pointer = str;
-  expression (exp);
+  expression (expn);
   s = input_line_pointer;
   input_line_pointer = tmp;    /* Restore line pointer.  */
   return s;                    /* Return pointer to where parsing stopped.  */
   s = input_line_pointer;
   input_line_pointer = tmp;    /* Restore line pointer.  */
   return s;                    /* Return pointer to where parsing stopped.  */
@@ -318,8 +317,7 @@ parse_expression (char *str, expressionS * exp)
    unsupported.  */
 
 static void
    unsupported.  */
 
 static void
-tic54x_asg (x)
-     int x ATTRIBUTE_UNUSED;
+tic54x_asg (int x ATTRIBUTE_UNUSED)
 {
   int c;
   char *name;
 {
   int c;
   char *name;
@@ -353,11 +351,11 @@ tic54x_asg (x)
       return;
     }
 
       return;
     }
 
-  name = ++input_line_pointer;
-  c = get_symbol_end ();       /* Get terminator.  */
-  if (!isalpha (*name))
+  ++input_line_pointer;
+  c = get_symbol_name (&name); /* Get terminator.  */
+  if (!ISALPHA (*name))
     {
     {
-      as_bad ("symbols assigned with .asg must begin with a letter");
+      as_bad (_("symbols assigned with .asg must begin with a letter"));
       ignore_rest_of_line ();
       return;
     }
       ignore_rest_of_line ();
       return;
     }
@@ -369,7 +367,7 @@ tic54x_asg (x)
   strcpy (tmp, name);
   name = tmp;
   subsym_create_or_replace (name, str);
   strcpy (tmp, name);
   name = tmp;
   subsym_create_or_replace (name, str);
-  *input_line_pointer = c;
+  (void) restore_line_pointer (c);
   demand_empty_rest_of_line ();
 }
 
   demand_empty_rest_of_line ();
 }
 
@@ -380,8 +378,7 @@ tic54x_asg (x)
    table, since that's what works best.  */
 
 static void
    table, since that's what works best.  */
 
 static void
-tic54x_eval (x)
-     int x ATTRIBUTE_UNUSED;
+tic54x_eval (int x ATTRIBUTE_UNUSED)
 {
   char c;
   int value;
 {
   char c;
   int value;
@@ -414,13 +411,12 @@ tic54x_eval (x)
       ignore_rest_of_line ();
       return;
     }
       ignore_rest_of_line ();
       return;
     }
-  name = input_line_pointer;
-  c = get_symbol_end ();       /* Get terminator.  */
+  c = get_symbol_name (&name); /* Get terminator.  */
   tmp = xmalloc (strlen (name) + 1);
   name = strcpy (tmp, name);
   tmp = xmalloc (strlen (name) + 1);
   name = strcpy (tmp, name);
-  *input_line_pointer = c;
+  (void) restore_line_pointer (c);
 
 
-  if (!isalpha (*name))
+  if (!ISALPHA (*name))
     {
       as_bad (_("symbols assigned with .eval must begin with a letter"));
       ignore_rest_of_line ();
     {
       as_bad (_("symbols assigned with .eval must begin with a letter"));
       ignore_rest_of_line ();
@@ -457,8 +453,7 @@ tic54x_eval (x)
       (not yet implemented).  */
 
 static void
       (not yet implemented).  */
 
 static void
-tic54x_bss (x)
-     int x ATTRIBUTE_UNUSED;
+tic54x_bss (int x ATTRIBUTE_UNUSED)
 {
   char c;
   char *name;
 {
   char c;
   char *name;
@@ -475,11 +470,12 @@ tic54x_bss (x)
   current_seg = now_seg;       /* Save current seg.  */
   current_subseg = now_subseg; /* Save current subseg.  */
 
   current_seg = now_seg;       /* Save current seg.  */
   current_subseg = now_subseg; /* Save current subseg.  */
 
-  name = input_line_pointer;
-  c = get_symbol_end ();       /* Get terminator.  */
+  c = get_symbol_name (&name); /* Get terminator.  */
+  if (c == '"')
+    c = * ++ input_line_pointer;
   if (c != ',')
     {
   if (c != ',')
     {
-      as_bad (".bss size argument missing\n");
+      as_bad (_(".bss size argument missing\n"));
       ignore_rest_of_line ();
       return;
     }
       ignore_rest_of_line ();
       return;
     }
@@ -488,7 +484,7 @@ tic54x_bss (x)
   words = get_absolute_expression ();
   if (words < 0)
     {
   words = get_absolute_expression ();
   if (words < 0)
     {
-      as_bad (".bss size %d < 0!", words);
+      as_bad (_(".bss size %d < 0!"), words);
       ignore_rest_of_line ();
       return;
     }
       ignore_rest_of_line ();
       return;
     }
@@ -521,7 +517,7 @@ tic54x_bss (x)
 
   symbol_set_frag (symbolP, frag_now);
   p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
 
   symbol_set_frag (symbolP, frag_now);
   p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
-               (offsetT) (words << 1), (char *) 0);
+               (offsetT) (words * OCTETS_PER_BYTE), (char *) 0);
   *p = 0;                      /* Fill char.  */
 
   S_SET_SEGMENT (symbolP, bss_section);
   *p = 0;                      /* Fill char.  */
 
   S_SET_SEGMENT (symbolP, bss_section);
@@ -540,19 +536,18 @@ tic54x_bss (x)
     }
 
   if (block)
     }
 
   if (block)
-    bss_section->flags |= SEC_BLOCK;
+    bss_section->flags |= SEC_TIC54X_BLOCK;
 
   subseg_set (current_seg, current_subseg);    /* Restore current seg.  */
   demand_empty_rest_of_line ();
 }
 
 static void
 
   subseg_set (current_seg, current_subseg);    /* Restore current seg.  */
   demand_empty_rest_of_line ();
 }
 
 static void
-stag_add_field_symbols (stag, path, base_offset, rootsym, root_stag_name)
-     struct stag *stag;
-     const char *path;
-     bfd_vma base_offset;
-     symbolS *rootsym;
-     const char *root_stag_name;
+stag_add_field_symbols (struct stag *stag,
+                       const char *path,
+                       bfd_vma base_offset,
+                       symbolS *rootsym,
+                       const char *root_stag_name)
 {
   char prefix[strlen (path) + 2];
   struct stag_field *field = stag->field;
 {
   char prefix[strlen (path) + 2];
   struct stag_field *field = stag->field;
@@ -605,11 +600,10 @@ stag_add_field_symbols (stag, path, base_offset, rootsym, root_stag_name)
    complete dereferencing symbols to the symbol table.  */
 
 static void
    complete dereferencing symbols to the symbol table.  */
 
 static void
-stag_add_field (parent, name, offset, stag)
-     struct stag *parent;
-     const char *name;
-     bfd_vma offset;
-     struct stag *stag;
+stag_add_field (struct stag *parent,
+               const char *name,
+               bfd_vma offset,
+               struct stag *stag)
 {
   struct stag_field *sfield = xmalloc (sizeof (struct stag_field));
 
 {
   struct stag_field *sfield = xmalloc (sizeof (struct stag_field));
 
@@ -786,11 +780,10 @@ tic54x_endstruct (int is_union)
    format on the existing allocated space.  */
 
 static void
    format on the existing allocated space.  */
 
 static void
-tic54x_tag (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+tic54x_tag (int ignore ATTRIBUTE_UNUSED)
 {
 {
-  char *name = input_line_pointer;
-  int c = get_symbol_end ();
+  char *name;
+  int c = get_symbol_name (&name);
   struct stag *stag = (struct stag *) hash_find (stag_hash, name);
 
   if (!stag)
   struct stag *stag = (struct stag *) hash_find (stag_hash, name);
 
   if (!stag)
@@ -820,6 +813,7 @@ tic54x_tag (ignore)
       else
        {
          symbolS *sym = symbol_find (label);
       else
        {
          symbolS *sym = symbol_find (label);
+
          if (!sym)
            {
              as_bad (_(".tag target '%s' undefined"), label);
          if (!sym)
            {
              as_bad (_(".tag target '%s' undefined"), label);
@@ -835,7 +829,7 @@ tic54x_tag (ignore)
   if (current_stag != NULL && !current_stag->is_union)
     abs_section_offset += stag->size;
 
   if (current_stag != NULL && !current_stag->is_union)
     abs_section_offset += stag->size;
 
-  *input_line_pointer = c;
+  (void) restore_line_pointer (c);
   demand_empty_rest_of_line ();
   line_label = NULL;
 }
   demand_empty_rest_of_line ();
   line_label = NULL;
 }
@@ -903,9 +897,7 @@ tic54x_struct_field (int type)
              new_bitfield_offset = count - 16;
            }
          else
              new_bitfield_offset = count - 16;
            }
          else
-           {
-             new_bitfield_offset = count;
-           }
+           new_bitfield_offset = count;
        }
       else
        {
        }
       else
        {
@@ -933,6 +925,7 @@ tic54x_struct_field (int type)
     {
       static int fieldno = 0;
       char fake[] = ".fake_fieldNNNNN";
     {
       static int fieldno = 0;
       char fake[] = ".fake_fieldNNNNN";
+
       sprintf (fake, ".fake_field%d", fieldno++);
       stag_add_field (current_stag, fake,
                      abs_section_offset - S_GET_VALUE (current_stag->sym),
       sprintf (fake, ".fake_field%d", fieldno++);
       stag_add_field (current_stag, fake,
                      abs_section_offset - S_GET_VALUE (current_stag->sym),
@@ -941,6 +934,7 @@ tic54x_struct_field (int type)
   else
     {
       char label[strlen (S_GET_NAME (line_label) + 1)];
   else
     {
       char label[strlen (S_GET_NAME (line_label) + 1)];
+
       strcpy (label, S_GET_NAME (line_label));
       stag_add_field (current_stag, label,
                      abs_section_offset - S_GET_VALUE (current_stag->sym),
       strcpy (label, S_GET_NAME (line_label));
       stag_add_field (current_stag, label,
                      abs_section_offset - S_GET_VALUE (current_stag->sym),
@@ -963,11 +957,10 @@ tic54x_struct_field (int type)
 
 /* Handle .byte, .word. .int, .long and all variants.  */
 
 
 /* Handle .byte, .word. .int, .long and all variants.  */
 
-int emitting_long = 0;
 static void
 tic54x_cons (int type)
 {
 static void
 tic54x_cons (int type)
 {
-  register unsigned int c;
+  unsigned int c;
   int octets;
 
   /* If we're within a .struct construct, don't actually allocate space.  */
   int octets;
 
   /* If we're within a .struct construct, don't actually allocate space.  */
@@ -1024,28 +1017,28 @@ tic54x_cons (int type)
        }
       else
        {
        }
       else
        {
-         expressionS exp;
+         expressionS expn;
 
 
-         input_line_pointer = parse_expression (input_line_pointer, &exp);
-         if (exp.X_op == O_constant)
+         input_line_pointer = parse_expression (input_line_pointer, &expn);
+         if (expn.X_op == O_constant)
            {
            {
-             offsetT value = exp.X_add_number;
+             offsetT value = expn.X_add_number;
              /* Truncate overflows.  */
              switch (octets)
                {
                case 1:
                  if ((value > 0 && value > 0xFF)
                      || (value < 0 && value < - 0x100))
              /* Truncate overflows.  */
              switch (octets)
                {
                case 1:
                  if ((value > 0 && value > 0xFF)
                      || (value < 0 && value < - 0x100))
-                   as_warn ("Overflow in expression, truncated to 8 bits");
+                   as_warn (_("Overflow in expression, truncated to 8 bits"));
                  break;
                case 2:
                  if ((value > 0 && value > 0xFFFF)
                      || (value < 0 && value < - 0x10000))
                  break;
                case 2:
                  if ((value > 0 && value > 0xFFFF)
                      || (value < 0 && value < - 0x10000))
-                   as_warn ("Overflow in expression, truncated to 16 bits");
+                   as_warn (_("Overflow in expression, truncated to 16 bits"));
                  break;
                }
            }
                  break;
                }
            }
-         if (exp.X_op != O_constant && octets < 2)
+         if (expn.X_op != O_constant && octets < 2)
            {
              /* Disallow .byte with a non constant expression that will
                 require relocation.  */
            {
              /* Disallow .byte with a non constant expression that will
                 require relocation.  */
@@ -1054,25 +1047,25 @@ tic54x_cons (int type)
              return;
            }
 
              return;
            }
 
-         if (exp.X_op != O_constant
+         if (expn.X_op != O_constant
              && amode == c_mode
              && octets == 4)
            {
              /* FIXME -- at one point TI tools used to output REL16
                 relocations, but I don't think the latest tools do at all
                 The current tools output extended relocations regardless of
              && amode == c_mode
              && octets == 4)
            {
              /* FIXME -- at one point TI tools used to output REL16
                 relocations, but I don't think the latest tools do at all
                 The current tools output extended relocations regardless of
-                the addresing mode (I actually think that ".c_mode" is
+                the addressing mode (I actually think that ".c_mode" is
                 totally ignored in the latest tools).  */
              amode = far_mode;
              emitting_long = 1;
                 totally ignored in the latest tools).  */
              amode = far_mode;
              emitting_long = 1;
-             emit_expr (&exp, 4);
+             emit_expr (&expn, 4);
              emitting_long = 0;
              amode = c_mode;
            }
          else
            {
              emitting_long = octets == 4;
              emitting_long = 0;
              amode = c_mode;
            }
          else
            {
              emitting_long = octets == 4;
-             emit_expr (&exp, (octets == 1) ? 2 : octets);
+             emit_expr (&expn, (octets == 1) ? 2 : octets);
              emitting_long = 0;
            }
        }
              emitting_long = 0;
            }
        }
@@ -1103,8 +1096,7 @@ tic54x_cons (int type)
    these, so we ignore the type here.  */
 
 void
    these, so we ignore the type here.  */
 
 void
-tic54x_global (type)
-     int type;
+tic54x_global (int type)
 {
   char *name;
   int c;
 {
   char *name;
   int c;
@@ -1117,11 +1109,10 @@ tic54x_global (type)
 
   do
     {
 
   do
     {
-      name = input_line_pointer;
-      c = get_symbol_end ();
+      c = get_symbol_name (&name);
       symbolP = symbol_find_or_make (name);
       symbolP = symbol_find_or_make (name);
+      c = restore_line_pointer (c);
 
 
-      *input_line_pointer = c;
       S_SET_STORAGE_CLASS (symbolP, C_EXT);
       if (c == ',')
        {
       S_SET_STORAGE_CLASS (symbolP, C_EXT);
       if (c == ',')
        {
@@ -1138,19 +1129,16 @@ tic54x_global (type)
 /* Remove the symbol from the local label hash lookup.  */
 
 static void
 /* Remove the symbol from the local label hash lookup.  */
 
 static void
-tic54x_remove_local_label (key, value)
-     const char *key;
-     PTR value ATTRIBUTE_UNUSED;
+tic54x_remove_local_label (const char *key, void *value ATTRIBUTE_UNUSED)
 {
 {
-  PTR *elem = hash_delete (local_label_hash[macro_level], key);
+  void *elem = hash_delete (local_label_hash[macro_level], key, FALSE);
   free (elem);
 }
 
 /* Reset all local labels.  */
 
 static void
   free (elem);
 }
 
 /* Reset all local labels.  */
 
 static void
-tic54x_clear_local_labels (ignored)
-     int ignored ATTRIBUTE_UNUSED;
+tic54x_clear_local_labels (int ignored ATTRIBUTE_UNUSED)
 {
   hash_traverse (local_label_hash[macro_level], tic54x_remove_local_label);
 }
 {
   hash_traverse (local_label_hash[macro_level], tic54x_remove_local_label);
 }
@@ -1164,7 +1152,9 @@ tic54x_clear_local_labels (ignored)
 
    ARG is 't' for text, 'd' for data, or '*' for a named section
 
 
    ARG is 't' for text, 'd' for data, or '*' for a named section
 
-   For compatibility, '*' sections have SEC_DATA set instead of SEC_CODE.  */
+   For compatibility, '*' sections are SEC_CODE if instructions are
+   encountered, or SEC_DATA if not.
+*/
 
 static void
 tic54x_sect (int arg)
 
 static void
 tic54x_sect (int arg)
@@ -1182,6 +1172,7 @@ tic54x_sect (int arg)
     {
       char *name = NULL;
       int len;
     {
       char *name = NULL;
       int len;
+
       /* If there are quotes, remove them.  */
       if (*input_line_pointer == '"')
        {
       /* If there are quotes, remove them.  */
       if (*input_line_pointer == '"')
        {
@@ -1192,13 +1183,16 @@ tic54x_sect (int arg)
       else
        {
          int c;
       else
        {
          int c;
-         name = input_line_pointer;
-         c = get_symbol_end ();
+
+         c = get_symbol_name (&name);
+          len = strlen(name);
          name = strcpy (xmalloc (len + 10), name);
          name = strcpy (xmalloc (len + 10), name);
-         *input_line_pointer = c;
+         (void) restore_line_pointer (c);
          demand_empty_rest_of_line ();
        }
          demand_empty_rest_of_line ();
        }
-      /* Make sure all named initialized sections are SEC_DATA.  */
+
+      /* Make sure all named initialized sections flagged properly.  If we
+         encounter instructions, we'll flag it with SEC_CODE as well.  */
       strcat (name, ",\"w\"\n");
       input_scrub_insert_line (name);
       obj_coff_section (0);
       strcat (name, ",\"w\"\n");
       input_scrub_insert_line (name);
       obj_coff_section (0);
@@ -1227,7 +1221,7 @@ tic54x_sect (int arg)
 static void
 tic54x_space (int arg)
 {
 static void
 tic54x_space (int arg)
 {
-  expressionS exp;
+  expressionS expn;
   char *p = 0;
   int octets = 0;
   long words;
   char *p = 0;
   int octets = 0;
   long words;
@@ -1243,22 +1237,21 @@ tic54x_space (int arg)
 #endif
 
   /* Read the bit count.  */
 #endif
 
   /* Read the bit count.  */
-  expression (&exp);
+  expression (&expn);
 
   /* Some expressions are unresolvable until later in the assembly pass;
      postpone until relaxation/fixup.  we also have to postpone if a previous
      partial allocation has not been completed yet.  */
 
   /* Some expressions are unresolvable until later in the assembly pass;
      postpone until relaxation/fixup.  we also have to postpone if a previous
      partial allocation has not been completed yet.  */
-  if (exp.X_op != O_constant || frag_bit_offset (frag_now, now_seg) == -1)
+  if (expn.X_op != O_constant || frag_bit_offset (frag_now, now_seg) == -1)
     {
       struct bit_info *bi = xmalloc (sizeof (struct bit_info));
     {
       struct bit_info *bi = xmalloc (sizeof (struct bit_info));
-      char *p;
 
       bi->seg = now_seg;
       bi->type = bes;
       bi->sym = label;
       p = frag_var (rs_machine_dependent,
                    65536 * 2, 1, (relax_substateT) 0,
 
       bi->seg = now_seg;
       bi->type = bes;
       bi->sym = label;
       p = frag_var (rs_machine_dependent,
                    65536 * 2, 1, (relax_substateT) 0,
-                   make_expr_symbol (&exp), (offsetT) 0,
+                   make_expr_symbol (&expn), (offsetT) 0,
                    (char *) bi);
       if (p)
        *p = 0;
                    (char *) bi);
       if (p)
        *p = 0;
@@ -1272,7 +1265,8 @@ tic54x_space (int arg)
   if (bit_offset != 0 && bit_offset < 16)
     {
       int spare_bits = bits_per_byte - bit_offset;
   if (bit_offset != 0 && bit_offset < 16)
     {
       int spare_bits = bits_per_byte - bit_offset;
-      if (spare_bits >= exp.X_add_number)
+
+      if (spare_bits >= expn.X_add_number)
        {
          /* Don't have to do anything; sufficient bits have already been
             allocated; just point the label to the right place.  */
        {
          /* Don't have to do anything; sufficient bits have already been
             allocated; just point the label to the right place.  */
@@ -1282,10 +1276,10 @@ tic54x_space (int arg)
              S_SET_VALUE (label, frag_now_fix () - 1);
              label = NULL;
            }
              S_SET_VALUE (label, frag_now_fix () - 1);
              label = NULL;
            }
-         frag_now->tc_frag_data += exp.X_add_number;
+         frag_now->tc_frag_data += expn.X_add_number;
          goto getout;
        }
          goto getout;
        }
-      exp.X_add_number -= spare_bits;
+      expn.X_add_number -= spare_bits;
       /* Set the label to point to the first word allocated, which in this
         case is the previous word, which was only partially filled.  */
       if (!bes && label != NULL)
       /* Set the label to point to the first word allocated, which in this
         case is the previous word, which was only partially filled.  */
       if (!bes && label != NULL)
@@ -1296,9 +1290,9 @@ tic54x_space (int arg)
        }
     }
   /* Convert bits to bytes/words and octets, rounding up.  */
        }
     }
   /* Convert bits to bytes/words and octets, rounding up.  */
-  words = ((exp.X_add_number + bits_per_byte - 1) / bits_per_byte);
+  words = ((expn.X_add_number + bits_per_byte - 1) / bits_per_byte);
   /* How many do we have left over?  */
   /* How many do we have left over?  */
-  bit_offset = exp.X_add_number % bits_per_byte;
+  bit_offset = expn.X_add_number % bits_per_byte;
   octets = words * OCTETS_PER_BYTE;
   if (octets < 0)
     {
   octets = words * OCTETS_PER_BYTE;
   if (octets < 0)
     {
@@ -1347,7 +1341,7 @@ tic54x_space (int arg)
 /* [symbol] .usect "section-name", size-in-words
                   [, [blocking-flag] [, alignment-flag]]
 
 /* [symbol] .usect "section-name", size-in-words
                   [, [blocking-flag] [, alignment-flag]]
 
-   Unitialized section.
+   Uninitialized section.
    Non-zero blocking means that if the section would cross a page (128-word)
    boundary, it will be page-aligned.
    Non-zero alignment aligns on a longword boundary.
    Non-zero blocking means that if the section would cross a page (128-word)
    boundary, it will be page-aligned.
    Non-zero alignment aligns on a longword boundary.
@@ -1355,8 +1349,7 @@ tic54x_space (int arg)
    Has no effect on the current section.  */
 
 static void
    Has no effect on the current section.  */
 
 static void
-tic54x_usect (x)
-     int x ATTRIBUTE_UNUSED;
+tic54x_usect (int x ATTRIBUTE_UNUSED)
 {
   char c;
   char *name;
 {
   char c;
   char *name;
@@ -1373,17 +1366,14 @@ tic54x_usect (x)
   current_seg = now_seg;       /* Save current seg.  */
   current_subseg = now_subseg; /* Save current subseg.  */
 
   current_seg = now_seg;       /* Save current seg.  */
   current_subseg = now_subseg; /* Save current subseg.  */
 
-  if (*input_line_pointer == '"')
-    input_line_pointer++;
-  section_name = input_line_pointer;
-  c = get_symbol_end ();       /* Get terminator.  */
-  input_line_pointer++;                /* Skip null symbol terminator.  */
+  c = get_symbol_name (&section_name); /* Get terminator.  */
   name = xmalloc (input_line_pointer - section_name + 1);
   strcpy (name, section_name);
   name = xmalloc (input_line_pointer - section_name + 1);
   strcpy (name, section_name);
-
-  if (*input_line_pointer == ',')
+  c = restore_line_pointer (c);
+  
+  if (c == ',')
     ++input_line_pointer;
     ++input_line_pointer;
-  else if (c != ',')
+  else
     {
       as_bad (_("Missing size argument"));
       ignore_rest_of_line ();
     {
       as_bad (_("Missing size argument"));
       ignore_rest_of_line ();
@@ -1441,10 +1431,10 @@ tic54x_usect (x)
   *p = 0;
 
   if (blocking_flag)
   *p = 0;
 
   if (blocking_flag)
-    flags |= SEC_BLOCK;
+    flags |= SEC_TIC54X_BLOCK;
 
   if (!bfd_set_section_flags (stdoutput, seg, flags))
 
   if (!bfd_set_section_flags (stdoutput, seg, flags))
-    as_warn ("Error setting flags for \"%s\": %s", name,
+    as_warn (_("Error setting flags for \"%s\": %s"), name,
             bfd_errmsg (bfd_get_error ()));
 
   subseg_set (current_seg, current_subseg);    /* Restore current seg.  */
             bfd_errmsg (bfd_get_error ()));
 
   subseg_set (current_seg, current_subseg);    /* Restore current seg.  */
@@ -1452,8 +1442,7 @@ tic54x_usect (x)
 }
 
 static enum cpu_version
 }
 
 static enum cpu_version
-lookup_version (ver)
-     const char *ver;
+lookup_version (const char *ver)
 {
   enum cpu_version version = VNONE;
 
 {
   enum cpu_version version = VNONE;
 
@@ -1464,8 +1453,8 @@ lookup_version (ver)
              || ver[2] == '5' || ver[2] == '8' || ver[2] == '9'))
        version = ver[2] - '0';
       else if (strlen (ver) == 5
              || ver[2] == '5' || ver[2] == '8' || ver[2] == '9'))
        version = ver[2] - '0';
       else if (strlen (ver) == 5
-              && toupper (ver[3]) == 'L'
-              && toupper (ver[4]) == 'P'
+              && TOUPPER (ver[3]) == 'L'
+              && TOUPPER (ver[4]) == 'P'
               && (ver[2] == '5' || ver[2] == '6'))
        version = ver[2] - '0' + 10;
     }
               && (ver[2] == '5' || ver[2] == '6'))
        version = ver[2] - '0' + 10;
     }
@@ -1474,8 +1463,7 @@ lookup_version (ver)
 }
 
 static void
 }
 
 static void
-set_cpu (version)
-     enum cpu_version version;
+set_cpu (enum cpu_version version)
 {
   cpu = version;
   if (version == V545LP || version == V546LP)
 {
   cpu = version;
   if (version == V545LP || version == V546LP)
@@ -1502,8 +1490,7 @@ set_cpu (version)
 static int cpu_needs_set = 1;
 
 static void
 static int cpu_needs_set = 1;
 
 static void
-tic54x_version (x)
-     int x ATTRIBUTE_UNUSED;
+tic54x_version (int x ATTRIBUTE_UNUSED)
 {
   enum cpu_version version = VNONE;
   enum cpu_version old_version = cpu;
 {
   enum cpu_version version = VNONE;
   enum cpu_version old_version = cpu;
@@ -1572,15 +1559,13 @@ tic54x_float_cons (int type)
 
 /* The argument is capitalized if it should be zero-terminated
    's' is normal string with upper 8-bits zero-filled, 'p' is packed.
 
 /* The argument is capitalized if it should be zero-terminated
    's' is normal string with upper 8-bits zero-filled, 'p' is packed.
-   Code copied from read.c, and slightly modified so that strings are packed
+   Code copied from stringer, and slightly modified so that strings are packed
    and encoded into the correct octets.  */
 
 static void
    and encoded into the correct octets.  */
 
 static void
-tic54x_stringer (type)
-     int type;
+tic54x_stringer (int type)
 {
 {
-  register unsigned int c;
-  char *start;
+  unsigned int c;
   int append_zero = type == 'S' || type == 'P';
   int packed = type == 'p' || type == 'P';
   int last_char = -1; /* Packed strings need two bytes at a time to encode.  */
   int append_zero = type == 'S' || type == 'P';
   int packed = type == 'p' || type == 'P';
   int last_char = -1; /* Packed strings need two bytes at a time to encode.  */
@@ -1595,7 +1580,7 @@ tic54x_stringer (type)
   md_flush_pending_output ();
 #endif
 
   md_flush_pending_output ();
 #endif
 
-  c = ',';                     /* Do loop. */
+  c = ',';                     /* Do loop.  */
   while (c == ',')
     {
       SKIP_WHITESPACE ();
   while (c == ',')
     {
       SKIP_WHITESPACE ();
@@ -1610,7 +1595,6 @@ tic54x_stringer (type)
          }
        case '\"':
          ++input_line_pointer; /* -> 1st char of string.  */
          }
        case '\"':
          ++input_line_pointer; /* -> 1st char of string.  */
-         start = input_line_pointer;
          while (is_a_char (c = next_char_of_string ()))
            {
              if (!packed)
          while (is_a_char (c = next_char_of_string ()))
            {
              if (!packed)
@@ -1664,15 +1648,13 @@ tic54x_stringer (type)
 }
 
 static void
 }
 
 static void
-tic54x_p2align (arg)
-     int arg ATTRIBUTE_UNUSED;
+tic54x_p2align (int arg ATTRIBUTE_UNUSED)
 {
   as_bad (_("p2align not supported on this target"));
 }
 
 static void
 {
   as_bad (_("p2align not supported on this target"));
 }
 
 static void
-tic54x_align_words (arg)
-     int arg;
+tic54x_align_words (int arg)
 {
   /* Only ".align" with no argument is allowed within .struct/.union.  */
   int count = arg;
 {
   /* Only ".align" with no argument is allowed within .struct/.union.  */
   int count = arg;
@@ -1704,10 +1686,9 @@ tic54x_align_words (arg)
 /* Initialize multiple-bit fields withing a single word of memory.  */
 
 static void
 /* Initialize multiple-bit fields withing a single word of memory.  */
 
 static void
-tic54x_field (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+tic54x_field (int ignore ATTRIBUTE_UNUSED)
 {
 {
-  expressionS exp;
+  expressionS expn;
   int size = 16;
   char *p;
   valueT value;
   int size = 16;
   char *p;
   valueT value;
@@ -1719,7 +1700,7 @@ tic54x_field (ignore)
       return;
     }
 
       return;
     }
 
-  input_line_pointer = parse_expression (input_line_pointer, &exp);
+  input_line_pointer = parse_expression (input_line_pointer, &expn);
 
   if (*input_line_pointer == ',')
     {
 
   if (*input_line_pointer == ',')
     {
@@ -1734,7 +1715,7 @@ tic54x_field (ignore)
     }
 
   /* Truncate values to the field width.  */
     }
 
   /* Truncate values to the field width.  */
-  if (exp.X_op != O_constant)
+  if (expn.X_op != O_constant)
     {
       /* If the expression value is relocatable, the field size *must*
          be 16.  */
     {
       /* If the expression value is relocatable, the field size *must*
          be 16.  */
@@ -1746,16 +1727,17 @@ tic54x_field (ignore)
        }
 
       frag_now->tc_frag_data = 0;
        }
 
       frag_now->tc_frag_data = 0;
-      emit_expr (&exp, 2);
+      emit_expr (&expn, 2);
     }
   else
     {
       unsigned long fmask = (size == 32) ? 0xFFFFFFFF : (1ul << size) - 1;
     }
   else
     {
       unsigned long fmask = (size == 32) ? 0xFFFFFFFF : (1ul << size) - 1;
-      value = exp.X_add_number;
-      exp.X_add_number &= fmask;
-      if (value != (valueT) exp.X_add_number)
+
+      value = expn.X_add_number;
+      expn.X_add_number &= fmask;
+      if (value != (valueT) expn.X_add_number)
        as_warn (_("field value truncated"));
        as_warn (_("field value truncated"));
-      value = exp.X_add_number;
+      value = expn.X_add_number;
       /* Bits are stored MS first.  */
       while (size >= 16)
        {
       /* Bits are stored MS first.  */
       while (size >= 16)
        {
@@ -1767,6 +1749,7 @@ tic54x_field (ignore)
       if (size > 0)
        {
          int bit_offset = frag_bit_offset (frag_now, now_seg);
       if (size > 0)
        {
          int bit_offset = frag_bit_offset (frag_now, now_seg);
+
          fragS *alloc_frag = bit_offset_frag (frag_now, now_seg);
          if (bit_offset == -1)
            {
          fragS *alloc_frag = bit_offset_frag (frag_now, now_seg);
          if (bit_offset == -1)
            {
@@ -1774,6 +1757,7 @@ tic54x_field (ignore)
              /* We don't know the previous offset at this time, so store the
                 info we need and figure it out later.  */
              expressionS size_exp;
              /* We don't know the previous offset at this time, so store the
                 info we need and figure it out later.  */
              expressionS size_exp;
+
              size_exp.X_op = O_constant;
              size_exp.X_add_number = size;
              bi->seg = now_seg;
              size_exp.X_op = O_constant;
              size_exp.X_add_number = size;
              bi->seg = now_seg;
@@ -1825,8 +1809,7 @@ tic54x_field (ignore)
    available yet.  seg_info ()->bss is the next best thing.  */
 
 static int
    available yet.  seg_info ()->bss is the next best thing.  */
 
 static int
-tic54x_initialized_section (seg)
-     segT seg;
+tic54x_initialized_section (segT seg)
 {
   return !seg_info (seg)->bss;
 }
 {
   return !seg_info (seg)->bss;
 }
@@ -1839,8 +1822,7 @@ tic54x_initialized_section (seg)
    Name is required for uninitialized sections.  */
 
 static void
    Name is required for uninitialized sections.  */
 
 static void
-tic54x_clink (ignored)
-     int ignored ATTRIBUTE_UNUSED;
+tic54x_clink (int ignored ATTRIBUTE_UNUSED)
 {
   segT seg = now_seg;
 
 {
   segT seg = now_seg;
 
@@ -1850,6 +1832,7 @@ tic54x_clink (ignored)
     {
       char *section_name = ++input_line_pointer;
       char *name;
     {
       char *section_name = ++input_line_pointer;
       char *name;
+
       while (is_a_char (next_char_of_string ()))
        ;
       know (input_line_pointer[-1] == '\"');
       while (is_a_char (next_char_of_string ()))
        ;
       know (input_line_pointer[-1] == '\"');
@@ -1876,7 +1859,7 @@ tic54x_clink (ignored)
        }
     }
 
        }
     }
 
-  seg->flags |= SEC_CLINK;
+  seg->flags |= SEC_TIC54X_CLINK;
 
   demand_empty_rest_of_line ();
 }
 
   demand_empty_rest_of_line ();
 }
@@ -1886,8 +1869,7 @@ tic54x_clink (ignored)
    set to "." instead.  */
 
 static void
    set to "." instead.  */
 
 static void
-tic54x_set_default_include (dot)
-     int dot;
+tic54x_set_default_include (int dot)
 {
   char *dir = ".";
   char *tmp = NULL;
 {
   char *dir = ".";
   char *tmp = NULL;
@@ -1904,6 +1886,7 @@ tic54x_set_default_include (dot)
   if (tmp != NULL)
     {
       int len;
   if (tmp != NULL)
     {
       int len;
+
       *tmp = '\0';
       len = strlen (dir);
       if (include_dir_count == 0)
       *tmp = '\0';
       len = strlen (dir);
       if (include_dir_count == 0)
@@ -1931,8 +1914,7 @@ tic54x_set_default_include (dot)
    Entering/exiting included/copied file clears all local labels.  */
 
 static void
    Entering/exiting included/copied file clears all local labels.  */
 
 static void
-tic54x_include (ignored)
-     int ignored ATTRIBUTE_UNUSED;
+tic54x_include (int ignored ATTRIBUTE_UNUSED)
 {
   char newblock[] = " .newblock\n";
   char *filename;
 {
   char newblock[] = " .newblock\n";
   char *filename;
@@ -1975,8 +1957,7 @@ tic54x_include (ignored)
 }
 
 static void
 }
 
 static void
-tic54x_message (type)
-     int type;
+tic54x_message (int type)
 {
   char *msg;
   char c;
 {
   char *msg;
   char c;
@@ -2022,20 +2003,19 @@ tic54x_message (type)
    run address (vma).  */
 
 static void
    run address (vma).  */
 
 static void
-tic54x_label (ignored)
-     int ignored ATTRIBUTE_UNUSED;
+tic54x_label (int ignored ATTRIBUTE_UNUSED)
 {
 {
-  char *name = input_line_pointer;
+  char *name;
   symbolS *symbolP;
   int c;
 
   ILLEGAL_WITHIN_STRUCT ();
 
   symbolS *symbolP;
   int c;
 
   ILLEGAL_WITHIN_STRUCT ();
 
-  c = get_symbol_end ();
+  c = get_symbol_name (&name);
   symbolP = colon (name);
   S_SET_STORAGE_CLASS (symbolP, C_STATLAB);
 
   symbolP = colon (name);
   S_SET_STORAGE_CLASS (symbolP, C_STATLAB);
 
-  *input_line_pointer = c;
+  (void) restore_line_pointer (c);
   demand_empty_rest_of_line ();
 }
 
   demand_empty_rest_of_line ();
 }
 
@@ -2044,8 +2024,7 @@ tic54x_label (ignored)
    absolute local symbols.  */
 
 static void
    absolute local symbols.  */
 
 static void
-tic54x_mmregs (ignored)
-     int ignored ATTRIBUTE_UNUSED;
+tic54x_mmregs (int ignored ATTRIBUTE_UNUSED)
 {
   symbol *sym;
 
 {
   symbol *sym;
 
@@ -2078,8 +2057,7 @@ tic54x_loop (int count)
 /* Normally, endloop gets eaten by the preceding loop.  */
 
 static void
 /* Normally, endloop gets eaten by the preceding loop.  */
 
 static void
-tic54x_endloop (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+tic54x_endloop (int ignore ATTRIBUTE_UNUSED)
 {
   as_bad (_("ENDLOOP without corresponding LOOP"));
   ignore_rest_of_line ();
 {
   as_bad (_("ENDLOOP without corresponding LOOP"));
   ignore_rest_of_line ();
@@ -2088,8 +2066,7 @@ tic54x_endloop (ignore)
 /* .break [condition].  */
 
 static void
 /* .break [condition].  */
 
 static void
-tic54x_break (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+tic54x_break (int ignore ATTRIBUTE_UNUSED)
 {
   int cond = 1;
 
 {
   int cond = 1;
 
@@ -2104,8 +2081,7 @@ tic54x_break (ignore)
 }
 
 static void
 }
 
 static void
-set_address_mode (mode)
-     int mode;
+set_address_mode (int mode)
 {
   amode = mode;
   if (mode == far_mode)
 {
   amode = mode;
   if (mode == far_mode)
@@ -2118,9 +2094,9 @@ set_address_mode (mode)
 }
 
 static int address_mode_needs_set = 1;
 }
 
 static int address_mode_needs_set = 1;
+
 static void
 static void
-tic54x_address_mode (mode)
-     int mode;
+tic54x_address_mode (int mode)
 {
   if (assembly_begun && amode != (unsigned) mode)
     {
 {
   if (assembly_begun && amode != (unsigned) mode)
     {
@@ -2143,8 +2119,7 @@ tic54x_address_mode (mode)
    Designate initialized sections for blocking.  */
 
 static void
    Designate initialized sections for blocking.  */
 
 static void
-tic54x_sblock (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+tic54x_sblock (int ignore ATTRIBUTE_UNUSED)
 {
   int c = ',';
 
 {
   int c = ',';
 
@@ -2158,15 +2133,17 @@ tic54x_sblock (ignore)
       if (*input_line_pointer == '"')
        {
          int len;
       if (*input_line_pointer == '"')
        {
          int len;
+
          name = demand_copy_C_string (&len);
        }
       else
        {
          name = demand_copy_C_string (&len);
        }
       else
        {
-         char *section_name = input_line_pointer;
-         c = get_symbol_end ();
+         char *section_name;
+
+         c = get_symbol_name (&section_name);
          name = xmalloc (strlen (section_name) + 1);
          strcpy (name, section_name);
          name = xmalloc (strlen (section_name) + 1);
          strcpy (name, section_name);
-         *input_line_pointer = c;
+         (void) restore_line_pointer (c);
        }
 
       seg = bfd_get_section_by_name (stdoutput, name);
        }
 
       seg = bfd_get_section_by_name (stdoutput, name);
@@ -2182,7 +2159,7 @@ tic54x_sblock (ignore)
          ignore_rest_of_line ();
          return;
        }
          ignore_rest_of_line ();
          return;
        }
-      seg->flags |= SEC_BLOCK;
+      seg->flags |= SEC_TIC54X_BLOCK;
 
       c = *input_line_pointer;
       if (!is_end_of_line[(int) c])
 
       c = *input_line_pointer;
       if (!is_end_of_line[(int) c])
@@ -2199,8 +2176,7 @@ tic54x_sblock (ignore)
    symbols assigned with .set/.equ may not be redefined.  */
 
 static void
    symbols assigned with .set/.equ may not be redefined.  */
 
 static void
-tic54x_set (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+tic54x_set (int ignore ATTRIBUTE_UNUSED)
 {
   symbolS *symbolP;
   char *name;
 {
   symbolS *symbolP;
   char *name;
@@ -2255,8 +2231,7 @@ tic54x_sslist (int show)
    Define a substitution string to be local to a macro.  */
 
 static void
    Define a substitution string to be local to a macro.  */
 
 static void
-tic54x_var (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+tic54x_var (int ignore ATTRIBUTE_UNUSED)
 {
   static char empty[] = "";
   char *name;
 {
   static char empty[] = "";
   char *name;
@@ -2272,18 +2247,17 @@ tic54x_var (ignore)
     }
   do
     {
     }
   do
     {
-      if (!isalpha (*input_line_pointer))
+      if (!ISALPHA (*input_line_pointer))
        {
          as_bad (_("Substitution symbols must begin with a letter"));
          ignore_rest_of_line ();
          return;
        }
        {
          as_bad (_("Substitution symbols must begin with a letter"));
          ignore_rest_of_line ();
          return;
        }
-      name = input_line_pointer;
-      c = get_symbol_end ();
+      c = get_symbol_name (&name);
       /* .var symbols start out with a null string.  */
       name = strcpy (xmalloc (strlen (name) + 1), name);
       hash_insert (subsym_hash[macro_level], name, empty);
       /* .var symbols start out with a null string.  */
       name = strcpy (xmalloc (strlen (name) + 1), name);
       hash_insert (subsym_hash[macro_level], name, empty);
-      *input_line_pointer = c;
+      c = restore_line_pointer (c);
       if (c == ',')
        {
          ++input_line_pointer;
       if (c == ',')
        {
          ++input_line_pointer;
@@ -2304,8 +2278,7 @@ tic54x_var (ignore)
    FIXME need to try the source file directory as well.  */
 
 static void
    FIXME need to try the source file directory as well.  */
 
 static void
-tic54x_mlib (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+tic54x_mlib (int ignore ATTRIBUTE_UNUSED)
 {
   char *filename;
   char *path;
 {
   char *filename;
   char *path;
@@ -2325,7 +2298,7 @@ tic54x_mlib (ignore)
       SKIP_WHITESPACE ();
       len = 0;
       while (!is_end_of_line[(int) *input_line_pointer]
       SKIP_WHITESPACE ();
       len = 0;
       while (!is_end_of_line[(int) *input_line_pointer]
-            && !isspace (*input_line_pointer))
+            && !ISSPACE (*input_line_pointer))
        {
          obstack_1grow (&notes, *input_line_pointer);
          ++input_line_pointer;
        {
          obstack_1grow (&notes, *input_line_pointer);
          ++input_line_pointer;
@@ -2338,9 +2311,11 @@ tic54x_mlib (ignore)
 
   tic54x_set_default_include (0);
   path = xmalloc ((unsigned long) len + include_dir_maxlen + 5);
 
   tic54x_set_default_include (0);
   path = xmalloc ((unsigned long) len + include_dir_maxlen + 5);
+
   for (i = 0; i < include_dir_count; i++)
     {
       FILE *try;
   for (i = 0; i < include_dir_count; i++)
     {
       FILE *try;
+
       strcpy (path, include_dirs[i]);
       strcat (path, "/");
       strcat (path, filename);
       strcpy (path, include_dirs[i]);
       strcat (path, "/");
       strcat (path, filename);
@@ -2350,6 +2325,7 @@ tic54x_mlib (ignore)
          break;
        }
     }
          break;
        }
     }
+
   if (i >= include_dir_count)
     {
       free (path);
   if (i >= include_dir_count)
     {
       free (path);
@@ -2365,8 +2341,8 @@ tic54x_mlib (ignore)
   abfd = bfd_openr (path, NULL);
   if (!abfd)
     {
   abfd = bfd_openr (path, NULL);
   if (!abfd)
     {
-      as_bad (_("Can't open macro library file '%s' for reading."), path);
-      as_perror ("%s", path);
+      as_bad (_("can't open macro library file '%s' for reading: %s"),
+             path, bfd_errmsg (bfd_get_error ()));
       ignore_rest_of_line ();
       return;
     }
       ignore_rest_of_line ();
       return;
     }
@@ -2388,13 +2364,13 @@ tic54x_mlib (ignore)
       FILE *ftmp;
 
       /* We're not sure how big it is, but it will be smaller than "size".  */
       FILE *ftmp;
 
       /* We're not sure how big it is, but it will be smaller than "size".  */
-      bfd_read (buf, size, 1, mbfd);
+      size = bfd_bread (buf, size, mbfd);
 
       /* Write to a temporary file, then use s_include to include it
         a bit of a hack.  */
       ftmp = fopen (fname, "w+b");
       fwrite ((void *) buf, size, 1, ftmp);
 
       /* Write to a temporary file, then use s_include to include it
         a bit of a hack.  */
       ftmp = fopen (fname, "w+b");
       fwrite ((void *) buf, size, 1, ftmp);
-      if (buf[size - 1] != '\n')
+      if (size == 0 || buf[size - 1] != '\n')
        fwrite ("\n", 1, 1, ftmp);
       fclose (ftmp);
       free (buf);
        fwrite ("\n", 1, 1, ftmp);
       fclose (ftmp);
       free (buf);
@@ -2407,6 +2383,8 @@ const pseudo_typeS md_pseudo_table[] =
 {
   { "algebraic", s_ignore                 ,          0 },
   { "align"    , tic54x_align_words       ,        128 },
 {
   { "algebraic", s_ignore                 ,          0 },
   { "align"    , tic54x_align_words       ,        128 },
+  { "ascii"    , tic54x_stringer          ,        'p' },
+  { "asciz"    , tic54x_stringer          ,        'P' },
   { "even"     , tic54x_align_words       ,          2 },
   { "asg"      , tic54x_asg               ,          0 },
   { "eval"     , tic54x_eval              ,          0 },
   { "even"     , tic54x_align_words       ,          2 },
   { "asg"      , tic54x_asg               ,          0 },
   { "eval"     , tic54x_eval              ,          0 },
@@ -2427,9 +2405,6 @@ const pseudo_typeS md_pseudo_table[] =
   { "emsg"     , tic54x_message           ,        'e' },
   { "mmsg"     , tic54x_message           ,        'm' },
   { "wmsg"     , tic54x_message           ,        'w' },
   { "emsg"     , tic54x_message           ,        'e' },
   { "mmsg"     , tic54x_message           ,        'm' },
   { "wmsg"     , tic54x_message           ,        'w' },
-#if 0
-  { "end"      , s_end                    ,          0 },
-#endif
   { "far_mode" , tic54x_address_mode      ,   far_mode },
   { "fclist"   , tic54x_fclist            ,          1 },
   { "fcnolist" , tic54x_fclist            ,          0 },
   { "far_mode" , tic54x_address_mode      ,   far_mode },
   { "fclist"   , tic54x_fclist            ,          1 },
   { "fcnolist" , tic54x_fclist            ,          0 },
@@ -2455,10 +2430,6 @@ const pseudo_typeS md_pseudo_table[] =
                                                              address.  */
   { "length"   , s_ignore                 ,          0 },
   { "width"    , s_ignore                 ,          0 },
                                                              address.  */
   { "length"   , s_ignore                 ,          0 },
   { "width"    , s_ignore                 ,          0 },
-#if 0
-  { "list"     , listing_list             ,          1 },
-  { "nolist"   , listing_list             ,          0 },
-#endif
   { "long"     , tic54x_cons              ,        'l' },
   { "ulong"    , tic54x_cons              ,        'L' },
   { "xlong"    , tic54x_cons              ,        'x' },
   { "long"     , tic54x_cons              ,        'l' },
   { "ulong"    , tic54x_cons              ,        'L' },
   { "xlong"    , tic54x_cons              ,        'x' },
@@ -2472,9 +2443,6 @@ const pseudo_typeS md_pseudo_table[] =
   { "newblock" , tic54x_clear_local_labels,          0 },
   { "option"   , s_ignore                 ,          0 },
   { "p2align"  , tic54x_p2align           ,          0 },
   { "newblock" , tic54x_clear_local_labels,          0 },
   { "option"   , s_ignore                 ,          0 },
   { "p2align"  , tic54x_p2align           ,          0 },
-#if 0
-  { "page"     , listing_eject            ,          0 },
-#endif
   { "sblock"   , tic54x_sblock            ,          0 },
   { "sect"     , tic54x_sect              ,        '*' },
   { "set"      , tic54x_set               ,          0 },
   { "sblock"   , tic54x_sblock            ,          0 },
   { "sect"     , tic54x_sect              ,        '*' },
   { "set"      , tic54x_set               ,          0 },
@@ -2490,9 +2458,6 @@ const pseudo_typeS md_pseudo_table[] =
   { "endstruct", tic54x_endstruct         ,          0 },
   { "tab"      , s_ignore                 ,          0 },
   { "text"     , tic54x_sect              ,        't' },
   { "endstruct", tic54x_endstruct         ,          0 },
   { "tab"      , s_ignore                 ,          0 },
   { "text"     , tic54x_sect              ,        't' },
-#if 0
-  { "title"    , listing_title            ,          0 },
-#endif
   { "union"    , tic54x_struct            ,          1 },
   { "endunion" , tic54x_endstruct         ,          1 },
   { "usect"    , tic54x_usect             ,          0 },
   { "union"    , tic54x_struct            ,          1 },
   { "endunion" , tic54x_endstruct         ,          1 },
   { "usect"    , tic54x_usect             ,          0 },
@@ -2501,25 +2466,8 @@ const pseudo_typeS md_pseudo_table[] =
   {0           , 0                        ,          0 }
 };
 
   {0           , 0                        ,          0 }
 };
 
-#if 0
-/* For debugging, strings for each operand type.  */
-static const char *optypes[] =
-{
-  "none", "Xmem", "Ymem", "pmad", "dmad", "Smem", "Lmem", "MMR", "PA",
-  "Sind", "xpmad", "xpmad+", "MMRX", "MMRY",
-  "SRC1", "SRC", "RND", "DST",
-  "ARX",
-  "SHIFT", "SHFT",
-  "B", "A", "lk", "TS", "k8", "16", "BITC", "CC", "CC2", "CC3", "123", "031",
-  "k5", "k8u", "ASM", "T", "DP", "ARP", "k3", "lku", "N", "SBIT", "12",
-  "k9", "TRN",
-};
-#endif
-
 int
 int
-md_parse_option (c, arg)
-     int c;
-     char *arg;
+md_parse_option (int c, char *arg)
 {
   switch (c)
     {
 {
   switch (c)
     {
@@ -2528,6 +2476,7 @@ md_parse_option (c, arg)
     case OPTION_COFF_VERSION:
       {
        int version = atoi (arg);
     case OPTION_COFF_VERSION:
       {
        int version = atoi (arg);
+
        if (version != 0 && version != 1 && version != 2)
          as_fatal (_("Bad COFF version '%s'"), arg);
        /* FIXME -- not yet implemented.  */
        if (version != 0 && version != 1 && version != 2)
          as_fatal (_("Bad COFF version '%s'"), arg);
        /* FIXME -- not yet implemented.  */
@@ -2549,6 +2498,7 @@ md_parse_option (c, arg)
       {
        char *filename = arg;
        FILE *fp = fopen (filename, "w+");
       {
        char *filename = arg;
        FILE *fp = fopen (filename, "w+");
+
        if (fp == NULL)
          as_fatal (_("Can't redirect stderr to the file '%s'"), filename);
        fclose (fp);
        if (fp == NULL)
          as_fatal (_("Can't redirect stderr to the file '%s'"), filename);
        fclose (fp);
@@ -2567,7 +2517,7 @@ md_parse_option (c, arg)
    deleting the local label hash between macro invocations.  */
 
 void
    deleting the local label hash between macro invocations.  */
 
 void
-tic54x_macro_start ()
+tic54x_macro_start (void)
 {
   ++macro_level;
   subsym_hash[macro_level] = hash_new ();
 {
   ++macro_level;
   subsym_hash[macro_level] = hash_new ();
@@ -2575,29 +2525,9 @@ tic54x_macro_start ()
 }
 
 void
 }
 
 void
-tic54x_macro_info (info)
-     void *info;
+tic54x_macro_info (const macro_entry *macro)
 {
 {
-  struct formal_struct
-  {
-    struct formal_struct *next;        /* Next formal in list  */
-    sb name;                   /* Name of the formal  */
-    sb def;                    /* The default value  */
-    sb actual;                 /* The actual argument (changed on
-                                   each expansion) */
-    int index;                 /* The index of the formal
-                                   0 .. formal_count - 1 */
-  } *entry;
-  struct macro_struct
-  {
-    sb sub;                    /* Substitution text.  */
-    int formal_count;          /* Number of formal args.  */
-    struct formal_struct *formals;     /* Pointer to list of
-                                           formal_structs.  */
-    struct hash_control *formal_hash; /* Hash table of formals.  */
-  } *macro;
-
-  macro = (struct macro_struct *) info;
+  const formal_entry *entry;
 
   /* Put the formal args into the substitution symbol table.  */
   for (entry = macro->formals; entry; entry = entry->next)
 
   /* Put the formal args into the substitution symbol table.  */
   for (entry = macro->formals; entry; entry = entry->next)
@@ -2606,6 +2536,7 @@ tic54x_macro_info (info)
                            entry->name.ptr, entry->name.len);
       char *value = strncpy (xmalloc (entry->actual.len + 1),
                             entry->actual.ptr, entry->actual.len);
                            entry->name.ptr, entry->name.len);
       char *value = strncpy (xmalloc (entry->actual.len + 1),
                             entry->actual.ptr, entry->actual.len);
+
       name[entry->name.len] = '\0';
       value[entry->actual.len] = '\0';
       hash_insert (subsym_hash[macro_level], name, value);
       name[entry->name.len] = '\0';
       value[entry->actual.len] = '\0';
       hash_insert (subsym_hash[macro_level], name, value);
@@ -2615,7 +2546,7 @@ tic54x_macro_info (info)
 /* Get rid of this macro's .var's, arguments, and local labels.  */
 
 void
 /* Get rid of this macro's .var's, arguments, and local labels.  */
 
 void
-tic54x_macro_end ()
+tic54x_macro_end (void)
 {
   hash_die (subsym_hash[macro_level]);
   subsym_hash[macro_level] = NULL;
 {
   hash_die (subsym_hash[macro_level]);
   subsym_hash[macro_level] = NULL;
@@ -2625,9 +2556,7 @@ tic54x_macro_end ()
 }
 
 static int
 }
 
 static int
-subsym_symlen (a, ignore)
-     char *a;
-     char *ignore ATTRIBUTE_UNUSED;
+subsym_symlen (char *a, char *ignore ATTRIBUTE_UNUSED)
 {
   return strlen (a);
 }
 {
   return strlen (a);
 }
@@ -2635,20 +2564,16 @@ subsym_symlen (a, ignore)
 /* Compare symbol A to string B.  */
 
 static int
 /* Compare symbol A to string B.  */
 
 static int
-subsym_symcmp (a, b)
-     char *a;
-     char *b;
+subsym_symcmp (char *a, char *b)
 {
   return strcmp (a, b);
 }
 
 {
   return strcmp (a, b);
 }
 
-/* Return the index of the first occurence of B in A, or zero if none
+/* Return the index of the first occurrence of B in A, or zero if none
    assumes b is an integer char value as a string.  Index is one-based.  */
 
 static int
    assumes b is an integer char value as a string.  Index is one-based.  */
 
 static int
-subsym_firstch (a, b)
-     char *a;
-     char *b;
+subsym_firstch (char *a, char *b)
 {
   int val = atoi (b);
   char *tmp = strchr (a, val);
 {
   int val = atoi (b);
   char *tmp = strchr (a, val);
@@ -2659,9 +2584,7 @@ subsym_firstch (a, b)
 /* Similar to firstch, but returns index of last occurrence of B in A.  */
 
 static int
 /* Similar to firstch, but returns index of last occurrence of B in A.  */
 
 static int
-subsym_lastch (a, b)
-     char *a;
-     char *b;
+subsym_lastch (char *a, char *b)
 {
   int val = atoi (b);
   char *tmp = strrchr (a, val);
 {
   int val = atoi (b);
   char *tmp = strrchr (a, val);
@@ -2673,9 +2596,7 @@ subsym_lastch (a, b)
    symbol table).  */
 
 static int
    symbol table).  */
 
 static int
-subsym_isdefed (a, ignore)
-     char *a;
-     char *ignore ATTRIBUTE_UNUSED;
+subsym_isdefed (char *a, char *ignore ATTRIBUTE_UNUSED)
 {
   symbolS *symbolP = symbol_find (a);
 
 {
   symbolS *symbolP = symbol_find (a);
 
@@ -2687,9 +2608,7 @@ subsym_isdefed (a, ignore)
    symbols, unsubstituted.  */
 
 static int
    symbols, unsubstituted.  */
 
 static int
-subsym_ismember (sym, list)
-     char *sym;
-     char *list;
+subsym_ismember (char *sym, char *list)
 {
   char *elem, *ptr, *listv;
 
 {
   char *elem, *ptr, *listv;
 
@@ -2727,19 +2646,17 @@ subsym_ismember (sym, list)
    5 if decimal.  */
 
 static int
    5 if decimal.  */
 
 static int
-subsym_iscons (a, ignore)
-     char *a;
-     char *ignore ATTRIBUTE_UNUSED;
+subsym_iscons (char *a, char *ignore ATTRIBUTE_UNUSED)
 {
 {
-  expressionS exp;
+  expressionS expn;
 
 
-  parse_expression (a, &exp);
+  parse_expression (a, &expn);
 
 
-  if (exp.X_op == O_constant)
+  if (expn.X_op == O_constant)
     {
       int len = strlen (a);
 
     {
       int len = strlen (a);
 
-      switch (toupper (a[len - 1]))
+      switch (TOUPPER (a[len - 1]))
        {
        case 'B':
          return 1;
        {
        case 'B':
          return 1;
@@ -2755,7 +2672,7 @@ subsym_iscons (a, ignore)
       /* No suffix; either octal, hex, or decimal.  */
       if (*a == '0' && len > 1)
        {
       /* No suffix; either octal, hex, or decimal.  */
       if (*a == '0' && len > 1)
        {
-         if (toupper (a[1]) == 'X')
+         if (TOUPPER (a[1]) == 'X')
            return 3;
          return 2;
        }
            return 3;
          return 2;
        }
@@ -2768,9 +2685,7 @@ subsym_iscons (a, ignore)
 /* Return 1 if A is a valid symbol name.  Expects string input.   */
 
 static int
 /* Return 1 if A is a valid symbol name.  Expects string input.   */
 
 static int
-subsym_isname (a, ignore)
-     char *a;
-     char *ignore ATTRIBUTE_UNUSED;
+subsym_isname (char *a, char *ignore ATTRIBUTE_UNUSED)
 {
   if (!is_name_beginner (*a))
     return 0;
 {
   if (!is_name_beginner (*a))
     return 0;
@@ -2788,9 +2703,7 @@ subsym_isname (a, ignore)
    Note this does not recognize "A" or "B" accumulators.  */
 
 static int
    Note this does not recognize "A" or "B" accumulators.  */
 
 static int
-subsym_isreg (a, ignore)
-     char *a;
-     char *ignore ATTRIBUTE_UNUSED;
+subsym_isreg (char *a, char *ignore ATTRIBUTE_UNUSED)
 {
   if (hash_find (reg_hash, a))
     return 1;
 {
   if (hash_find (reg_hash, a))
     return 1;
@@ -2799,14 +2712,13 @@ subsym_isreg (a, ignore)
   return 0;
 }
 
   return 0;
 }
 
-/* Return the structrure size, given the stag.  */
+/* Return the structure size, given the stag.  */
 
 static int
 
 static int
-subsym_structsz (name, ignore)
-     char *name;
-     char *ignore ATTRIBUTE_UNUSED;
+subsym_structsz (char *name, char *ignore ATTRIBUTE_UNUSED)
 {
   struct stag *stag = (struct stag *) hash_find (stag_hash, name);
 {
   struct stag *stag = (struct stag *) hash_find (stag_hash, name);
+
   if (stag)
     return stag->size;
 
   if (stag)
     return stag->size;
 
@@ -2821,33 +2733,26 @@ subsym_structsz (name, ignore)
    return zero, we punt and return zero.  */
 
 static int
    return zero, we punt and return zero.  */
 
 static int
-subsym_structacc (stag_name, ignore)
-     char *stag_name ATTRIBUTE_UNUSED;
-     char *ignore ATTRIBUTE_UNUSED;
+subsym_structacc (char *stag_name ATTRIBUTE_UNUSED,
+                 char *ignore ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 
 static float
 {
   return 0;
 }
 
 static float
-math_ceil (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_ceil (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) ceil (arg1);
 }
 
 static float
 {
   return (float) ceil (arg1);
 }
 
 static float
-math_cvi (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_cvi (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (int) arg1;
 }
 
 static float
 {
   return (int) arg1;
 }
 
 static float
-math_floor (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_floor (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) floor (arg1);
 }
 {
   return (float) floor (arg1);
 }
@@ -2859,57 +2764,43 @@ math_fmod (float arg1, float arg2)
 }
 
 static float
 }
 
 static float
-math_int (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_int (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return ((float) ((int) arg1)) == arg1;
 }
 
 static float
 {
   return ((float) ((int) arg1)) == arg1;
 }
 
 static float
-math_round (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_round (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return arg1 > 0 ? (int) (arg1 + 0.5) : (int) (arg1 - 0.5);
 }
 
 static float
 {
   return arg1 > 0 ? (int) (arg1 + 0.5) : (int) (arg1 - 0.5);
 }
 
 static float
-math_sgn (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_sgn (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (arg1 < 0) ? -1 : (arg1 ? 1 : 0);
 }
 
 static float
 {
   return (arg1 < 0) ? -1 : (arg1 ? 1 : 0);
 }
 
 static float
-math_trunc (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_trunc (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (int) arg1;
 }
 
 static float
 {
   return (int) arg1;
 }
 
 static float
-math_acos (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_acos (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) acos (arg1);
 }
 
 static float
 {
   return (float) acos (arg1);
 }
 
 static float
-math_asin (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_asin (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) asin (arg1);
 }
 
 static float
 {
   return (float) asin (arg1);
 }
 
 static float
-math_atan (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_atan (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) atan (arg1);
 }
 {
   return (float) atan (arg1);
 }
@@ -2921,41 +2812,31 @@ math_atan2 (float arg1, float arg2)
 }
 
 static float
 }
 
 static float
-math_cosh (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_cosh (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) cosh (arg1);
 }
 
 static float
 {
   return (float) cosh (arg1);
 }
 
 static float
-math_cos (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_cos (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) cos (arg1);
 }
 
 static float
 {
   return (float) cos (arg1);
 }
 
 static float
-math_cvf (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_cvf (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) arg1;
 }
 
 static float
 {
   return (float) arg1;
 }
 
 static float
-math_exp (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_exp (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) exp (arg1);
 }
 
 static float
 {
   return (float) exp (arg1);
 }
 
 static float
-math_fabs (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_fabs (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) fabs (arg1);
 }
 {
   return (float) fabs (arg1);
 }
@@ -2969,17 +2850,13 @@ math_ldexp (float arg1, float arg2)
 }
 
 static float
 }
 
 static float
-math_log10 (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_log10 (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) log10 (arg1);
 }
 
 static float
 {
   return (float) log10 (arg1);
 }
 
 static float
-math_log (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_log (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) log (arg1);
 }
 {
   return (float) log (arg1);
 }
@@ -3003,41 +2880,31 @@ math_pow (float arg1, float arg2)
 }
 
 static float
 }
 
 static float
-math_sin (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_sin (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) sin (arg1);
 }
 
 static float
 {
   return (float) sin (arg1);
 }
 
 static float
-math_sinh (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_sinh (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) sinh (arg1);
 }
 
 static float
 {
   return (float) sinh (arg1);
 }
 
 static float
-math_sqrt (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_sqrt (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) sqrt (arg1);
 }
 
 static float
 {
   return (float) sqrt (arg1);
 }
 
 static float
-math_tan (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_tan (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) tan (arg1);
 }
 
 static float
 {
   return (float) tan (arg1);
 }
 
 static float
-math_tanh (arg1, ignore)
-     float arg1;
-     float ignore ATTRIBUTE_UNUSED;
+math_tanh (float arg1, float ignore ATTRIBUTE_UNUSED)
 {
   return (float) tanh (arg1);
 }
 {
   return (float) tanh (arg1);
 }
@@ -3112,10 +2979,9 @@ static const math_proc_entry math_procs[] =
 };
 
 void
 };
 
 void
-md_begin ()
+md_begin (void)
 {
 {
-  template *opcode;
-  partemplate *paropcode;
+  insn_template *tm;
   symbol *sym;
   const subsym_proc_entry *subsym_proc;
   const math_proc_entry *math_proc;
   symbol *sym;
   const subsym_proc_entry *subsym_proc;
   const math_proc_entry *math_proc;
@@ -3126,13 +2992,15 @@ md_begin ()
 
   local_label_id = 0;
 
 
   local_label_id = 0;
 
-  /* Look for A_DIR and add it to the include list.  */
+  /* Look for A_DIR and add it to the include list.  */
   if (A_DIR != NULL)
     {
       char *tmp = xstrdup (A_DIR);
   if (A_DIR != NULL)
     {
       char *tmp = xstrdup (A_DIR);
+
       do
        {
          char *next = strchr (tmp, ';');
       do
        {
          char *next = strchr (tmp, ';');
+
          if (next)
            *next++ = '\0';
          add_include_dir (tmp);
          if (next)
            *next++ = '\0';
          add_include_dir (tmp);
@@ -3142,26 +3010,24 @@ md_begin ()
     }
 
   op_hash = hash_new ();
     }
 
   op_hash = hash_new ();
-  for (opcode = (template *) tic54x_optab; opcode->name; opcode++)
+  for (tm = (insn_template *) tic54x_optab; tm->name; tm++)
     {
     {
-      if (hash_find (op_hash, opcode->name))
+      if (hash_find (op_hash, tm->name))
        continue;
        continue;
-      hash_err = hash_insert (op_hash, opcode->name, (char *) opcode);
+      hash_err = hash_insert (op_hash, tm->name, (char *) tm);
       if (hash_err)
        as_fatal ("Internal Error: Can't hash %s: %s",
       if (hash_err)
        as_fatal ("Internal Error: Can't hash %s: %s",
-                 opcode->name, hash_err);
+                 tm->name, hash_err);
     }
   parop_hash = hash_new ();
     }
   parop_hash = hash_new ();
-  for (paropcode = (partemplate *) tic54x_paroptab;
-       paropcode->name;
-       paropcode++)
+  for (tm = (insn_template *) tic54x_paroptab; tm->name; tm++)
     {
     {
-      if (hash_find (parop_hash, paropcode->name))
+      if (hash_find (parop_hash, tm->name))
        continue;
        continue;
-      hash_err = hash_insert (parop_hash, paropcode->name, (char *) paropcode);
+      hash_err = hash_insert (parop_hash, tm->name, (char *) tm);
       if (hash_err)
        as_fatal ("Internal Error: Can't hash %s: %s",
       if (hash_err)
        as_fatal ("Internal Error: Can't hash %s: %s",
-                 paropcode->name, hash_err);
+                 tm->name, hash_err);
     }
   reg_hash = hash_new ();
   for (sym = (symbol *) regs; sym->name; sym++)
     }
   reg_hash = hash_new ();
   for (sym = (symbol *) regs; sym->name; sym++)
@@ -3177,43 +3043,36 @@ md_begin ()
     hash_err = hash_insert (reg_hash, sym->name, (char *) sym);
   mmreg_hash = hash_new ();
   for (sym = (symbol *) mmregs; sym->name; sym++)
     hash_err = hash_insert (reg_hash, sym->name, (char *) sym);
   mmreg_hash = hash_new ();
   for (sym = (symbol *) mmregs; sym->name; sym++)
-    {
-      hash_err = hash_insert (mmreg_hash, sym->name, (char *) sym);
-    }
+    hash_err = hash_insert (mmreg_hash, sym->name, (char *) sym);
+
   cc_hash = hash_new ();
   for (sym = (symbol *) condition_codes; sym->name; sym++)
   cc_hash = hash_new ();
   for (sym = (symbol *) condition_codes; sym->name; sym++)
-    {
-      hash_err = hash_insert (cc_hash, sym->name, (char *) sym);
-    }
+    hash_err = hash_insert (cc_hash, sym->name, (char *) sym);
+
   cc2_hash = hash_new ();
   for (sym = (symbol *) cc2_codes; sym->name; sym++)
   cc2_hash = hash_new ();
   for (sym = (symbol *) cc2_codes; sym->name; sym++)
-    {
-      hash_err = hash_insert (cc2_hash, sym->name, (char *) sym);
-    }
+    hash_err = hash_insert (cc2_hash, sym->name, (char *) sym);
+
   cc3_hash = hash_new ();
   for (sym = (symbol *) cc3_codes; sym->name; sym++)
   cc3_hash = hash_new ();
   for (sym = (symbol *) cc3_codes; sym->name; sym++)
-    {
-      hash_err = hash_insert (cc3_hash, sym->name, (char *) sym);
-    }
+    hash_err = hash_insert (cc3_hash, sym->name, (char *) sym);
+
   sbit_hash = hash_new ();
   for (sym = (symbol *) status_bits; sym->name; sym++)
   sbit_hash = hash_new ();
   for (sym = (symbol *) status_bits; sym->name; sym++)
-    {
-      hash_err = hash_insert (sbit_hash, sym->name, (char *) sym);
-    }
+    hash_err = hash_insert (sbit_hash, sym->name, (char *) sym);
+
   misc_symbol_hash = hash_new ();
   for (symname = (char **) misc_symbols; *symname; symname++)
   misc_symbol_hash = hash_new ();
   for (symname = (char **) misc_symbols; *symname; symname++)
-    {
-      hash_err = hash_insert (misc_symbol_hash, *symname, *symname);
-    }
+    hash_err = hash_insert (misc_symbol_hash, *symname, *symname);
+
   /* Only the base substitution table and local label table are initialized;
      the others (for local macro substitution) get instantiated as needed.  */
   local_label_hash[0] = hash_new ();
   subsym_hash[0] = hash_new ();
   for (subsym_proc = subsym_procs; subsym_proc->name; subsym_proc++)
   /* Only the base substitution table and local label table are initialized;
      the others (for local macro substitution) get instantiated as needed.  */
   local_label_hash[0] = hash_new ();
   subsym_hash[0] = hash_new ();
   for (subsym_proc = subsym_procs; subsym_proc->name; subsym_proc++)
-    {
-      hash_err = hash_insert (subsym_hash[0], subsym_proc->name,
-                             (char *) subsym_proc);
-    }
+    hash_err = hash_insert (subsym_hash[0], subsym_proc->name,
+                           (char *) subsym_proc);
+
   math_hash = hash_new ();
   for (math_proc = math_procs; math_proc->name; math_proc++)
     {
   math_hash = hash_new ();
   for (math_proc = math_procs; math_proc->name; math_proc++)
     {
@@ -3228,49 +3087,8 @@ md_begin ()
   stag_hash = hash_new ();
 }
 
   stag_hash = hash_new ();
 }
 
-typedef struct _tic54x_insn
-{
-  const template *tm;         /* Opcode template.  */
-  const partemplate *ptm;         /* Parallel opcode template.  */
-
-  char mnemonic[MAX_LINE];       /* Opcode name/mnemonic.  */
-  char parmnemonic[MAX_LINE];       /* 2nd mnemonic of parallel insn.  */
-
-  int opcount;
-  struct opstruct
-  {
-    char buf[MAX_LINE];
-    enum optype type;
-    expressionS exp;
-  } operands[MAX_OPERANDS];
-
-  int paropcount;
-  struct opstruct paroperands[MAX_OPERANDS];
-
-  int is_lkaddr;
-  int lkoperand;
-  int words;                   /* Size of insn in 16-bit words.  */
-  int using_default_dst;           /* Do we need to explicitly set an
-                                      omitted OP_DST operand?  */
-  struct
-  {
-    unsigned short word;           /* Final encoded opcode data.  */
-    int unresolved;
-    int r_nchars;                   /* Relocation size.  */
-    bfd_reloc_code_real_type r_type; /* Relocation type.  */
-    expressionS addr_expr;       /* Storage for unresolved expressions.  */
-  } opcode[3];
-} tic54x_insn;
-
-static int encode_operand (tic54x_insn *, enum optype, struct opstruct *);
-static int encode_dmad (tic54x_insn *, struct opstruct *, int);
-static int operands_match (tic54x_insn *, struct opstruct *, int,
-                          const enum optype *, int, int);
-static int encode_address (tic54x_insn *, struct opstruct *);
-
 static int
 static int
-is_accumulator (operand)
-     struct opstruct *operand;
+is_accumulator (struct opstruct *operand)
 {
   return strcasecmp (operand->buf, "a") == 0
     || strcasecmp (operand->buf, "b") == 0;
 {
   return strcasecmp (operand->buf, "a") == 0
     || strcasecmp (operand->buf, "b") == 0;
@@ -3281,9 +3099,7 @@ is_accumulator (operand)
    the next array.  */
 
 static int
    the next array.  */
 
 static int
-get_operands (operands, line)
-     struct opstruct operands[];
-     char *line;
+get_operands (struct opstruct operands[], char *line)
 {
   char *lptr = line;
   int numexp = 0;
 {
   char *lptr = line;
   int numexp = 0;
@@ -3294,7 +3110,8 @@ get_operands (operands, line)
     {
       int paren_not_balanced = 0;
       char *op_start, *op_end;
     {
       int paren_not_balanced = 0;
       char *op_start, *op_end;
-      while (*lptr && isspace (*lptr))
+
+      while (*lptr && ISSPACE (*lptr))
        ++lptr;
       op_start = lptr;
       while (paren_not_balanced || *lptr != ',')
        ++lptr;
       op_start = lptr;
       while (paren_not_balanced || *lptr != ',')
@@ -3303,7 +3120,7 @@ get_operands (operands, line)
            {
              if (paren_not_balanced)
                {
            {
              if (paren_not_balanced)
                {
-                 as_bad ("Unbalanced parenthesis in operand %d", numexp);
+                 as_bad (_("Unbalanced parenthesis in operand %d"), numexp);
                  return -1;
                }
              else
                  return -1;
                }
              else
@@ -3319,12 +3136,13 @@ get_operands (operands, line)
       if (op_end != op_start)
        {
          int len = op_end - op_start;
       if (op_end != op_start)
        {
          int len = op_end - op_start;
+
          strncpy (operands[numexp].buf, op_start, len);
          operands[numexp].buf[len] = 0;
          /* Trim trailing spaces; while the preprocessor gets rid of most,
             there are weird usage patterns that can introduce them
             (i.e. using strings for macro args).  */
          strncpy (operands[numexp].buf, op_start, len);
          operands[numexp].buf[len] = 0;
          /* Trim trailing spaces; while the preprocessor gets rid of most,
             there are weird usage patterns that can introduce them
             (i.e. using strings for macro args).  */
-         while (len > 0 && isspace (operands[numexp].buf[len - 1]))
+         while (len > 0 && ISSPACE (operands[numexp].buf[len - 1]))
            operands[numexp].buf[--len] = 0;
          lptr = op_end;
          ++numexp;
            operands[numexp].buf[--len] = 0;
          lptr = op_end;
          ++numexp;
@@ -3333,7 +3151,7 @@ get_operands (operands, line)
        {
          if (expecting_operand || *lptr == ',')
            {
        {
          if (expecting_operand || *lptr == ',')
            {
-             as_bad ("Expecting operand after ','");
+             as_bad (_("Expecting operand after ','"));
              return -1;
            }
        }
              return -1;
            }
        }
@@ -3341,18 +3159,18 @@ get_operands (operands, line)
        {
          if (*++lptr == '\0')
            {
        {
          if (*++lptr == '\0')
            {
-             as_bad ("Expecting operand after ','");
+             as_bad (_("Expecting operand after ','"));
              return -1;
            }
          expecting_operand = 1;
        }
     }
 
              return -1;
            }
          expecting_operand = 1;
        }
     }
 
-  while (*lptr && isspace (*lptr++))
+  while (*lptr && ISSPACE (*lptr++))
     ;
   if (!is_end_of_line[(int) *lptr])
     {
     ;
   if (!is_end_of_line[(int) *lptr])
     {
-      as_bad ("Extra junk on line");
+      as_bad (_("Extra junk on line"));
       return -1;
     }
 
       return -1;
     }
 
@@ -3374,6 +3192,7 @@ get_operands (operands, line)
        {
          /* Indirect.  */
          char *paren = strchr (operands[i].buf, '(');
        {
          /* Indirect.  */
          char *paren = strchr (operands[i].buf, '(');
+
          /* Allow immediate syntax in the inner expression.  */
          if (paren && paren[1] == '#')
            *++paren = '(';
          /* Allow immediate syntax in the inner expression.  */
          if (paren && paren[1] == '#')
            *++paren = '(';
@@ -3384,6 +3203,7 @@ get_operands (operands, line)
              int len = strlen (paren);
              char *end = paren + len;
              int c;
              int len = strlen (paren);
              char *end = paren + len;
              int c;
+
              while (end[-1] != ')')
                if (--end <= paren)
                  {
              while (end[-1] != ')')
                if (--end <= paren)
                  {
@@ -3408,8 +3228,7 @@ get_operands (operands, line)
 /* Predicates for different operand types.  */
 
 static int
 /* Predicates for different operand types.  */
 
 static int
-is_immediate (operand)
-     struct opstruct *operand;
+is_immediate (struct opstruct *operand)
 {
   return *operand->buf == '#';
 }
 {
   return *operand->buf == '#';
 }
@@ -3418,8 +3237,7 @@ is_immediate (operand)
    and must *not* have the '#' prefix.  */
 
 static int
    and must *not* have the '#' prefix.  */
 
 static int
-is_absolute (operand)
-     struct opstruct *operand;
+is_absolute (struct opstruct *operand)
 {
   return operand->exp.X_op == O_constant && !is_immediate (operand);
 }
 {
   return operand->exp.X_op == O_constant && !is_immediate (operand);
 }
@@ -3427,8 +3245,7 @@ is_absolute (operand)
 /* Is this an indirect operand?  */
 
 static int
 /* Is this an indirect operand?  */
 
 static int
-is_indirect (operand)
-     struct opstruct *operand;
+is_indirect (struct opstruct *operand)
 {
   return operand->buf[0] == '*';
 }
 {
   return operand->buf[0] == '*';
 }
@@ -3436,8 +3253,7 @@ is_indirect (operand)
 /* Is this a valid dual-memory operand?  */
 
 static int
 /* Is this a valid dual-memory operand?  */
 
 static int
-is_dual (operand)
-     struct opstruct *operand;
+is_dual (struct opstruct *operand)
 {
   if (is_indirect (operand) && strncasecmp (operand->buf, "*ar", 3) == 0)
     {
 {
   if (is_indirect (operand) && strncasecmp (operand->buf, "*ar", 3) == 0)
     {
@@ -3457,8 +3273,7 @@ is_dual (operand)
 }
 
 static int
 }
 
 static int
-is_mmreg (operand)
-     struct opstruct *operand;
+is_mmreg (struct opstruct *operand)
 {
   return (is_absolute (operand)
          || is_immediate (operand)
 {
   return (is_absolute (operand)
          || is_immediate (operand)
@@ -3466,9 +3281,7 @@ is_mmreg (operand)
 }
 
 static int
 }
 
 static int
-is_type (operand, type)
-     struct opstruct *operand;
-     enum optype type;
+is_type (struct opstruct *operand, enum optype type)
 {
   switch (type)
     {
 {
   switch (type)
     {
@@ -3501,12 +3314,12 @@ is_type (operand, type)
     case OP_DST:
       return is_accumulator (operand);
     case OP_B:
     case OP_DST:
       return is_accumulator (operand);
     case OP_B:
-      return is_accumulator (operand) && toupper (operand->buf[0]) == 'B';
+      return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'B';
     case OP_A:
     case OP_A:
-      return is_accumulator (operand) && toupper (operand->buf[0]) == 'A';
+      return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'A';
     case OP_ARX:
       return strncasecmp ("ar", operand->buf, 2) == 0
     case OP_ARX:
       return strncasecmp ("ar", operand->buf, 2) == 0
-       && isdigit (operand->buf[2]);
+       && ISDIGIT (operand->buf[2]);
     case OP_SBIT:
       return hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand);
     case OP_CC:
     case OP_SBIT:
       return hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand);
     case OP_CC:
@@ -3572,19 +3385,17 @@ is_type (operand, type)
 }
 
 static int
 }
 
 static int
-operands_match (insn, operands, opcount, refoptype, minops, maxops)
-     tic54x_insn *insn;
-     struct opstruct *operands;
-     int opcount;
-     const enum optype *refoptype;
-     int minops, maxops;
+operands_match (tic54x_insn *insn,
+               struct opstruct *operands,
+               int opcount,
+               const enum optype *refoptype,
+               int minops,
+               int maxops)
 {
   int op = 0, refop = 0;
 
   if (opcount == 0 && minops == 0)
 {
   int op = 0, refop = 0;
 
   if (opcount == 0 && minops == 0)
-    {
-      return 1;
-    }
+    return 1;
 
   while (op <= maxops && refop <= maxops)
     {
 
   while (op <= maxops && refop <= maxops)
     {
@@ -3642,10 +3453,7 @@ operands_match (insn, operands, opcount, refoptype, minops, maxops)
    2 for the upper 7 bits of a 23-bit address (LDX).  */
 
 static int
    2 for the upper 7 bits of a 23-bit address (LDX).  */
 
 static int
-encode_dmad (insn, operand, xpc_code)
-     tic54x_insn *insn;
-     struct opstruct *operand;
-     int xpc_code;
+encode_dmad (tic54x_insn *insn, struct opstruct *operand, int xpc_code)
 {
   int op = 1 + insn->is_lkaddr;
 
 {
   int op = 1 + insn->is_lkaddr;
 
@@ -3661,6 +3469,7 @@ encode_dmad (insn, operand, xpc_code)
   if (insn->opcode[op].addr_expr.X_op == O_constant)
     {
       valueT value = insn->opcode[op].addr_expr.X_add_number;
   if (insn->opcode[op].addr_expr.X_op == O_constant)
     {
       valueT value = insn->opcode[op].addr_expr.X_add_number;
+
       if (xpc_code == 1)
        {
          insn->opcode[0].word &= 0xFF80;
       if (xpc_code == 1)
        {
          insn->opcode[0].word &= 0xFF80;
@@ -3705,9 +3514,7 @@ encode_dmad (insn, operand, xpc_code)
 /* 7-bit direct address encoding.  */
 
 static int
 /* 7-bit direct address encoding.  */
 
 static int
-encode_address (insn, operand)
-     tic54x_insn *insn;
-     struct opstruct *operand;
+encode_address (tic54x_insn *insn, struct opstruct *operand)
 {
   /* Assumes that dma addresses are *always* in word 0 of the opcode.  */
   insn->opcode[0].addr_expr = operand->exp;
 {
   /* Assumes that dma addresses are *always* in word 0 of the opcode.  */
   insn->opcode[0].addr_expr = operand->exp;
@@ -3716,6 +3523,8 @@ encode_address (insn, operand)
     insn->opcode[0].word |= (operand->exp.X_add_number & 0x7F);
   else
     {
     insn->opcode[0].word |= (operand->exp.X_add_number & 0x7F);
   else
     {
+      if (operand->exp.X_op == O_register)
+        as_bad (_("Use the .mmregs directive to use memory-mapped register names such as '%s'"), operand->buf);
       /* Do the fixup later; just store the expression.  */
       insn->opcode[0].r_nchars = 1;
       insn->opcode[0].r_type = BFD_RELOC_TIC54X_PARTLS7;
       /* Do the fixup later; just store the expression.  */
       insn->opcode[0].r_nchars = 1;
       insn->opcode[0].r_type = BFD_RELOC_TIC54X_PARTLS7;
@@ -3726,9 +3535,7 @@ encode_address (insn, operand)
 }
 
 static int
 }
 
 static int
-encode_indirect (insn, operand)
-     tic54x_insn *insn;
-     struct opstruct *operand;
+encode_indirect (tic54x_insn *insn, struct opstruct *operand)
 {
   int arf;
   int mod;
 {
   int arf;
   int mod;
@@ -3736,7 +3543,7 @@ encode_indirect (insn, operand)
   if (insn->is_lkaddr)
     {
       /* lk addresses always go in the second insn word.  */
   if (insn->is_lkaddr)
     {
       /* lk addresses always go in the second insn word.  */
-      mod = ((toupper (operand->buf[1]) == 'A') ? 12 :
+      mod = ((TOUPPER (operand->buf[1]) == 'A') ? 12 :
             (operand->buf[1] == '(') ? 15 :
             (strchr (operand->buf, '%') != NULL) ? 14 : 13);
       arf = ((mod == 12) ? operand->buf[3] - '0' :
             (operand->buf[1] == '(') ? 15 :
             (strchr (operand->buf, '%') != NULL) ? 14 : 13);
       arf = ((mod == 12) ? operand->buf[3] - '0' :
@@ -3761,7 +3568,7 @@ encode_indirect (insn, operand)
     }
   else
     {
     }
   else
     {
-      arf = (toupper (operand->buf[1]) == 'A' ?
+      arf = (TOUPPER (operand->buf[1]) == 'A' ?
             operand->buf[3] : operand->buf[4]) - '0';
 
       if (operand->buf[1] == '+')
             operand->buf[3] : operand->buf[4]) - '0';
 
       if (operand->buf[1] == '+')
@@ -3782,9 +3589,9 @@ encode_indirect (insn, operand)
          else
            mod = (operand->buf[4] == '-' ? 8 : 10);/* *ARx+% / *ARx-%  */
        }
          else
            mod = (operand->buf[4] == '-' ? 8 : 10);/* *ARx+% / *ARx-%  */
        }
-      else if (toupper (operand->buf[6]) == 'B')
+      else if (TOUPPER (operand->buf[6]) == 'B')
        mod = (operand->buf[4] == '-' ? 4 : 7); /* ARx+0B / *ARx-0B  */
        mod = (operand->buf[4] == '-' ? 4 : 7); /* ARx+0B / *ARx-0B  */
-      else if (toupper (operand->buf[6]) == '%')
+      else if (TOUPPER (operand->buf[6]) == '%')
        mod = (operand->buf[4] == '-' ? 9 : 11); /* ARx+0% / *ARx - 0%  */
       else
        {
        mod = (operand->buf[4] == '-' ? 9 : 11); /* ARx+0% / *ARx - 0%  */
       else
        {
@@ -3800,11 +3607,12 @@ encode_indirect (insn, operand)
 }
 
 static int
 }
 
 static int
-encode_integer (insn, operand, which, min, max, mask)
-     tic54x_insn *insn;
-     struct opstruct *operand;
-     int which, min, max;
-     unsigned short mask;
+encode_integer (tic54x_insn *insn,
+               struct opstruct *operand,
+               int which,
+               int min,
+               int max,
+               unsigned short mask)
 {
   long parse, integer;
 
 {
   long parse, integer;
 
@@ -3859,9 +3667,7 @@ encode_integer (insn, operand, which, min, max, mask)
 }
 
 static int
 }
 
 static int
-encode_condition (insn, operand)
-     tic54x_insn *insn;
-     struct opstruct *operand;
+encode_condition (tic54x_insn *insn, struct opstruct *operand)
 {
   symbol *cc = (symbol *) hash_find (cc_hash, operand->buf);
   if (!cc)
 {
   symbol *cc = (symbol *) hash_find (cc_hash, operand->buf);
   if (!cc)
@@ -3907,9 +3713,9 @@ encode_condition (insn, operand)
              return 0;
            }
        }
              return 0;
            }
        }
-      else if (((insn->opcode[0].word & CATG_A2) && (cc->value & CATG_A2)) ||
-              ((insn->opcode[0].word & CATG_B2) && (cc->value & CATG_B2)) ||
-              ((insn->opcode[0].word & CATG_C2) && (cc->value & CATG_C2)))
+      else if (   ((insn->opcode[0].word & CATG_A2) && (cc->value & CATG_A2))
+              || ((insn->opcode[0].word & CATG_B2) && (cc->value & CATG_B2))
+              || ((insn->opcode[0].word & CATG_C2) && (cc->value & CATG_C2)))
        {
          as_bad (_("Duplicate %s conditional"), operand->buf);
          return 0;
        {
          as_bad (_("Duplicate %s conditional"), operand->buf);
          return 0;
@@ -3921,9 +3727,7 @@ encode_condition (insn, operand)
 }
 
 static int
 }
 
 static int
-encode_cc3 (insn, operand)
-     tic54x_insn *insn;
-     struct opstruct *operand;
+encode_cc3 (tic54x_insn *insn, struct opstruct *operand)
 {
   symbol *cc3 = (symbol *) hash_find (cc3_hash, operand->buf);
   int value = cc3 ? cc3->value : operand->exp.X_add_number << 8;
 {
   symbol *cc3 = (symbol *) hash_find (cc3_hash, operand->buf);
   int value = cc3 ? cc3->value : operand->exp.X_add_number << 8;
@@ -3938,11 +3742,10 @@ encode_cc3 (insn, operand)
 }
 
 static int
 }
 
 static int
-encode_arx (insn, operand)
-     tic54x_insn *insn;
-     struct opstruct *operand;
+encode_arx (tic54x_insn *insn, struct opstruct *operand)
 {
   int arf = strlen (operand->buf) >= 3 ? operand->buf[2] - '0' : -1;
 {
   int arf = strlen (operand->buf) >= 3 ? operand->buf[2] - '0' : -1;
+
   if (strncasecmp ("ar", operand->buf, 2) || arf < 0 || arf > 7)
     {
       as_bad (_("Invalid auxiliary register (use AR0-AR7)"));
   if (strncasecmp ("ar", operand->buf, 2) || arf < 0 || arf > 7)
     {
       as_bad (_("Invalid auxiliary register (use AR0-AR7)"));
@@ -3953,11 +3756,10 @@ encode_arx (insn, operand)
 }
 
 static int
 }
 
 static int
-encode_cc2 (insn, operand)
-     tic54x_insn *insn;
-     struct opstruct *operand;
+encode_cc2 (tic54x_insn *insn, struct opstruct *operand)
 {
   symbol *cc2 = (symbol *) hash_find (cc2_hash, operand->buf);
 {
   symbol *cc2 = (symbol *) hash_find (cc2_hash, operand->buf);
+
   if (!cc2)
     {
       as_bad (_("Unrecognized condition code \"%s\""), operand->buf);
   if (!cc2)
     {
       as_bad (_("Unrecognized condition code \"%s\""), operand->buf);
@@ -3968,12 +3770,9 @@ encode_cc2 (insn, operand)
 }
 
 static int
 }
 
 static int
-encode_operand (insn, type, operand)
-     tic54x_insn *insn;
-     enum optype type;
-     struct opstruct *operand;
+encode_operand (tic54x_insn *insn, enum optype type, struct opstruct *operand)
 {
 {
-  int ext = insn->tm && ((insn->tm->flags & FL_EXT) != 0);
+  int ext = (insn->tm->flags & FL_EXT) != 0;
 
   if (type == OP_MMR && operand->exp.X_op != O_constant)
     {
 
   if (type == OP_MMR && operand->exp.X_op != O_constant)
     {
@@ -4002,7 +3801,7 @@ encode_operand (insn, type, operand)
       /* 16-bit immediate value.  */
       return encode_dmad (insn, operand, 0);
     case OP_SRC:
       /* 16-bit immediate value.  */
       return encode_dmad (insn, operand, 0);
     case OP_SRC:
-      if (toupper (*operand->buf) == 'B')
+      if (TOUPPER (*operand->buf) == 'B')
        {
          insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 9);
          if (insn->using_default_dst)
        {
          insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 9);
          if (insn->using_default_dst)
@@ -4010,8 +3809,8 @@ encode_operand (insn, type, operand)
        }
       return 1;
     case OP_RND:
        }
       return 1;
     case OP_RND:
-      /* Make sure this agrees with with the OP_DST operand.  */
-      if (!((toupper (operand->buf[0]) == 'B') ^
+      /* Make sure this agrees with the OP_DST operand.  */
+      if (!((TOUPPER (operand->buf[0]) == 'B') ^
            ((insn->opcode[0].word & (1 << 8)) != 0)))
        {
          as_bad (_("Destination accumulator for each part of this parallel "
            ((insn->opcode[0].word & (1 << 8)) != 0)))
        {
          as_bad (_("Destination accumulator for each part of this parallel "
@@ -4021,7 +3820,7 @@ encode_operand (insn, type, operand)
       return 1;
     case OP_SRC1:
     case OP_DST:
       return 1;
     case OP_SRC1:
     case OP_DST:
-      if (toupper (operand->buf[0]) == 'B')
+      if (TOUPPER (operand->buf[0]) == 'B')
        insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 8);
       return 1;
     case OP_Xmem:
        insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 8);
       return 1;
     case OP_Xmem:
@@ -4194,10 +3993,16 @@ encode_operand (insn, type, operand)
 }
 
 static void
 }
 
 static void
-emit_insn (insn)
-     tic54x_insn *insn;
+emit_insn (tic54x_insn *insn)
 {
   int i;
 {
   int i;
+  flagword oldflags = bfd_get_section_flags (stdoutput, now_seg);
+  flagword flags = oldflags | SEC_CODE;
+
+  if (! bfd_set_section_flags (stdoutput, now_seg, flags))
+        as_warn (_("error setting flags for \"%s\": %s"),
+                 bfd_section_name (stdoutput, now_seg),
+                 bfd_errmsg (bfd_get_error ()));
 
   for (i = 0; i < insn->words; i++)
     {
 
   for (i = 0; i < insn->words; i++)
     {
@@ -4213,7 +4018,7 @@ emit_insn (insn)
       if (insn->opcode[i].unresolved)
        fix_new_exp (frag_now, p - frag_now->fr_literal,
                     insn->opcode[i].r_nchars, &insn->opcode[i].addr_expr,
       if (insn->opcode[i].unresolved)
        fix_new_exp (frag_now, p - frag_now->fr_literal,
                     insn->opcode[i].r_nchars, &insn->opcode[i].addr_expr,
-                    false, insn->opcode[i].r_type);
+                    FALSE, insn->opcode[i].r_type);
     }
 }
 
     }
 }
 
@@ -4221,13 +4026,12 @@ emit_insn (insn)
    return the total number of words used by the instruction.  */
 
 static int
    return the total number of words used by the instruction.  */
 
 static int
-build_insn (insn)
-     tic54x_insn *insn;
+build_insn (tic54x_insn *insn)
 {
   int i;
 
   /* Only non-parallel instructions support lk addressing.  */
 {
   int i;
 
   /* Only non-parallel instructions support lk addressing.  */
-  if (insn->tm)
+  if (!(insn->tm->flags & FL_PAR))
     {
       for (i = 0; i < insn->opcount; i++)
        {
     {
       for (i = 0; i < insn->opcount; i++)
        {
@@ -4244,23 +4048,24 @@ build_insn (insn)
            }
        }
     }
            }
        }
     }
-  insn->words =
-    (insn->tm ? insn->tm->words : insn->ptm->words) + insn->is_lkaddr;
+  insn->words = insn->tm->words + insn->is_lkaddr;
 
 
-  insn->opcode[0].word = insn->tm ? insn->tm->opcode : insn->ptm->opcode;
-  if (insn->tm && (insn->tm->flags & FL_EXT))
+  insn->opcode[0].word = insn->tm->opcode;
+  if (insn->tm->flags & FL_EXT)
     insn->opcode[1 + insn->is_lkaddr].word = insn->tm->opcode2;
 
   for (i = 0; i < insn->opcount; i++)
     {
       enum optype type = insn->operands[i].type;
     insn->opcode[1 + insn->is_lkaddr].word = insn->tm->opcode2;
 
   for (i = 0; i < insn->opcount; i++)
     {
       enum optype type = insn->operands[i].type;
+
       if (!encode_operand (insn, type, &insn->operands[i]))
        return 0;
     }
       if (!encode_operand (insn, type, &insn->operands[i]))
        return 0;
     }
-  if (insn->ptm)
+  if (insn->tm->flags & FL_PAR)
     for (i = 0; i < insn->paropcount; i++)
       {
        enum optype partype = insn->paroperands[i].type;
     for (i = 0; i < insn->paropcount; i++)
       {
        enum optype partype = insn->paroperands[i].type;
+
        if (!encode_operand (insn, partype, &insn->paroperands[i]))
          return 0;
       }
        if (!encode_operand (insn, partype, &insn->paroperands[i]))
          return 0;
       }
@@ -4271,8 +4076,7 @@ build_insn (insn)
 }
 
 static int
 }
 
 static int
-optimize_insn (insn)
-     tic54x_insn *insn;
+optimize_insn (tic54x_insn *insn)
 {
   /* Optimize some instructions, helping out the brain-dead programmer.  */
 #define is_zero(op) ((op).exp.X_op == O_constant && (op).exp.X_add_number == 0)
 {
   /* Optimize some instructions, helping out the brain-dead programmer.  */
 #define is_zero(op) ((op).exp.X_op == O_constant && (op).exp.X_add_number == 0)
@@ -4347,10 +4151,10 @@ optimize_insn (insn)
          return 1;
        }
 
          return 1;
        }
 
-      if (((OPTYPE (insn->tm->operand_types[0]) == OP_Smem
+      if (   ((OPTYPE (insn->tm->operand_types[0]) == OP_Smem
            && OPTYPE (insn->tm->operand_types[1]) == OP_SHIFT)
           || (OPTYPE (insn->tm->operand_types[0]) == OP_Xmem
            && OPTYPE (insn->tm->operand_types[1]) == OP_SHIFT)
           || (OPTYPE (insn->tm->operand_types[0]) == OP_Xmem
-              && OPTYPE (insn->tm->operand_types[1]) == OP_SHFT))
+           && OPTYPE (insn->tm->operand_types[1]) == OP_SHFT))
          && is_zero (insn->operands[1])
          && insn->opcount == 3)
        {
          && is_zero (insn->operands[1])
          && insn->opcount == 3)
        {
@@ -4365,11 +4169,9 @@ optimize_insn (insn)
 /* Find a matching template if possible, and get the operand strings.  */
 
 static int
 /* Find a matching template if possible, and get the operand strings.  */
 
 static int
-tic54x_parse_insn (insn, line)
-     tic54x_insn *insn;
-     char *line;
+tic54x_parse_insn (tic54x_insn *insn, char *line)
 {
 {
-  insn->tm = (template *) hash_find (op_hash, insn->mnemonic);
+  insn->tm = (insn_template *) hash_find (op_hash, insn->mnemonic);
   if (!insn->tm)
     {
       as_bad (_("Unrecognized instruction \"%s\""), insn->mnemonic);
   if (!insn->tm)
     {
       as_bad (_("Unrecognized instruction \"%s\""), insn->mnemonic);
@@ -4392,8 +4194,8 @@ tic54x_parse_insn (insn, line)
          /* SUCCESS! now try some optimizations.  */
          if (optimize_insn (insn))
            {
          /* SUCCESS! now try some optimizations.  */
          if (optimize_insn (insn))
            {
-             insn->tm = (template *) hash_find (op_hash,
-                                                insn->mnemonic);
+             insn->tm = (insn_template *) hash_find (op_hash,
+                                                      insn->mnemonic);
              continue;
            }
 
              continue;
            }
 
@@ -4414,11 +4216,10 @@ static int parallel_on_next_line_hint = 0;
    Look for a subsequent line starting with "||".  */
 
 static int
    Look for a subsequent line starting with "||".  */
 
 static int
-next_line_shows_parallel (next_line)
-     char *next_line;
+next_line_shows_parallel (char *next_line)
 {
   /* Look for the second half.  */
 {
   /* Look for the second half.  */
-  while (isspace (*next_line))
+  while (ISSPACE (*next_line))
     ++next_line;
 
   return (next_line[0] == PARALLEL_SEPARATOR
     ++next_line;
 
   return (next_line[0] == PARALLEL_SEPARATOR
@@ -4426,31 +4227,29 @@ next_line_shows_parallel (next_line)
 }
 
 static int
 }
 
 static int
-tic54x_parse_parallel_insn_firstline (insn, line)
-     tic54x_insn *insn;
-     char *line;
+tic54x_parse_parallel_insn_firstline (tic54x_insn *insn, char *line)
 {
 {
-  insn->ptm = (partemplate *) hash_find (parop_hash, insn->mnemonic);
-  if (!insn->ptm)
+  insn->tm = (insn_template *) hash_find (parop_hash, insn->mnemonic);
+  if (!insn->tm)
     {
       as_bad (_("Unrecognized parallel instruction \"%s\""),
              insn->mnemonic);
       return 0;
     }
 
     {
       as_bad (_("Unrecognized parallel instruction \"%s\""),
              insn->mnemonic);
       return 0;
     }
 
-  while (insn->ptm->name && strcasecmp (insn->ptm->name,
-                                       insn->mnemonic) == 0)
+  while (insn->tm->name && strcasecmp (insn->tm->name,
+                                       insn->mnemonic) == 0)
     {
       insn->opcount = get_operands (insn->operands, line);
       if (insn->opcount < 0)
        return 0;
       if (insn->opcount == 2
          && operands_match (insn, &insn->operands[0], insn->opcount,
     {
       insn->opcount = get_operands (insn->operands, line);
       if (insn->opcount < 0)
        return 0;
       if (insn->opcount == 2
          && operands_match (insn, &insn->operands[0], insn->opcount,
-                            insn->ptm->operand_types, 2, 2))
+                            insn->tm->operand_types, 2, 2))
        {
          return 1;
        }
        {
          return 1;
        }
-      ++(insn->ptm);
+      ++(insn->tm);
     }
   /* Didn't find a matching parallel; try for a normal insn.  */
   return 0;
     }
   /* Didn't find a matching parallel; try for a normal insn.  */
   return 0;
@@ -4459,30 +4258,27 @@ tic54x_parse_parallel_insn_firstline (insn, line)
 /* Parse the second line of a two-line parallel instruction.  */
 
 static int
 /* Parse the second line of a two-line parallel instruction.  */
 
 static int
-tic54x_parse_parallel_insn_lastline (insn, line)
-     tic54x_insn *insn;
-     char *line;
+tic54x_parse_parallel_insn_lastline (tic54x_insn *insn, char *line)
 {
   int valid_mnemonic = 0;
 
   insn->paropcount = get_operands (insn->paroperands, line);
 {
   int valid_mnemonic = 0;
 
   insn->paropcount = get_operands (insn->paroperands, line);
-  while (insn->ptm->name && strcasecmp (insn->ptm->name,
+  while (insn->tm->name && strcasecmp (insn->tm->name,
                                       insn->mnemonic) == 0)
     {
                                       insn->mnemonic) == 0)
     {
-      if (strcasecmp (insn->ptm->parname, insn->parmnemonic) == 0)
+      if (strcasecmp (insn->tm->parname, insn->parmnemonic) == 0)
        {
          valid_mnemonic = 1;
        {
          valid_mnemonic = 1;
-         if (insn->paropcount >= insn->ptm->minops
-             && insn->paropcount <= insn->ptm->maxops
+
+         if (insn->paropcount >= insn->tm->minops
+             && insn->paropcount <= insn->tm->maxops
              && operands_match (insn, insn->paroperands,
                                 insn->paropcount,
              && operands_match (insn, insn->paroperands,
                                 insn->paropcount,
-                                insn->ptm->paroperand_types,
-                                insn->ptm->minops, insn->ptm->maxops))
-           {
-             return 1;
-           }
+                                insn->tm->paroperand_types,
+                                insn->tm->minops, insn->tm->maxops))
+           return 1;
        }
        }
-      ++(insn->ptm);
+      ++(insn->tm);
     }
   if (valid_mnemonic)
     as_bad (_("Invalid operand (s) for parallel instruction \"%s\""),
     }
   if (valid_mnemonic)
     as_bad (_("Invalid operand (s) for parallel instruction \"%s\""),
@@ -4505,11 +4301,11 @@ subsym_get_arg (char *line, char *terminators, char **str, int nosub)
   char *ptr = line;
   char *endp;
   int is_string = *line == '"';
   char *ptr = line;
   char *endp;
   int is_string = *line == '"';
-  int is_char = isdigit (*line);
+  int is_char = ISDIGIT (*line);
 
   if (is_char)
     {
 
   if (is_char)
     {
-      while (isdigit (*ptr))
+      while (ISDIGIT (*ptr))
        ++ptr;
       endp = ptr;
       *str = xmalloc (ptr - line + 1);
        ++ptr;
       endp = ptr;
       *str = xmalloc (ptr - line + 1);
@@ -4520,6 +4316,7 @@ subsym_get_arg (char *line, char *terminators, char **str, int nosub)
     {
       char *savedp = input_line_pointer;
       int len;
     {
       char *savedp = input_line_pointer;
       int len;
+
       input_line_pointer = ptr;
       *str = demand_copy_C_string (&len);
       endp = input_line_pointer;
       input_line_pointer = ptr;
       *str = demand_copy_C_string (&len);
       endp = input_line_pointer;
@@ -4562,9 +4359,7 @@ subsym_get_arg (char *line, char *terminators, char **str, int nosub)
    that's compatible w/TI's assembler.  */
 
 static void
    that's compatible w/TI's assembler.  */
 
 static void
-subsym_create_or_replace (name, value)
-     char *name;
-     char *value;
+subsym_create_or_replace (char *name, char *value)
 {
   int i;
 
 {
   int i;
 
@@ -4583,13 +4378,11 @@ subsym_create_or_replace (name, value)
 }
 
 /* Look up the substitution string replacement for the given symbol.
 }
 
 /* Look up the substitution string replacement for the given symbol.
-   Start with the innermost macro substituion table given and work
+   Start with the innermost macro substitution table given and work
    outwards.  */
 
 static char *
    outwards.  */
 
 static char *
-subsym_lookup (name, nest_level)
-     char *name;
-     int nest_level;
+subsym_lookup (char *name, int nest_level)
 {
   char *value = hash_find (subsym_hash[nest_level], name);
 
 {
   char *value = hash_find (subsym_hash[nest_level], name);
 
@@ -4635,9 +4428,7 @@ subsym_substitute (char *line, int forced)
   if (strstr (line, ".if")
       || strstr (line, ".elseif")
       || strstr (line, ".break"))
   if (strstr (line, ".if")
       || strstr (line, ".elseif")
       || strstr (line, ".break"))
-    {
-      line_conditional = 1;
-    }
+    line_conditional = 1;
 
   /* Watch out for .eval, so that we avoid doing substitution on the
      symbol being assigned a value.  */
 
   /* Watch out for .eval, so that we avoid doing substitution on the
      symbol being assigned a value.  */
@@ -4705,8 +4496,8 @@ subsym_substitute (char *line, int forced)
          if (forced)
            ++ptr;
 
          if (forced)
            ++ptr;
 
-         name = input_line_pointer = ptr;
-         c = get_symbol_end ();
+         input_line_pointer = ptr;
+         c = get_symbol_name (&name);
          /* '?' is not normally part of a symbol, but it IS part of a local
             label.  */
          if (c == '?')
          /* '?' is not normally part of a symbol, but it IS part of a local
             label.  */
          if (c == '?')
@@ -4728,7 +4519,7 @@ subsym_substitute (char *line, int forced)
 
          /* Check for local labels; replace them with the appropriate
             substitution.  */
 
          /* Check for local labels; replace them with the appropriate
             substitution.  */
-         if ((*name == '$' && isdigit (name[1]) && name[2] == '\0')
+         if ((*name == '$' && ISDIGIT (name[1]) && name[2] == '\0')
              || name[strlen (name) - 1] == '?')
            {
              /* Use an existing identifier for that label if, available, or
              || name[strlen (name) - 1] == '?')
            {
              /* Use an existing identifier for that label if, available, or
@@ -4738,6 +4529,7 @@ subsym_substitute (char *line, int forced)
                {
                  char digit[11];
                  char *namecopy = strcpy (xmalloc (strlen (name) + 1), name);
                {
                  char digit[11];
                  char *namecopy = strcpy (xmalloc (strlen (name) + 1), name);
+
                  value = strcpy (xmalloc (strlen (name) + sizeof (digit) + 1),
                                  name);
                  if (*value != '$')
                  value = strcpy (xmalloc (strlen (name) + sizeof (digit) + 1),
                                  name);
                  if (*value != '$')
@@ -4770,10 +4562,10 @@ subsym_substitute (char *line, int forced)
              ++ptr;
              if (math_entry != NULL)
                {
              ++ptr;
              if (math_entry != NULL)
                {
-                 float arg1, arg2 = 0;
+                 float farg1, farg2 = 0;
                  volatile float fresult;
 
                  volatile float fresult;
 
-                 arg1 = (float) strtod (ptr, &ptr);
+                 farg1 = (float) strtod (ptr, &ptr);
                  if (math_entry->nargs == 2)
                    {
                      if (*ptr++ != ',')
                  if (math_entry->nargs == 2)
                    {
                      if (*ptr++ != ',')
@@ -4781,9 +4573,9 @@ subsym_substitute (char *line, int forced)
                          as_bad (_("Expecting second argument"));
                          break;
                        }
                          as_bad (_("Expecting second argument"));
                          break;
                        }
-                     arg2 = (float) strtod (ptr, &ptr);
+                     farg2 = (float) strtod (ptr, &ptr);
                    }
                    }
-                 fresult = (*math_entry->proc) (arg1, arg2);
+                 fresult = (*math_entry->proc) (farg1, farg2);
                  value = xmalloc (128);
                  if (math_entry->int_return)
                    sprintf (value, "%d", (int) fresult);
                  value = xmalloc (128);
                  if (math_entry->int_return)
                    sprintf (value, "%d", (int) fresult);
@@ -4803,6 +4595,7 @@ subsym_substitute (char *line, int forced)
                  int val;
                  int arg_type[2] = { *ptr == '"' , 0 };
                  int ismember = !strcmp (entry->name, "$ismember");
                  int val;
                  int arg_type[2] = { *ptr == '"' , 0 };
                  int ismember = !strcmp (entry->name, "$ismember");
+
                  /* Parse one or two args, which must be a substitution
                     symbol, string or a character-string constant.  */
                  /* For all functions, a string or substitution symbol may be
                  /* Parse one or two args, which must be a substitution
                     symbol, string or a character-string constant.  */
                  /* For all functions, a string or substitution symbol may be
@@ -4821,7 +4614,7 @@ subsym_substitute (char *line, int forced)
                        }
                      /* Character constants are converted to numerics
                         by the preprocessor.  */
                        }
                      /* Character constants are converted to numerics
                         by the preprocessor.  */
-                     arg_type[1] = (isdigit (*ptr)) ? 2 : (*ptr == '"');
+                     arg_type[1] = (ISDIGIT (*ptr)) ? 2 : (*ptr == '"');
                      ptr = subsym_get_arg (ptr, ")", &arg2, ismember);
                    }
                  /* Args checking.  */
                      ptr = subsym_get_arg (ptr, ")", &arg2, ismember);
                    }
                  /* Args checking.  */
@@ -4866,7 +4659,7 @@ subsym_substitute (char *line, int forced)
                {
                  hash_insert (subsym_recurse_hash, name, name);
                  value = subsym_substitute (value, macro_level > 0);
                {
                  hash_insert (subsym_recurse_hash, name, name);
                  value = subsym_substitute (value, macro_level > 0);
-                 hash_delete (subsym_recurse_hash, name);
+                 hash_delete (subsym_recurse_hash, name, FALSE);
                }
 
              /* Temporarily zero-terminate where the symbol started.  */
                }
 
              /* Temporarily zero-terminate where the symbol started.  */
@@ -4877,7 +4670,7 @@ subsym_substitute (char *line, int forced)
                    {
                      /* Subscripted substitution symbol -- use just the
                         indicated portion of the string; the description
                    {
                      /* Subscripted substitution symbol -- use just the
                         indicated portion of the string; the description
-                        kinda indicates that forced substituion is not
+                        kinda indicates that forced substitution is not
                         supposed to be recursive, but I'm not sure.  */
                      unsigned beg, len = 1; /* default to a single char */
                      char *newval = strcpy (xmalloc (strlen (value) + 1),
                         supposed to be recursive, but I'm not sure.  */
                      unsigned beg, len = 1; /* default to a single char */
                      char *newval = strcpy (xmalloc (strlen (value) + 1),
@@ -4889,7 +4682,7 @@ subsym_substitute (char *line, int forced)
                      if (beg < 1)
                        {
                          as_bad (_("Invalid subscript (use 1 to %d)"),
                      if (beg < 1)
                        {
                          as_bad (_("Invalid subscript (use 1 to %d)"),
-                                 strlen (value));
+                                 (int) strlen (value));
                          break;
                        }
                      if (*input_line_pointer == ',')
                          break;
                        }
                      if (*input_line_pointer == ',')
@@ -4899,7 +4692,7 @@ subsym_substitute (char *line, int forced)
                          if (beg + len > strlen (value))
                            {
                              as_bad (_("Invalid length (use 0 to %d"),
                          if (beg + len > strlen (value))
                            {
                              as_bad (_("Invalid length (use 0 to %d"),
-                                     strlen (value) - beg);
+                                     (int) strlen (value) - beg);
                              break;
                            }
                        }
                              break;
                            }
                        }
@@ -4932,24 +4725,6 @@ subsym_substitute (char *line, int forced)
                      break;
                    }
                  ++tail;
                      break;
                    }
                  ++tail;
-#if 0
-                 /* Try to replace required whitespace
-                    eliminated by the preprocessor; technically, a forced
-                    substitution could come anywhere, even mid-symbol,
-                    e.g. if x is "0", 'sym:x:end' should result in 'sym0end',
-                    but 'sym:x: end' should result in 'sym0 end'.
-                    FIXME -- this should really be fixed in the preprocessor,
-                    but would require several new states;
-                    KEEP_WHITE_AROUND_COLON does part of the job, but isn't
-                    complete.  */
-                 if ((is_part_of_name (tail[1])
-                      && tail[1] != '.'
-                      && tail[1] != '$')
-                     || tail[1] == '\0' || tail[1] == ',' || tail[1] == '"')
-                   ++tail;
-                 else
-                   *tail = ' ';
-#endif
                }
              else
                /* Restore the character after the symbol end.  */
                }
              else
                /* Restore the character after the symbol end.  */
@@ -4984,7 +4759,7 @@ subsym_substitute (char *line, int forced)
    returns the new buffer limit.  */
 
 void
    returns the new buffer limit.  */
 
 void
-tic54x_start_line_hook ()
+tic54x_start_line_hook (void)
 {
   char *line, *endp;
   char *replacement = NULL;
 {
   char *line, *endp;
   char *replacement = NULL;
@@ -4998,7 +4773,7 @@ tic54x_start_line_hook ()
   line[endp - input_line_pointer] = 0;
 
   /* Scan ahead for parallel insns.  */
   line[endp - input_line_pointer] = 0;
 
   /* Scan ahead for parallel insns.  */
-  parallel_on_next_line_hint = next_line_shows_parallel (endp + 1);
+  parallel_on_next_line_hint = next_line_shows_parallel (endp);
 
   /* If within a macro, first process forced replacements.  */
   if (macro_level > 0)
 
   /* If within a macro, first process forced replacements.  */
   if (macro_level > 0)
@@ -5026,7 +4801,7 @@ tic54x_start_line_hook ()
        comment = replacement + strlen (replacement) - 1;
 
       /* Trim trailing whitespace.  */
        comment = replacement + strlen (replacement) - 1;
 
       /* Trim trailing whitespace.  */
-      while (isspace (*comment))
+      while (ISSPACE (*comment))
        {
          comment[0] = endc;
          comment[1] = 0;
        {
          comment[0] = endc;
          comment[1] = 0;
@@ -5034,7 +4809,7 @@ tic54x_start_line_hook ()
        }
 
       /* Compact leading whitespace.  */
        }
 
       /* Compact leading whitespace.  */
-      while (isspace (tmp[0]) && isspace (tmp[1]))
+      while (ISSPACE (tmp[0]) && ISSPACE (tmp[1]))
        ++tmp;
 
       input_line_pointer = endp;
        ++tmp;
 
       input_line_pointer = endp;
@@ -5056,8 +4831,7 @@ tic54x_start_line_hook ()
    machine dependent instruction.  This function is supposed to emit
    the frags/bytes it assembles to.  */
 void
    machine dependent instruction.  This function is supposed to emit
    the frags/bytes it assembles to.  */
 void
-md_assemble (line)
-     char *line;
+md_assemble (char *line)
 {
   static int repeat_slot = 0;
   static int delay_slots = 0; /* How many delay slots left to fill?  */
 {
   static int repeat_slot = 0;
   static int delay_slots = 0; /* How many delay slots left to fill?  */
@@ -5068,7 +4842,7 @@ md_assemble (line)
   int c;
 
   input_line_pointer = line;
   int c;
 
   input_line_pointer = line;
-  c = get_symbol_end ();
+  c = get_symbol_name (&line);
 
   if (cpu == VNONE)
     cpu = V542;
 
   if (cpu == VNONE)
     cpu = V542;
@@ -5135,7 +4909,7 @@ md_assemble (line)
             otherwise let the assembler pick up the next line for us.  */
          if (tmp != NULL)
            {
             otherwise let the assembler pick up the next line for us.  */
          if (tmp != NULL)
            {
-             while (isspace (tmp[2]))
+             while (ISSPACE (tmp[2]))
                ++tmp;
              md_assemble (tmp + 2);
            }
                ++tmp;
              md_assemble (tmp + 2);
            }
@@ -5223,7 +4997,7 @@ md_assemble (line)
    a ".file" symbol.  */
 
 void
    a ".file" symbol.  */
 
 void
-tic54x_adjust_symtab ()
+tic54x_adjust_symtab (void)
 {
   if (symbol_rootP == NULL
       || S_GET_STORAGE_CLASS (symbol_rootP) != C_FILE)
 {
   if (symbol_rootP == NULL
       || S_GET_STORAGE_CLASS (symbol_rootP) != C_FILE)
@@ -5231,7 +5005,7 @@ tic54x_adjust_symtab ()
       char *filename;
       unsigned lineno;
       as_where (&filename, &lineno);
       char *filename;
       unsigned lineno;
       as_where (&filename, &lineno);
-      c_dot_file_symbol (filename);
+      c_dot_file_symbol (filename, 0);
     }
 }
 
     }
 }
 
@@ -5251,14 +5025,8 @@ tic54x_unrecognized_line (int c)
    FIXME -- obviously this isn't done yet.  These locals still show up in the
    symbol table.  */
 void
    FIXME -- obviously this isn't done yet.  These locals still show up in the
    symbol table.  */
 void
-tic54x_define_label (sym)
-     symbolS *sym;
+tic54x_define_label (symbolS *sym)
 {
 {
-#if 0
-  static int local_label_count = 0;
-  const char *name = S_GET_NAME (sym);
-#endif
-
   /* Just in case we need this later; note that this is not necessarily the
      same thing as line_label...
      When aligning or assigning labels to fields, sometimes the label is
   /* Just in case we need this later; note that this is not necessarily the
      same thing as line_label...
      When aligning or assigning labels to fields, sometimes the label is
@@ -5271,8 +5039,7 @@ tic54x_define_label (sym)
 /* Try to parse something that normal parsing failed at.  */
 
 symbolS *
 /* Try to parse something that normal parsing failed at.  */
 
 symbolS *
-tic54x_undefined_symbol (name)
-     char *name;
+tic54x_undefined_symbol (char *name)
 {
   symbol *sym;
 
 {
   symbol *sym;
 
@@ -5304,55 +5071,22 @@ tic54x_undefined_symbol (name)
    it.  */
 
 int
    it.  */
 
 int
-tic54x_parse_name (name, exp)
-     char *name ATTRIBUTE_UNUSED;
-     expressionS *exp ATTRIBUTE_UNUSED;
+tic54x_parse_name (char *name ATTRIBUTE_UNUSED,
+                  expressionS *expn ATTRIBUTE_UNUSED)
 {
 {
-#if 0
-  symbol *sym = (symbol *) hash_find (mmreg_hash, name);
-
-  /* If it's a MMREG, replace it with its constant value.  */
-  if (sym)
-    {
-      exp->X_op = O_constant;
-      exp->X_add_number = sym->value;
-      return 1;
-    }
-#endif
   return 0;
 }
 
 char *
   return 0;
 }
 
 char *
-md_atof (type, literalP, sizeP)
-     int type;
-     char *literalP;
-     int *sizeP;
-{
-#define MAX_LITTLENUMS 2
-  LITTLENUM_TYPE words[MAX_LITTLENUMS];
-  LITTLENUM_TYPE *word;
-  /* Only one precision on the c54x.  */
-  int prec = 2;
-  char *t = atof_ieee (input_line_pointer, type, words);
-  if (t)
-    input_line_pointer = t;
-  *sizeP = 4;
-
+md_atof (int type, char *literalP, int *sizeP)
+{
   /* Target data is little-endian, but floats are stored
      big-"word"ian.  ugh.  */
   /* Target data is little-endian, but floats are stored
      big-"word"ian.  ugh.  */
-  for (word = words; prec--;)
-    {
-      md_number_to_chars (literalP, (long) (*word++), sizeof (LITTLENUM_TYPE));
-      literalP += sizeof (LITTLENUM_TYPE);
-    }
-
-  return 0;
+  return ieee_md_atof (type, literalP, sizeP, TRUE);
 }
 
 arelent *
 }
 
 arelent *
-tc_gen_reloc (section, fixP)
-     asection *section;
-     fixS *fixP;
+tc_gen_reloc (asection *section, fixS *fixP)
 {
   arelent *rel;
   bfd_reloc_code_real_type code = fixP->fx_r_type;
 {
   arelent *rel;
   bfd_reloc_code_real_type code = fixP->fx_r_type;
@@ -5383,9 +5117,9 @@ tc_gen_reloc (section, fixP)
 /* Handle cons expressions.  */
 
 void
 /* Handle cons expressions.  */
 
 void
-tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *exp)
+tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *expn,
+                    bfd_reloc_code_real_type r)
 {
 {
-  bfd_reloc_code_real_type r;
   switch (octets)
     {
     default:
   switch (octets)
     {
     default:
@@ -5405,7 +5139,7 @@ tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *exp)
        r = BFD_RELOC_32;
       break;
     }
        r = BFD_RELOC_32;
       break;
     }
-  fix_new_exp (frag, where, octets, exp, 0, r);
+  fix_new_exp (frag, where, octets, expn, 0, r);
 }
 
 /* Attempt to simplify or even eliminate a fixup.
 }
 
 /* Attempt to simplify or even eliminate a fixup.
@@ -5413,19 +5147,17 @@ tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *exp)
 
    If fixp->fx_addsy is non-NULL, we'll have to generate a reloc entry.   */
 
 
    If fixp->fx_addsy is non-NULL, we'll have to generate a reloc entry.   */
 
-int
-md_apply_fix (fixP, valP)
-     fixS *fixP;
-     valueT *valP;
+void
+md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
 {
   char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
 {
   char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
-  valueT val = *valP;
+  valueT val = * valP;
 
   switch (fixP->fx_r_type)
     {
     default:
       as_fatal ("Bad relocation type: 0x%02x", fixP->fx_r_type);
 
   switch (fixP->fx_r_type)
     {
     default:
       as_fatal ("Bad relocation type: 0x%02x", fixP->fx_r_type);
-      return 0;
+      return;
     case BFD_RELOC_TIC54X_MS7_OF_23:
       val = (val >> 16) & 0x7F;
       /* Fall through.  */
     case BFD_RELOC_TIC54X_MS7_OF_23:
       val = (val >> 16) & 0x7F;
       /* Fall through.  */
@@ -5459,46 +5191,30 @@ md_apply_fix (fixP, valP)
       break;
     }
 
       break;
     }
 
-  return 0; /* Return value is ignored.  */
+  if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+    fixP->fx_done = 1;
 }
 
 /* This is our chance to record section alignment
    don't need to do anything here, since BFD does the proper encoding.  */
 
 valueT
 }
 
 /* This is our chance to record section alignment
    don't need to do anything here, since BFD does the proper encoding.  */
 
 valueT
-md_section_align (segment, section_size)
-     segT segment ATTRIBUTE_UNUSED;
-     valueT section_size;
+md_section_align (segT segment ATTRIBUTE_UNUSED, valueT section_size)
 {
   return section_size;
 }
 
 long
 {
   return section_size;
 }
 
 long
-md_pcrel_from (fixP)
-     fixS *fixP ATTRIBUTE_UNUSED;
+md_pcrel_from (fixS *fixP ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 
 {
   return 0;
 }
 
-#if defined OBJ_COFF
-
-short
-tc_coff_fix2rtype (fixP)
-     fixS *fixP;
-{
-  return (fixP->fx_r_type);
-}
-
-#endif /* OBJ_COFF */
-
 /* Mostly little-endian, but longwords (4 octets) get MS word stored
    first.  */
 
 void
 /* Mostly little-endian, but longwords (4 octets) get MS word stored
    first.  */
 
 void
-tic54x_number_to_chars (buf, val, n)
-     char *buf;
-     valueT val;
-     int n;
+tic54x_number_to_chars (char *buf, valueT val, int n)
 {
   if (n != 4)
     number_to_chars_littleendian (buf, val, n);
 {
   if (n != 4)
     number_to_chars_littleendian (buf, val, n);
@@ -5510,9 +5226,8 @@ tic54x_number_to_chars (buf, val, n)
 }
 
 int
 }
 
 int
-tic54x_estimate_size_before_relax (frag, seg)
-     fragS *frag ATTRIBUTE_UNUSED;
-     segT seg ATTRIBUTE_UNUSED;
+tic54x_estimate_size_before_relax (fragS *frag ATTRIBUTE_UNUSED,
+                                  segT seg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 {
   return 0;
 }
@@ -5521,9 +5236,7 @@ tic54x_estimate_size_before_relax (frag, seg)
    to symbols being in different frags.  return number of octets added.  */
 
 int
    to symbols being in different frags.  return number of octets added.  */
 
 int
-tic54x_relax_frag (frag, stretch)
-     fragS *frag;
-     long stretch ATTRIBUTE_UNUSED;
+tic54x_relax_frag (fragS *frag, long stretch ATTRIBUTE_UNUSED)
 {
   symbolS *sym = frag->fr_symbol;
   int growth = 0;
 {
   symbolS *sym = frag->fr_symbol;
   int growth = 0;
@@ -5559,6 +5272,7 @@ tic54x_relax_frag (frag, stretch)
          if (bit_offset != 0 && available >= size)
            {
              char *p = prev_frag->fr_literal;
          if (bit_offset != 0 && available >= size)
            {
              char *p = prev_frag->fr_literal;
+
              valueT value = bi->value;
              value <<= available - size;
              value |= ((unsigned short) p[1] << 8) | p[0];
              valueT value = bi->value;
              value <<= available - size;
              value |= ((unsigned short) p[1] << 8) | p[0];
@@ -5575,6 +5289,7 @@ tic54x_relax_frag (frag, stretch)
          else
            {
              char *p = frag->fr_literal;
          else
            {
              char *p = frag->fr_literal;
+
              valueT value = bi->value << (16 - size);
              md_number_to_chars (p, value, 2);
              if ((frag->tc_frag_data = size) == 16)
              valueT value = bi->value << (16 - size);
              md_number_to_chars (p, value, 2);
              if ((frag->tc_frag_data = size) == 16)
@@ -5620,10 +5335,9 @@ tic54x_relax_frag (frag, stretch)
 }
 
 void
 }
 
 void
-tic54x_convert_frag (abfd, seg, frag)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     segT seg ATTRIBUTE_UNUSED;
-     fragS *frag;
+tic54x_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
+                    segT seg ATTRIBUTE_UNUSED,
+                    fragS *frag)
 {
   /* Offset is in bytes.  */
   frag->fr_offset = (frag->fr_next->fr_address
 {
   /* Offset is in bytes.  */
   frag->fr_offset = (frag->fr_next->fr_address
@@ -5643,24 +5357,22 @@ tic54x_convert_frag (abfd, seg, frag)
    syntax puts the symbol *before* the pseudo (which is kinda like MRI syntax,
    I guess, except I've never seen a definition of MRI syntax).
 
    syntax puts the symbol *before* the pseudo (which is kinda like MRI syntax,
    I guess, except I've never seen a definition of MRI syntax).
 
-   C is the character that used to be at *REST, which points to the end of the
-   label.
-
    Don't allow labels to start with '.'  */
 
 int
    Don't allow labels to start with '.'  */
 
 int
-tic54x_start_label (c, rest)
-     int c;
-     char *rest;
+tic54x_start_label (int nul_char, int next_char)
 {
 {
+  char *rest;
+
   /* If within .struct/.union, no auto line labels, please.  */
   if (current_stag != NULL)
     return 0;
 
   /* Disallow labels starting with "."  */
   /* If within .struct/.union, no auto line labels, please.  */
   if (current_stag != NULL)
     return 0;
 
   /* Disallow labels starting with "."  */
-  if (c != ':')
+  if (next_char != ':')
     {
     {
-      char *label = rest;
+      char *label = input_line_pointer;
+
       while (!is_end_of_line[(int) label[-1]])
        --label;
       if (*label == '.')
       while (!is_end_of_line[(int) label[-1]])
        --label;
       if (*label == '.')
@@ -5670,22 +5382,22 @@ tic54x_start_label (c, rest)
        }
     }
 
        }
     }
 
-  if (is_end_of_line[(int) c])
+  if (is_end_of_line[(int) next_char])
     return 1;
 
     return 1;
 
-  if (isspace (c))
-    while (isspace (c = *++rest))
-      ;
-  if (c == '.')
-    {
-      /* Don't let colon () define a label for any of these...  */
-      return (strncasecmp (rest, ".tag", 4) != 0 || !isspace (rest[4]))
-       && (strncasecmp (rest, ".struct", 7) != 0 || !isspace (rest[7]))
-       && (strncasecmp (rest, ".union", 6) != 0 || !isspace (rest[6]))
-       && (strncasecmp (rest, ".macro", 6) != 0 || !isspace (rest[6]))
-       && (strncasecmp (rest, ".set", 4) != 0 || !isspace (rest[4]))
-       && (strncasecmp (rest, ".equ", 4) != 0 || !isspace (rest[4]));
-    }
+  rest = input_line_pointer;
+  if (nul_char == '"')
+    ++rest;
+  while (ISSPACE (next_char))
+    next_char = *++rest;
+  if (next_char != '.')
+    return 1;
 
 
-  return 1;
+  /* Don't let colon () define a label for any of these...  */
+  return ((strncasecmp (rest, ".tag", 4) != 0 || !ISSPACE (rest[4]))
+         && (strncasecmp (rest, ".struct", 7) != 0 || !ISSPACE (rest[7]))
+         && (strncasecmp (rest, ".union", 6) != 0 || !ISSPACE (rest[6]))
+         && (strncasecmp (rest, ".macro", 6) != 0 || !ISSPACE (rest[6]))
+         && (strncasecmp (rest, ".set", 4) != 0 || !ISSPACE (rest[4]))
+         && (strncasecmp (rest, ".equ", 4) != 0 || !ISSPACE (rest[4])));
 }
 }