Complain about mbind, ifunc, and unique in final_write
[deliverable/binutils-gdb.git] / gas / config / tc-dlx.c
index 2e2542522471489b568b00bd7a56093348b1fc3b..0b0fe2f1502fa6196a4d8a2d0e22e470ae479bdb 100644 (file)
@@ -1,11 +1,11 @@
-/* tc-ldx.c -- Assemble for the DLX
-   Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* tc-dlx.c -- Assemble for the DLX
+   Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
    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
 
    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,
 
    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.  */
 
 /* Initially created by Kuang Hwa Lin, 3/20/2002.  */
 
 
 /* Initially created by Kuang Hwa Lin, 3/20/2002.  */
 
-#include "safe-ctype.h"
 #include "as.h"
 #include "as.h"
+#include "safe-ctype.h"
 #include "tc-dlx.h"
 #include "opcode/dlx.h"
 #include "tc-dlx.h"
 #include "opcode/dlx.h"
+#include "elf/dlx.h"
+#include "bfd/elf32-dlx.h"
 
 /* Make it easier to clone this machine desc into another one.  */
 #define        machine_opcode      dlx_opcode
 
 /* Make it easier to clone this machine desc into another one.  */
 #define        machine_opcode      dlx_opcode
@@ -52,41 +54,12 @@ struct machine_it
   int pcrel;
   int size;
   int reloc_offset;            /* Offset of reloc within insn.  */
   int pcrel;
   int size;
   int reloc_offset;            /* Offset of reloc within insn.  */
-  int reloc;
+  bfd_reloc_code_real_type reloc;
   int HI;
   int LO;
 }
 the_insn;
 
   int HI;
   int LO;
 }
 the_insn;
 
-/* static void print_insn PARAMS ((struct machine_it *)); */
-char * parse_operand    PARAMS ((char *, expressionS *));
-int md_chars_to_number  PARAMS ((unsigned char *, int));
-
-static void machine_ip          PARAMS ((char *));
-static void s_proc              PARAMS ((int));
-static void insert_sreg         PARAMS ((char *, int));
-static int  hilo_modifier_ok    PARAMS ((char *));
-static int  is_ldst_registers   PARAMS ((char *));
-static int  match_sft_register  PARAMS ((char *));
-static void define_some_regs    PARAMS ((void));
-static char * dlx_parse_loadop  PARAMS ((char *));
-static char * dlx_parse_storeop PARAMS ((char *));
-static char * fix_ld_st_operand PARAMS ((unsigned long, char *));
-
-const pseudo_typeS
-
-dlx_pseudo_table[] =
-  {
-    /* Some additional ops that are used by gcc-dlx.  */
-    {"asciiz", stringer, 1},
-    {"half", cons, 2},
-    {"dword", cons, 8},
-    {"word", cons, 4},
-    {"proc", s_proc, 0},
-    {"endproc", s_proc, 1},
-    {NULL, 0, 0},
-  };
-
 /* This array holds the chars that always start a comment.  If the
    pre-processor is disabled, these aren't very useful.  */
 const char comment_chars[] = ";";
 /* This array holds the chars that always start a comment.  If the
    pre-processor is disabled, these aren't very useful.  */
 const char comment_chars[] = ";";
@@ -113,9 +86,7 @@ const char EXP_CHARS[] = "eE";
 const char FLT_CHARS[] = "rRsSfFdDxXpP";
 
 static void
 const char FLT_CHARS[] = "rRsSfFdDxXpP";
 
 static void
-insert_sreg (regname, regnum)
-     char *regname;
-     int regnum;
+insert_sreg (const char *regname, int regnum)
 {
   /* Must be large enough to hold the names of the special registers.  */
   char buf[80];
 {
   /* Must be large enough to hold the names of the special registers.  */
   char buf[80];
@@ -135,7 +106,7 @@ insert_sreg (regname, regnum)
    See MIPS Assembly Language Programmer's Guide page 1-4   */
 
 static void
    See MIPS Assembly Language Programmer's Guide page 1-4   */
 
 static void
-define_some_regs ()
+define_some_regs (void)
 {
   /* Software representation.  */
   insert_sreg ("zero",  0);
 {
   /* Software representation.  */
   insert_sreg ("zero",  0);
@@ -176,16 +147,15 @@ define_some_regs ()
   insert_sreg ("iad",   2);
 }
 
   insert_sreg ("iad",   2);
 }
 
-/* Subroutine check the string to match an register, */
+/* Subroutine check the string to match an register */
 
 static int
 
 static int
-match_sft_register (name)
-     char *name;
+match_sft_register (char *name)
 {
 #define MAX_REG_NO  35
 /* Currently we have 35 software registers defined -
    we borrowed from MIPS.   */
 {
 #define MAX_REG_NO  35
 /* Currently we have 35 software registers defined -
    we borrowed from MIPS.   */
-  static char *soft_reg[] =
+  static const char *soft_reg[] =
     {
       "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
       "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9",
     {
       "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
       "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9",
@@ -211,8 +181,7 @@ match_sft_register (name)
 /* Subroutine check the string to match an register.  */
 
 static int
 /* Subroutine check the string to match an register.  */
 
 static int
-is_ldst_registers (name)
-     char *name;
+is_ldst_registers (char *name)
 {
   char *ptr = name;
 
 {
   char *ptr = name;
 
@@ -229,8 +198,7 @@ is_ldst_registers (name)
    If DEFAULT_PREFIX is NULL, use the target's "leading char".  */
 
 static void
    If DEFAULT_PREFIX is NULL, use the target's "leading char".  */
 
 static void
-s_proc (end_p)
-     int end_p;
+s_proc (int end_p)
 {
   /* Record the current function so that we can issue an error message for
      misplaced .func,.endfunc, and also so that .endfunc needs no
 {
   /* Record the current function so that we can issue an error message for
      misplaced .func,.endfunc, and also so that .endfunc needs no
@@ -264,11 +232,10 @@ s_proc (end_p)
          return;
        }
 
          return;
        }
 
-      name = input_line_pointer;
-      delim1 = get_symbol_end ();
+      delim1 = get_symbol_name (&name);
       name = xstrdup (name);
       *input_line_pointer = delim1;
       name = xstrdup (name);
       *input_line_pointer = delim1;
-      SKIP_WHITESPACE ();
+      SKIP_WHITESPACE_AFTER_NAME ();
 
       if (*input_line_pointer != ',')
        {
 
       if (*input_line_pointer != ',')
        {
@@ -278,7 +245,12 @@ s_proc (end_p)
          /* Missing entry point, use function's name with the leading
             char prepended.  */
          if (leading_char)
          /* Missing entry point, use function's name with the leading
             char prepended.  */
          if (leading_char)
-           asprintf (&label, "%c%s", leading_char, name);
+           {
+             unsigned len = strlen (name) + 1;
+             label = XNEWVEC (char, len + 1);
+             label[0] = leading_char;
+             memcpy (label + 1, name, len);
+           }
          else
            label = name;
        }
          else
            label = name;
        }
@@ -286,10 +258,9 @@ s_proc (end_p)
        {
          ++input_line_pointer;
          SKIP_WHITESPACE ();
        {
          ++input_line_pointer;
          SKIP_WHITESPACE ();
-         label = input_line_pointer;
-         delim2 = get_symbol_end ();
+         delim2 = get_symbol_name (&label);
          label = xstrdup (label);
          label = xstrdup (label);
-         *input_line_pointer = delim2;
+         (void) restore_line_pointer (delim2);
        }
 
       current_name = name;
        }
 
       current_name = name;
@@ -303,7 +274,7 @@ s_proc (end_p)
    need.  */
 
 void
    need.  */
 
 void
-md_begin ()
+md_begin (void)
 {
   const char *retval = NULL;
   int lose = 0;
 {
   const char *retval = NULL;
   int lose = 0;
@@ -317,11 +288,11 @@ md_begin ()
     {
       const char *name = machine_opcodes[i].name;
 
     {
       const char *name = machine_opcodes[i].name;
 
-      retval = hash_insert (op_hash, name, (PTR) &machine_opcodes[i]);
+      retval = hash_insert (op_hash, name, (void *) &machine_opcodes[i]);
 
       if (retval != NULL)
        {
 
       if (retval != NULL)
        {
-         fprintf (stderr, "internal error: can't hash `%s': %s\n",
+         fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
                   machine_opcodes[i].name, retval);
          lose = 1;
        }
                   machine_opcodes[i].name, retval);
          lose = 1;
        }
@@ -333,170 +304,6 @@ md_begin ()
   define_some_regs ();
 }
 
   define_some_regs ();
 }
 
-/* Assemble a single instruction.  Its label has already been handled
-   by the generic front end.  We just parse opcode and operands, and
-   produce the bytes of data and relocation.  */
-
-void
-md_assemble (str)
-     char *str;
-{
-  char *toP;
-  fixS *fixP;
-  bit_fixS *bitP;
-
-  know (str);
-  machine_ip (str);
-  toP = frag_more (4);
-  /* Put out the opcode.  */
-  md_number_to_chars (toP, the_insn.opcode, 4);
-
-  /* Put out the symbol-dependent stuff.  */
-  if (the_insn.reloc != NO_RELOC)
-    {
-      fixP = fix_new_exp (frag_now,
-                         (toP - frag_now->fr_literal + the_insn.reloc_offset),
-                         the_insn.size, & the_insn.exp, the_insn.pcrel,
-                         the_insn.reloc);
-
-      /* Turn off complaints that the addend is
-        too large for things like foo+100000@ha.  */
-      switch (the_insn.reloc)
-       {
-       case RELOC_DLX_HI16:
-       case RELOC_DLX_LO16:
-         fixP->fx_no_overflow = 1;
-         break;
-       default:
-         break;
-       }
-
-      switch (fixP->fx_r_type)
-       {
-       case RELOC_DLX_REL26:
-         bitP = malloc (sizeof (bit_fixS));
-         bitP->fx_bit_size = 26;
-         bitP->fx_bit_offset = 25;
-         bitP->fx_bit_base = the_insn.opcode & 0xFC000000;
-         bitP->fx_bit_base_adj = 0;
-         bitP->fx_bit_max = 0;
-         bitP->fx_bit_min = 0;
-         bitP->fx_bit_add = 0x03FFFFFF;
-         fixP->fx_bit_fixP = bitP;
-         break;
-       case RELOC_DLX_LO16:
-       case RELOC_DLX_REL16:
-         bitP = malloc (sizeof (bit_fixS));
-         bitP->fx_bit_size = 16;
-         bitP->fx_bit_offset = 15;
-         bitP->fx_bit_base = the_insn.opcode & 0xFFFF0000;
-         bitP->fx_bit_base_adj = 0;
-         bitP->fx_bit_max = 0;
-         bitP->fx_bit_min = 0;
-         bitP->fx_bit_add = 0x0000FFFF;
-         fixP->fx_bit_fixP = bitP;
-         break;
-       case RELOC_DLX_HI16:
-         bitP = malloc (sizeof (bit_fixS));
-         bitP->fx_bit_size = 16;
-         bitP->fx_bit_offset = 15;
-         bitP->fx_bit_base = the_insn.opcode & 0xFFFF0000;
-         bitP->fx_bit_base_adj = 0;
-         bitP->fx_bit_max = 0;
-         bitP->fx_bit_min = 0;
-         bitP->fx_bit_add = 0x0000FFFF;
-         fixP->fx_bit_fixP = bitP;
-         break;
-       default:
-         fixP->fx_bit_fixP = (bit_fixS *)NULL;
-         break;
-       }
-    }
-}
-
-static int
-hilo_modifier_ok (s)
-     char *s;
-{
-  char *ptr = s;
-  int   idx, count = 1;
-
-  if (*ptr != '(')
-    return 1;
-
-  for (idx = 1; ptr[idx] != '\0' && ptr[idx] != '[' && idx < 73; idx += 1)
-    {
-      if (count == 0)
-       return count;
-
-      if (ptr[idx] == '(')
-       count += 1;
-
-      if (ptr[idx] == ')')
-       count -= 1;
-    }
-
-  return (count == 0) ? 1:0;
-}
-
-char *
-parse_operand (s, operandp)
-     char *s;
-     expressionS *operandp;
-{
-  char *save = input_line_pointer;
-  char *new;
-
-  the_insn.HI = the_insn.LO = 0;
-
-  /* Search for %hi and %lo, make a mark and skip it.  */
-  if (strncmp (s, "%hi", 3) == 0)
-    {
-      s += 3;
-      the_insn.HI = 1;
-    }
-  else
-    {
-      if (strncmp (s, "%lo", 3) == 0)
-       {
-         s += 3;
-         the_insn.LO = 1;
-       }
-      else
-       the_insn.LO = 0;
-    }
-
-  if (the_insn.HI || the_insn.LO)
-    {
-      if (!hilo_modifier_ok (s))
-       as_bad (_("Expression Error for operand modifier %%hi/%%lo\n"));
-    }
-
-  /* Check for the % and $ register representation    */
-  if ((s[0] == '%' || s[0] == '$' || s[0] == 'r' || s[0] == 'R')
-      && ISDIGIT ((unsigned char) s[1]))
-    {
-      /* We have a numeric register expression.  No biggy.  */
-      s += 1;
-      input_line_pointer = s;
-      (void) expression (operandp);
-      if (operandp->X_op != O_constant
-         || operandp->X_add_number > 31)
-       as_bad (_("Invalid expression after %%%%\n"));
-      operandp->X_op = O_register;
-    }
-  else
-    {
-      /* Normal operand parsing.  */
-      input_line_pointer = s;
-      (void) expression (operandp);
-    }
-
-  new = input_line_pointer;
-  input_line_pointer = save;
-  return new;
-}
-
 /* This function will check the opcode and return 1 if the opcode is one
    of the load/store instruction, and it will fix the operand string to
    the standard form so we can use the standard parse_operand routine.  */
 /* This function will check the opcode and return 1 if the opcode is one
    of the load/store instruction, and it will fix the operand string to
    the standard form so we can use the standard parse_operand routine.  */
@@ -506,8 +313,7 @@ parse_operand (s, operandp)
 static char iBuf[81];
 
 static char *
 static char iBuf[81];
 
 static char *
-dlx_parse_loadop (str)
-     char * str;
+dlx_parse_loadop (char * str)
 {
   char *ptr = str;
   int   idx = 0;
 {
   char *ptr = str;
   int   idx = 0;
@@ -625,8 +431,7 @@ dlx_parse_loadop (str)
 }
 
 static char *
 }
 
 static char *
-dlx_parse_storeop (str)
-     char * str;
+dlx_parse_storeop (char * str)
 {
   char *ptr = str;
   int   idx = 0;
 {
   char *ptr = str;
   int   idx = 0;
@@ -743,9 +548,7 @@ dlx_parse_storeop (str)
 }
 
 static char *
 }
 
 static char *
-fix_ld_st_operand (opcode, str)
-     unsigned long opcode;
-     char* str;
+fix_ld_st_operand (unsigned long opcode, char* str)
 {
   /* Check the opcode.  */
   switch ((int) opcode)
 {
   /* Check the opcode.  */
   switch ((int) opcode)
@@ -768,23 +571,104 @@ fix_ld_st_operand (opcode, str)
     }
 }
 
     }
 }
 
+static int
+hilo_modifier_ok (char *s)
+{
+  char *ptr = s;
+  int   idx, count = 1;
+
+  if (*ptr != '(')
+    return 1;
+
+  for (idx = 1; ptr[idx] != '\0' && ptr[idx] != '[' && idx < 73; idx += 1)
+    {
+      if (count == 0)
+       return count;
+
+      if (ptr[idx] == '(')
+       count += 1;
+
+      if (ptr[idx] == ')')
+       count -= 1;
+    }
+
+  return (count == 0) ? 1:0;
+}
+
+static char *
+parse_operand (char *s, expressionS *operandp)
+{
+  char *save = input_line_pointer;
+  char *new_pos;
+
+  the_insn.HI = the_insn.LO = 0;
+
+  /* Search for %hi and %lo, make a mark and skip it.  */
+  if (strncmp (s, "%hi", 3) == 0)
+    {
+      s += 3;
+      the_insn.HI = 1;
+    }
+  else
+    {
+      if (strncmp (s, "%lo", 3) == 0)
+       {
+         s += 3;
+         the_insn.LO = 1;
+       }
+      else
+       the_insn.LO = 0;
+    }
+
+  if (the_insn.HI || the_insn.LO)
+    {
+      if (!hilo_modifier_ok (s))
+       as_bad (_("Expression Error for operand modifier %%hi/%%lo\n"));
+    }
+
+  /* Check for the % and $ register representation    */
+  if ((s[0] == '%' || s[0] == '$' || s[0] == 'r' || s[0] == 'R')
+      && ISDIGIT ((unsigned char) s[1]))
+    {
+      /* We have a numeric register expression.  No biggy.  */
+      s += 1;
+      input_line_pointer = s;
+      (void) expression (operandp);
+      if (operandp->X_op != O_constant
+         || operandp->X_add_number > 31)
+       as_bad (_("Invalid expression after %%%%\n"));
+      operandp->X_op = O_register;
+    }
+  else
+    {
+      /* Normal operand parsing.  */
+      input_line_pointer = s;
+      (void) expression (operandp);
+    }
+
+  new_pos = input_line_pointer;
+  input_line_pointer = save;
+  return new_pos;
+}
+
 /* Instruction parsing.  Takes a string containing the opcode.
    Operands are at input_line_pointer.  Output is in the_insn.
    Warnings or errors are generated.  */
 
 static void
 /* Instruction parsing.  Takes a string containing the opcode.
    Operands are at input_line_pointer.  Output is in the_insn.
    Warnings or errors are generated.  */
 
 static void
-machine_ip (str)
-     char *str;
+machine_ip (char *str)
 {
   char *s;
   const char *args;
   struct machine_opcode *insn;
 {
   char *s;
   const char *args;
   struct machine_opcode *insn;
-  char *argsStart;
   unsigned long opcode;
   expressionS the_operand;
   expressionS *operand = &the_operand;
   unsigned int reg, reg_shift = 0;
 
   unsigned long opcode;
   expressionS the_operand;
   expressionS *operand = &the_operand;
   unsigned int reg, reg_shift = 0;
 
+  memset (&the_insn, '\0', sizeof (the_insn));
+  the_insn.reloc = NO_RELOC;
+
   /* Fixup the opcode string to all lower cases, and also
      allow numerical digits.  */
   s = str;
   /* Fixup the opcode string to all lower cases, and also
      allow numerical digits.  */
   s = str;
@@ -809,30 +693,19 @@ machine_ip (str)
       return;
     }
 
       return;
     }
 
-  /* Hash the opcode, insn will have the string from opcode table.
-     also initialized the_insn struct.  */
+  /* Hash the opcode, insn will have the string from opcode table.  */
   if ((insn = (struct machine_opcode *) hash_find (op_hash, str)) == NULL)
     {
       /* Handle the ret and return macro here.  */
       if ((strcmp (str, "ret") == 0) || (strcmp (str, "return") == 0))
   if ((insn = (struct machine_opcode *) hash_find (op_hash, str)) == NULL)
     {
       /* Handle the ret and return macro here.  */
       if ((strcmp (str, "ret") == 0) || (strcmp (str, "return") == 0))
-       {
-         memset (&the_insn, '\0', sizeof (the_insn));
-         the_insn.reloc = NO_RELOC;
-         the_insn.pcrel = 0;
-         the_insn.opcode =
-           (unsigned long)(JROP | 0x03e00000);    /* 0x03e00000 = r31 << 21 */
-       }
+       the_insn.opcode = JROP | 0x03e00000;    /* 0x03e00000 = r31 << 21 */
       else
        as_bad (_("Unknown opcode `%s'."), str);
 
       return;
     }
 
       else
        as_bad (_("Unknown opcode `%s'."), str);
 
       return;
     }
 
-  argsStart = s;
   opcode = insn->opcode;
   opcode = insn->opcode;
-  memset (&the_insn, '\0', sizeof (the_insn));
-  the_insn.reloc = NO_RELOC;
-  the_insn.pcrel = 0;
 
   /* Set the sip reloc HI16 flag.  */
   if (!set_dlx_skip_hi16_flag (1))
 
   /* Set the sip reloc HI16 flag.  */
   if (!set_dlx_skip_hi16_flag (1))
@@ -903,10 +776,11 @@ machine_ip (str)
          /* Macro move operand/reg.  */
          if (operand->X_op == O_register)
            {
          /* Macro move operand/reg.  */
          if (operand->X_op == O_register)
            {
-             /* Its a register.  */
+             /* It's a register.  */
              reg_shift = 21;
              goto general_reg;
            }
              reg_shift = 21;
              goto general_reg;
            }
+         /* Fall through.  */
 
          /* The immediate 16 bits literal, bit 0-15.  */
        case 'i':
 
          /* The immediate 16 bits literal, bit 0-15.  */
        case 'i':
@@ -930,7 +804,7 @@ machine_ip (str)
              continue;
            }
 
              continue;
            }
 
-         the_insn.reloc        = (the_insn.HI) ? RELOC_DLX_HI16 
+         the_insn.reloc        = (the_insn.HI) ? RELOC_DLX_HI16
            : (the_insn.LO ? RELOC_DLX_LO16 : RELOC_DLX_16);
          the_insn.reloc_offset = 2;
          the_insn.size         = 2;
            : (the_insn.LO ? RELOC_DLX_LO16 : RELOC_DLX_16);
          the_insn.reloc_offset = 2;
          the_insn.size         = 2;
@@ -1012,111 +886,112 @@ machine_ip (str)
        }
 
       /* Types or values of args don't match.  */
        }
 
       /* Types or values of args don't match.  */
-      as_bad ("Invalid operands");
+      as_bad (_("Invalid operands"));
       return;
     }
 }
 
       return;
     }
 }
 
-/* This is identical to the md_atof in m68k.c.  I think this is right,
-   but I'm not sure.
-
-   Turn a string in input_line_pointer into a floating point constant
-   of type TYPE, and store the appropriate bytes in *LITP.  The number
-   of LITTLENUMS emitted is stored in *SIZEP.  An error message is
-   returned, or NULL on OK.  */
-/* Dlx will not use it anyway, so I just leave it here for now.  */
-
-/* Equal to MAX_PRECISION in atof-ieee.c.  */
-#define MAX_LITTLENUMS 6
-
-char *
-md_atof (type, litP, sizeP)
-     char type;
-     char *litP;
-     int *sizeP;
+/* Assemble a single instruction.  Its label has already been handled
+   by the generic front end.  We just parse opcode and operands, and
+   produce the bytes of data and relocation.  */
+
+void
+md_assemble (char *str)
 {
 {
-  int prec;
-  LITTLENUM_TYPE words[MAX_LITTLENUMS];
-  LITTLENUM_TYPE *wordP;
-  char *t;
+  char *toP;
+  fixS *fixP;
+  bit_fixS *bitP;
 
 
-  switch (type)
-    {
-    case 'f':
-    case 'F':
-    case 's':
-    case 'S':
-      prec = 2;
-      break;
+  know (str);
+  machine_ip (str);
+  toP = frag_more (4);
+  dwarf2_emit_insn (4);
 
 
-    case 'd':
-    case 'D':
-    case 'r':
-    case 'R':
-      prec = 4;
-      break;
+  /* Put out the opcode.  */
+  md_number_to_chars (toP, the_insn.opcode, 4);
 
 
-    case 'x':
-    case 'X':
-      prec = 6;
-      break;
+  /* Put out the symbol-dependent stuff.  */
+  if (the_insn.reloc != NO_RELOC)
+    {
+      fixP = fix_new_exp (frag_now,
+                         (toP - frag_now->fr_literal + the_insn.reloc_offset),
+                         the_insn.size, & the_insn.exp, the_insn.pcrel,
+                         the_insn.reloc);
 
 
-    case 'p':
-    case 'P':
-      prec = 6;
-      break;
+      /* Turn off complaints that the addend is
+        too large for things like foo+100000@ha.  */
+      switch (the_insn.reloc)
+       {
+       case RELOC_DLX_HI16:
+       case RELOC_DLX_LO16:
+         fixP->fx_no_overflow = 1;
+         break;
+       default:
+         break;
+       }
 
 
-    default:
-      *sizeP = 0;
-      return "Bad call to MD_ATOF()";
+      switch (fixP->fx_r_type)
+       {
+       case RELOC_DLX_REL26:
+         bitP = XNEW (bit_fixS);
+         bitP->fx_bit_size = 26;
+         bitP->fx_bit_offset = 25;
+         bitP->fx_bit_base = the_insn.opcode & 0xFC000000;
+         bitP->fx_bit_base_adj = 0;
+         bitP->fx_bit_max = 0;
+         bitP->fx_bit_min = 0;
+         bitP->fx_bit_add = 0x03FFFFFF;
+         fixP->fx_bit_fixP = bitP;
+         break;
+       case RELOC_DLX_LO16:
+       case RELOC_DLX_REL16:
+         bitP = XNEW (bit_fixS);
+         bitP->fx_bit_size = 16;
+         bitP->fx_bit_offset = 15;
+         bitP->fx_bit_base = the_insn.opcode & 0xFFFF0000;
+         bitP->fx_bit_base_adj = 0;
+         bitP->fx_bit_max = 0;
+         bitP->fx_bit_min = 0;
+         bitP->fx_bit_add = 0x0000FFFF;
+         fixP->fx_bit_fixP = bitP;
+         break;
+       case RELOC_DLX_HI16:
+         bitP = XNEW (bit_fixS);
+         bitP->fx_bit_size = 16;
+         bitP->fx_bit_offset = 15;
+         bitP->fx_bit_base = the_insn.opcode & 0xFFFF0000;
+         bitP->fx_bit_base_adj = 0;
+         bitP->fx_bit_max = 0;
+         bitP->fx_bit_min = 0;
+         bitP->fx_bit_add = 0x0000FFFF;
+         fixP->fx_bit_fixP = bitP;
+         break;
+       default:
+         fixP->fx_bit_fixP = NULL;
+         break;
+       }
     }
     }
+}
 
 
-  t = atof_ieee (input_line_pointer, type, words);
-  if (t)
-    input_line_pointer = t;
-
-  *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
-  for (wordP = words; prec--;)
-    {
-      md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
-      litP += sizeof (LITTLENUM_TYPE);
-    }
+/* This is identical to the md_atof in m68k.c.  I think this is right,
+   but I'm not sure.  Dlx will not use it anyway, so I just leave it
+   here for now.  */
 
 
-  return 0;
+const char *
+md_atof (int type, char *litP, int *sizeP)
+{
+  return ieee_md_atof (type, litP, sizeP, TRUE);
 }
 
 /* Write out big-endian.  */
 void
 }
 
 /* Write out big-endian.  */
 void
-md_number_to_chars (buf, val, n)
-     char *buf;
-     valueT val;
-     int n;
+md_number_to_chars (char *buf, valueT val, int n)
 {
   number_to_chars_bigendian (buf, val, n);
 }
 
 {
   number_to_chars_bigendian (buf, val, n);
 }
 
-/* md_chars_to_number:  convert from target byte order to host byte order.  */
-
-int
-md_chars_to_number (val, n)
-     unsigned char *val;       /* Value in target byte order.  */
-     int n;                    /* Number of bytes in the input.  */
-{
-  int retval;
-
-  for (retval = 0; n--;)
-    {
-      retval <<= 8;
-      retval |= val[n];
-    }
-
-  return retval;
-}
-
 bfd_boolean
 bfd_boolean
-md_dlx_fix_adjustable (fixP)
-   fixS *fixP;
+md_dlx_fix_adjustable (fixS *fixP)
 {
   /* We need the symbol name for the VTABLE entries.  */
   return (fixP->fx_r_type != BFD_RELOC_VTABLE_INHERIT
 {
   /* We need the symbol name for the VTABLE entries.  */
   return (fixP->fx_r_type != BFD_RELOC_VTABLE_INHERIT
@@ -1124,10 +999,7 @@ md_dlx_fix_adjustable (fixP)
 }
 
 void
 }
 
 void
-md_apply_fix3 (fixP, valP, seg)
-     fixS *fixP;
-     valueT *valP;
-     segT seg ATTRIBUTE_UNUSED;
+md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
 {
   long val = *valP;
   char *place = fixP->fx_where + fixP->fx_frag->fr_literal;
 {
   long val = *valP;
   char *place = fixP->fx_where + fixP->fx_frag->fr_literal;
@@ -1136,42 +1008,30 @@ md_apply_fix3 (fixP, valP, seg)
     {
     case RELOC_DLX_LO16:
     case RELOC_DLX_REL16:
     {
     case RELOC_DLX_LO16:
     case RELOC_DLX_REL16:
-      if (fixP->fx_bit_fixP != (bit_fixS *) NULL)
+      if (fixP->fx_bit_fixP != NULL)
        {
          val = (val & 0x0000FFFF) | fixP->fx_bit_fixP->fx_bit_base;
          free (fixP->fx_bit_fixP);
        {
          val = (val & 0x0000FFFF) | fixP->fx_bit_fixP->fx_bit_base;
          free (fixP->fx_bit_fixP);
-         fixP->fx_bit_fixP = (bit_fixS *) NULL;
+         fixP->fx_bit_fixP = NULL;
        }
        }
-#ifdef DEBUG
-      else
-       know ((fixP->fx_bit_fixP != (bit_fixS *) NULL));
-#endif
       break;
 
     case RELOC_DLX_HI16:
       break;
 
     case RELOC_DLX_HI16:
-      if (fixP->fx_bit_fixP != (bit_fixS *) NULL)
+      if (fixP->fx_bit_fixP != NULL)
        {
          val = (val >> 16) | fixP->fx_bit_fixP->fx_bit_base;
          free (fixP->fx_bit_fixP);
        {
          val = (val >> 16) | fixP->fx_bit_fixP->fx_bit_base;
          free (fixP->fx_bit_fixP);
-         fixP->fx_bit_fixP = (bit_fixS *)NULL;
+         fixP->fx_bit_fixP = NULL;
        }
        }
-#ifdef DEBUG
-      else
-       know ((fixP->fx_bit_fixP != (bit_fixS *) NULL));
-#endif
       break;
 
     case RELOC_DLX_REL26:
       break;
 
     case RELOC_DLX_REL26:
-      if (fixP->fx_bit_fixP != (bit_fixS *) NULL)
+      if (fixP->fx_bit_fixP != NULL)
        {
          val = (val & 0x03FFFFFF) | fixP->fx_bit_fixP->fx_bit_base;
          free (fixP->fx_bit_fixP);
        {
          val = (val & 0x03FFFFFF) | fixP->fx_bit_fixP->fx_bit_base;
          free (fixP->fx_bit_fixP);
-         fixP->fx_bit_fixP = (bit_fixS *) NULL;
+         fixP->fx_bit_fixP = NULL;
        }
        }
-#ifdef DEBUG
-      else
-       know ((fixP->fx_bit_fixP != (bit_fixS *) NULL));
-#endif
       break;
 
     case BFD_RELOC_VTABLE_INHERIT:
       break;
 
     case BFD_RELOC_VTABLE_INHERIT:
@@ -1194,6 +1054,8 @@ md_apply_fix3 (fixP, valP, seg)
   number_to_chars_bigendian (place, val, fixP->fx_size);
   if (fixP->fx_addsy == NULL)
     fixP->fx_done = 1;
   number_to_chars_bigendian (place, val, fixP->fx_size);
   if (fixP->fx_addsy == NULL)
     fixP->fx_done = 1;
+  if (fixP->fx_bit_fixP != NULL)
+    fixP->fx_no_overflow = 1;
 }
 
 const char *md_shortopts = "";
 }
 
 const char *md_shortopts = "";
@@ -1206,24 +1068,21 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (c, arg)
-     int c     ATTRIBUTE_UNUSED;
-     char *arg ATTRIBUTE_UNUSED;
+md_parse_option (int c     ATTRIBUTE_UNUSED,
+                const char *arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 
 void
 {
   return 0;
 }
 
 void
-md_show_usage (stream)
-     FILE *stream ATTRIBUTE_UNUSED;
+md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
 {
 }
 
 /* This is called when a line is unrecognized.  */
 
 int
 {
 }
 
 /* This is called when a line is unrecognized.  */
 
 int
-dlx_unrecognized_line (c)
-     int c;
+dlx_unrecognized_line (int c)
 {
   int lab;
   char *s;
 {
   int lab;
   char *s;
@@ -1241,10 +1100,8 @@ dlx_unrecognized_line (c)
     }
 
   if (*s != ':')
     }
 
   if (*s != ':')
-    {
-      /* Not a label definition.  */
-      return 0;
-    }
+    /* Not a label definition.  */
+    return 0;
 
   if (dollar_label_defined (lab))
     {
 
   if (dollar_label_defined (lab))
     {
@@ -1264,20 +1121,17 @@ dlx_unrecognized_line (c)
    are a lot of them.  */
 
 symbolS *
    are a lot of them.  */
 
 symbolS *
-md_undefined_symbol (name)
-     char *name ATTRIBUTE_UNUSED;
+md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
 {
   return NULL;
 }
 
 {
   return NULL;
 }
 
-
 /* Parse an operand that is machine-specific, the function was called
    in expr.c by operand() function, when everything failed before it
    call a quit.  */
 
 void
 /* Parse an operand that is machine-specific, the function was called
    in expr.c by operand() function, when everything failed before it
    call a quit.  */
 
 void
-md_operand (expressionP)
-     expressionS* expressionP;
+md_operand (expressionS* expressionP)
 {
   /* Check for the #number representation    */
   if (input_line_pointer[0] == '#' &&
 {
   /* Check for the #number representation    */
   if (input_line_pointer[0] == '#' &&
@@ -1298,9 +1152,8 @@ md_operand (expressionP)
 /* Round up a section size to the appropriate boundary.  */
 
 valueT
 /* Round up a section size to the appropriate boundary.  */
 
 valueT
-md_section_align (segment, size)
-     segT segment ATTRIBUTE_UNUSED;
-     valueT size;
+md_section_align (segT segment ATTRIBUTE_UNUSED,
+                 valueT size)
 {
   /* Byte alignment is fine.  */
   return size;
 {
   /* Byte alignment is fine.  */
   return size;
@@ -1311,8 +1164,7 @@ md_section_align (segment, size)
    which we have set up as the address of the fixup too.  */
 
 long
    which we have set up as the address of the fixup too.  */
 
 long
-md_pcrel_from (fixP)
-     fixS* fixP;
+md_pcrel_from (fixS* fixP)
 {
   return 4 + fixP->fx_where + fixP->fx_frag->fr_address;
 }
 {
   return 4 + fixP->fx_where + fixP->fx_frag->fr_address;
 }
@@ -1323,27 +1175,26 @@ md_pcrel_from (fixP)
    The above FIXME is from a29k, but I think it is also needed here.    */
 
 arelent *
    The above FIXME is from a29k, but I think it is also needed here.    */
 
 arelent *
-tc_gen_reloc (section, fixP)
-     asection *section ATTRIBUTE_UNUSED;
-     fixS *fixP;
+tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
+             fixS *fixP)
 {
   arelent * reloc;
 
 {
   arelent * reloc;
 
-  reloc = (arelent *) xmalloc (sizeof (arelent));
+  reloc = XNEW (arelent);
   reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
 
   reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
 
-  if (reloc->howto == (reloc_howto_type *) NULL)
+  if (reloc->howto == NULL)
     {
       as_bad_where (fixP->fx_file, fixP->fx_line,
     {
       as_bad_where (fixP->fx_file, fixP->fx_line,
-                   "internal error: can't export reloc type %d (`%s')",
+                   _("internal error: can't export reloc type %d (`%s')"),
                    fixP->fx_r_type,
                    bfd_get_reloc_code_name (fixP->fx_r_type));
       return NULL;
     }
 
                    fixP->fx_r_type,
                    bfd_get_reloc_code_name (fixP->fx_r_type));
       return NULL;
     }
 
-  assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
+  gas_assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
 
 
-  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  reloc->sym_ptr_ptr = XNEW (asymbol *);
   *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
   reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
 
   *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
   reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
 
@@ -1354,10 +1205,21 @@ tc_gen_reloc (section, fixP)
   return reloc;
 }
 
   return reloc;
 }
 
-extern void pop_insert PARAMS ((const pseudo_typeS *));
+const pseudo_typeS
+dlx_pseudo_table[] =
+{
+  /* Some additional ops that are used by gcc-dlx.  */
+  {"asciiz", stringer, 8 + 1},
+  {"half", cons, 2},
+  {"dword", cons, 8},
+  {"word", cons, 4},
+  {"proc", s_proc, 0},
+  {"endproc", s_proc, 1},
+  {NULL, NULL, 0}
+};
 
 void
 
 void
-dlx_pop_insert ()
+dlx_pop_insert (void)
 {
   pop_insert (dlx_pseudo_table);
   return ;
 {
   pop_insert (dlx_pseudo_table);
   return ;
This page took 0.033632 seconds and 4 git commands to generate.