[ARM] Fix NULL dereference of march_ext_opt
[deliverable/binutils-gdb.git] / gas / config / tc-i370.c
index 08a665fdf99cc4cc44345241d9cb76015bc5e2aa..bd2439047baa4ef2b3a9bc2a6f37fc596a20ee39 100644 (file)
@@ -1,14 +1,13 @@
 /* tc-i370.c -- Assembler for the IBM 360/370/390 instruction set.
    Loosely based on the ppc files by Linas Vepstas <linas@linas.org> 1998, 99
-   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1994-2018 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    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,
@@ -18,8 +17,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
-   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 /* This assembler implements a very hacked version of an elf-like thing
    that gcc emits (when gcc is suitably hacked).  To make it behave more
@@ -27,7 +26,6 @@
    similarities between HLASM and the MRI assemblers, such as section
    names, lack of leading . in pseudo-ops, DC and DS, etc.  */
 
-#include <stdio.h>
 #include "as.h"
 #include "safe-ctype.h"
 #include "subsegs.h"
@@ -104,7 +102,7 @@ static bfd_boolean reg_names_p = TARGET_REG_NAMES_P;
 /* Structure to hold information about predefined registers.  */
 struct pd_reg
   {
-    char *name;
+    const char *name;
     int value;
   };
 
@@ -271,14 +269,14 @@ register_name (expressionS *expressionP)
     reg_number = get_single_number ();
   else
     {
-      c = get_symbol_end ();
+      c = get_symbol_name (&name);
       reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name);
 
       /* Put back the delimiting char.  */
-      *input_line_pointer = c;
+      (void) restore_line_pointer (c);
     }
 
-  /* If numeric, make sure its not out of bounds.  */
+  /* If numeric, make sure it's not out of bounds.  */
   if ((0 <= reg_number) && (16 >= reg_number))
     {
       expressionP->X_op = O_register;
@@ -360,7 +358,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
@@ -417,7 +415,7 @@ md_parse_option (int c, char *arg)
 #endif
       else
         {
-          as_bad ("invalid switch -m%s", arg);
+          as_bad (_("invalid switch -m%s"), arg);
           return 0;
         }
       break;
@@ -445,7 +443,7 @@ md_parse_option (int c, char *arg)
 \f
 /* Set i370_cpu if it is not already set.
    Currently defaults to the reasonable superset;
-   but can be made more fine grained if desred.  */
+   but can be made more fine grained if desired.  */
 
 static void
 i370_set_cpu (void)
@@ -514,7 +512,7 @@ md_begin (void)
            retval = hash_insert (i370_hash, op->name, (void *) op);
            if (retval != (const char *) NULL)
              {
-               as_bad ("Internal assembler error for instruction %s", op->name);
+               as_bad (_("Internal assembler error for instruction %s"), op->name);
                dup_insn = TRUE;
              }
          }
@@ -533,7 +531,7 @@ md_begin (void)
           retval = hash_insert (i370_macro_hash, macro->name, (void *) macro);
           if (retval != (const char *) NULL)
             {
-              as_bad ("Internal assembler error for macro %s", macro->name);
+              as_bad (_("Internal assembler error for macro %s"), macro->name);
               dup_insn = TRUE;
             }
         }
@@ -584,7 +582,7 @@ i370_elf_suffix (char **str_p, expressionS *exp_p)
 {
   struct map_bfd
   {
-    char *string;
+    const char *string;
     int length;
     bfd_reloc_code_real_type reloc;
   };
@@ -628,7 +626,7 @@ i370_elf_suffix (char **str_p, expressionS *exp_p)
                || ptr->reloc == BFD_RELOC_LO16_GOTOFF
                || ptr->reloc == BFD_RELOC_HI16_GOTOFF
                || ptr->reloc == BFD_RELOC_HI16_S_GOTOFF))
-          as_warn ("identifier+constant@got means identifier@got+constant");
+          as_warn (_("identifier+constant@got means identifier@got+constant"));
 
         /* Now check for identifier@suffix+constant */
         if (*str == '-' || *str == '+')
@@ -682,7 +680,10 @@ i370_elf_cons (int nbytes)   /* 1=.byte, 2=.word, 4=.long.  */
           int size = bfd_get_reloc_size (reloc_howto);
 
           if (size > nbytes)
-            as_bad ("%s relocations do not fit in %d bytes\n", reloc_howto->name, nbytes);
+           as_bad (ngettext ("%s relocations do not fit in %u byte",
+                             "%s relocations do not fit in %u bytes",
+                             nbytes),
+                   reloc_howto->name, nbytes);
           else
             {
               char *p = frag_more ((int) nbytes);
@@ -888,7 +889,7 @@ i370_csect (int unused ATTRIBUTE_UNUSED)
 
 \f
 /* DC Define Const  is only partially supported.
-   For samplecode on what to do, look at i370_elf_cons() above.
+   For sample code on what to do, look at i370_elf_cons() above.
    This code handles pseudoops of the style
    DC   D'3.141592653'   # in sysv4, .double 3.14159265
    DC   F'1'             # in sysv4, .long   1.  */
@@ -900,6 +901,7 @@ i370_dc (int unused ATTRIBUTE_UNUSED)
   int nbytes=0;
   expressionS exp;
   char type=0;
+  char * clse;
 
   if (is_it_end_of_statement ())
     {
@@ -922,33 +924,29 @@ i370_dc (int unused ATTRIBUTE_UNUSED)
       nbytes = 8;
       break;
     default:
-      as_bad ("unsupported DC type");
+      as_bad (_("unsupported DC type"));
       return;
     }
 
   /* Get rid of pesky quotes.  */
   if ('\'' == *input_line_pointer)
     {
-      char * close;
-
       ++input_line_pointer;
-      close = strchr (input_line_pointer, '\'');
-      if (close)
-       *close= ' ';
+      clse = strchr (input_line_pointer, '\'');
+      if (clse)
+       *clse= ' ';
       else
-       as_bad ("missing end-quote");
+       as_bad (_("missing end-quote"));
     }
 
   if ('\"' == *input_line_pointer)
     {
-      char * close;
-
       ++input_line_pointer;
-      close = strchr (input_line_pointer, '\"');
-      if (close)
-       *close= ' ';
+      clse = strchr (input_line_pointer, '\"');
+      if (clse)
+       *clse= ' ';
       else
-       as_bad ("missing end-quote");
+       as_bad (_("missing end-quote"));
     }
 
   switch (type)
@@ -959,13 +957,15 @@ i370_dc (int unused ATTRIBUTE_UNUSED)
       emit_expr (&exp, nbytes);
       break;
     case 'E':  /* 32-bit */
+      type = 'f';
+      /* Fall through.  */
     case 'D':  /* 64-bit */
       md_atof (type, tmp, &nbytes);
       p = frag_more (nbytes);
       memcpy (p, tmp, nbytes);
       break;
     default:
-      as_bad ("unsupported DC type");
+      as_bad (_("unsupported DC type"));
       return;
     }
 
@@ -995,14 +995,14 @@ i370_ds (int unused ATTRIBUTE_UNUSED)
          alignment = 3;
          break;
        default:
-         as_bad ("unsupported alignment");
+         as_bad (_("unsupported alignment"));
          return;
        }
       frag_align (alignment, 0, 0);
       record_alignment (now_seg, alignment);
     }
   else
-    as_bad ("this DS form not yet supported");
+    as_bad (_("this DS form not yet supported"));
 }
 
 /* Solaris pseudo op to change to the .rodata section.  */
@@ -1036,16 +1036,15 @@ i370_elf_lcomm (int unused ATTRIBUTE_UNUSED)
   char *pfrag;
   int align2;
 
-  name = input_line_pointer;
-  c = get_symbol_end ();
+  c = get_symbol_name (&name);
 
   /* Just after name is now '\0'.  */
   p = input_line_pointer;
-  *p = c;
+  (void) restore_line_pointer (c);
   SKIP_WHITESPACE ();
   if (*input_line_pointer != ',')
     {
-      as_bad ("Expected comma after symbol-name: rest of line ignored.");
+      as_bad (_("Expected comma after symbol-name: rest of line ignored."));
       ignore_rest_of_line ();
       return;
     }
@@ -1054,7 +1053,7 @@ i370_elf_lcomm (int unused ATTRIBUTE_UNUSED)
   input_line_pointer++;
   if ((size = get_absolute_expression ()) < 0)
     {
-      as_warn (".COMMon length (%ld.) <0! Ignored.", (long) size);
+      as_warn (_(".COMMon length (%ld.) <0! Ignored."), (long) size);
       ignore_rest_of_line ();
       return;
     }
@@ -1068,7 +1067,7 @@ i370_elf_lcomm (int unused ATTRIBUTE_UNUSED)
       align = get_absolute_expression ();
       if (align <= 0)
         {
-          as_warn ("ignoring bad alignment");
+          as_warn (_("ignoring bad alignment"));
           align = 8;
         }
     }
@@ -1079,7 +1078,7 @@ i370_elf_lcomm (int unused ATTRIBUTE_UNUSED)
 
   if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP))
     {
-      as_bad ("Ignoring attempt to re-define symbol `%s'.",
+      as_bad (_("Ignoring attempt to re-define symbol `%s'."),
               S_GET_NAME (symbolP));
       ignore_rest_of_line ();
       return;
@@ -1087,7 +1086,7 @@ i370_elf_lcomm (int unused ATTRIBUTE_UNUSED)
 
   if (S_GET_VALUE (symbolP) && S_GET_VALUE (symbolP) != (valueT) size)
     {
-      as_bad ("Length of .lcomm \"%s\" is already %ld. Not changed to %ld.",
+      as_bad (_("Length of .lcomm \"%s\" is already %ld. Not changed to %ld."),
               S_GET_NAME (symbolP),
               (long) S_GET_VALUE (symbolP),
               (long) size);
@@ -1106,7 +1105,7 @@ i370_elf_lcomm (int unused ATTRIBUTE_UNUSED)
        ;
       if (align != 1)
         {
-          as_bad ("Common alignment not a power of 2");
+          as_bad (_("Common alignment not a power of 2"));
           ignore_rest_of_line ();
           return;
         }
@@ -1188,9 +1187,9 @@ i370_elf_validate_fix (fixS *fixp, segT seg)
    waste space padding out to alignments.  The four pointers
    longlong_poolP, word_poolP, etc. point to a symbol labeling the
    start of each pool part.
+
    lit_pool_num increments from zero to infinity and uniquely id's
-     -- its used to generate the *_poolP symbol name.  */
+     -- it's used to generate the *_poolP symbol name.  */
 
 #define MAX_LITERAL_POOL_SIZE 1024
 
@@ -1244,7 +1243,7 @@ i370_make_relative (expressionS *exx, expressionS *baseaddr)
        exx->X_add_number += baseaddr->X_add_number;
     }
   else
-    as_bad ("Missing or bad .using directive");
+    as_bad (_("Missing or bad .using directive"));
 }
 /* Add an expression to the literal pool.  */
 
@@ -1289,7 +1288,7 @@ add_to_lit_pool (expressionS *exx, char *name, int sz)
   if (lit_count == next_literal_pool_place) /* new entry */
     {
       if (next_literal_pool_place > MAX_LITERAL_POOL_SIZE)
-       as_bad ("Literal Pool Overflow");
+       as_bad (_("Literal Pool Overflow"));
 
       literals[next_literal_pool_place].exp = *exx;
       literals[next_literal_pool_place].size = sz;
@@ -1328,11 +1327,11 @@ add_to_lit_pool (expressionS *exx, char *name, int sz)
 /* The symbol setup for the literal pool is done in two steps.  First,
    a symbol that represents the start of the literal pool is created,
    above, in the add_to_pool() routine. This sym ???_poolP.
-   However, we don't know what fragment its in until a bit later.
+   However, we don't know what fragment it's in until a bit later.
    So we defer the frag_now thing, and the symbol name, until .ltorg time.  */
 
 /* Can't use symbol_new here, so have to create a symbol and then at
-   a later date assign it a value. Thats what these functions do.  */
+   a later date assign it a value. That's what these functions do.  */
 
 static void
 symbol_locate (symbolS *symbolP,
@@ -1379,7 +1378,7 @@ symbol_locate (symbolS *symbolP,
 }
 
 /* i370_addr_offset() will convert operand expressions
-   that appear to be absolute into thier base-register
+   that appear to be absolute into their base-register
    relative form.  These expressions come in two types:
 
    (1) of the form "* + const" * where "*" means
@@ -1485,7 +1484,7 @@ i370_addr_cons (expressionS *exp)
       expression (exp);
 
       /* We use a simple string name to collapse together
-         multiple refrences to the same address literal.  */
+         multiple references to the same address literal.  */
       name_len = strcspn (sym_name, ", ");
       delim = *(sym_name + name_len);
       *(sym_name + name_len) = 0x0;
@@ -1522,23 +1521,25 @@ i370_addr_cons (expressionS *exp)
       /* Get rid of pesky quotes.  */
       if ('\'' == *input_line_pointer)
        {
-         char * close;
+         char * clse;
+
          ++input_line_pointer;
-         close = strchr (input_line_pointer, '\'');
-         if (close)
-           *close= ' ';
+         clse = strchr (input_line_pointer, '\'');
+         if (clse)
+           *clse= ' ';
          else
-           as_bad ("missing end-quote");
+           as_bad (_("missing end-quote"));
        }
       if ('\"' == *input_line_pointer)
        {
-         char * close;
+         char * clse;
+
          ++input_line_pointer;
-         close = strchr (input_line_pointer, '\"');
-         if (close)
-           *close= ' ';
+         clse = strchr (input_line_pointer, '\"');
+         if (clse)
+           *clse= ' ';
          else
-           as_bad ("missing end-quote");
+           as_bad (_("missing end-quote"));
        }
       if (('X' == name[0]) || ('E' == name[0]) || ('D' == name[0]))
        {
@@ -1550,7 +1551,7 @@ i370_addr_cons (expressionS *exp)
             =X'AB'       one byte
             =X'abcd'     two bytes
             =X'000000AB' four bytes
-            =XL4'AB'     four bytes, left-padded withn zero.  */
+            =XL4'AB'     four bytes, left-padded with zero.  */
          if (('X' == name[0]) && (0 > cons_len))
            {
              save = input_line_pointer;
@@ -1585,14 +1586,14 @@ i370_addr_cons (expressionS *exp)
       /* O_big occurs when more than 4 bytes worth gets parsed.  */
       if ((exp->X_op != O_constant) && (exp->X_op != O_big))
        {
-         as_bad ("expression not a constant");
+         as_bad (_("expression not a constant"));
          return FALSE;
        }
       add_to_lit_pool (exp, 0x0, cons_len);
       break;
 
     default:
-      as_bad ("Unknown/unsupported address literal type");
+      as_bad (_("Unknown/unsupported address literal type"));
       return FALSE;
     }
 
@@ -1615,11 +1616,11 @@ i370_ltorg (int ignore ATTRIBUTE_UNUSED)
   if (strncmp (now_seg->name, ".text", 5))
     {
       if (i370_other_section == undefined_section)
-       as_bad (".ltorg without prior .using in section %s",
+       as_bad (_(".ltorg without prior .using in section %s"),
                now_seg->name);
 
       if (i370_other_section != now_seg)
-       as_bad (".ltorg in section %s paired to .using in section %s",
+       as_bad (_(".ltorg in section %s paired to .using in section %s"),
                now_seg->name, i370_other_section->name);
     }
 
@@ -1642,7 +1643,7 @@ i370_ltorg (int ignore ATTRIBUTE_UNUSED)
   else if (2 == biggest_literal_size) biggest_align = 1;
   else if (4 == biggest_literal_size) biggest_align = 2;
   else if (8 == biggest_literal_size) biggest_align = 3;
-  else as_bad ("bad alignment of %d bytes in literal pool", biggest_literal_size);
+  else as_bad (_("bad alignment of %d bytes in literal pool"), biggest_literal_size);
   if (0 == biggest_align) biggest_align = 1;
 
   /* Align pool for short, word, double word accesses.  */
@@ -1666,7 +1667,7 @@ i370_ltorg (int ignore ATTRIBUTE_UNUSED)
        case 1:
          current_poolP = byte_poolP; break;
        default:
-         as_bad ("bad literal size\n");
+         as_bad (_("bad literal size\n"));
        }
       if (NULL == current_poolP)
        continue;
@@ -1740,7 +1741,7 @@ i370_using (int ignore ATTRIBUTE_UNUSED)
   if (O_constant != baseaddr.X_op
       && O_symbol != baseaddr.X_op
       && O_uminus != baseaddr.X_op)
-    as_bad (".using: base address expression illegal or too complex");
+    as_bad (_(".using: base address expression illegal or too complex"));
 
   if (*input_line_pointer != '\0') ++input_line_pointer;
 
@@ -1775,7 +1776,7 @@ i370_drop (int ignore ATTRIBUTE_UNUSED)
   if (0 == strncmp (now_seg->name, ".text", 5))
     {
       if (iregno != i370_using_text_regno)
-       as_bad ("droping register %d in section %s does not match using register %d",
+       as_bad (_("dropping register %d in section %s does not match using register %d"),
                iregno, now_seg->name, i370_using_text_regno);
 
       i370_using_text_regno = -1;
@@ -1784,11 +1785,11 @@ i370_drop (int ignore ATTRIBUTE_UNUSED)
   else
     {
       if (iregno != i370_using_other_regno)
-       as_bad ("droping register %d in section %s does not match using register %d",
+       as_bad (_("dropping register %d in section %s does not match using register %d"),
                iregno, now_seg->name, i370_using_other_regno);
 
       if (i370_other_section != now_seg)
-       as_bad ("droping register %d in section %s previously used in section %s",
+       as_bad (_("dropping register %d in section %s previously used in section %s"),
                iregno, now_seg->name, i370_other_section->name);
 
       i370_using_other_regno = -1;
@@ -1844,7 +1845,7 @@ i370_macro (char *str, const struct i370_macro *macro)
 
   if (count != macro->operands)
     {
-      as_bad ("wrong number of operands");
+      as_bad (_("wrong number of operands"));
       return;
     }
 
@@ -1869,7 +1870,7 @@ i370_macro (char *str, const struct i370_macro *macro)
     }
 
   /* Put the string together.  */
-  complete = s = alloca (len + 1);
+  complete = s = XNEWVEC (char, len + 1);
   format = macro->format;
   while (*format != '\0')
     {
@@ -1887,6 +1888,7 @@ i370_macro (char *str, const struct i370_macro *macro)
 
   /* Assemble the constructed instruction.  */
   md_assemble (complete);
+  free (complete);
 }
 
 /* This routine is called for each instruction to be assembled.  */
@@ -1894,7 +1896,7 @@ i370_macro (char *str, const struct i370_macro *macro)
 void
 md_assemble (char *str)
 {
-  char *s, *opcode_str;
+  char *s;
   const struct i370_opcode *opcode;
   i370_insn_t insn;
   const unsigned char *opindex_ptr;
@@ -1915,7 +1917,6 @@ md_assemble (char *str)
     ;
   if (*s != '\0')
     *s++ = '\0';
-  opcode_str = str;
 
   /* Look up the opcode in the hash table.  */
   opcode = (const struct i370_opcode *) hash_find (i370_hash, str);
@@ -1923,10 +1924,10 @@ md_assemble (char *str)
     {
       const struct i370_macro *macro;
 
-      assert (i370_macro_hash);
+      gas_assert (i370_macro_hash);
       macro = (const struct i370_macro *) hash_find (i370_macro_hash, str);
       if (macro == (const struct i370_macro *) NULL)
-        as_bad ("Unrecognized opcode: `%s'", str);
+        as_bad (_("Unrecognized opcode: `%s'"), str);
       else
        i370_macro (s, macro);
 
@@ -2010,9 +2011,9 @@ md_assemble (char *str)
     }
 
   /* Perform some off-by-one hacks on the length field of certain instructions.
-     Its such a shame to have to do this, but the problem is that HLASM got
+     It's such a shame to have to do this, but the problem is that HLASM got
      defined so that the lengths differ by one from the actual machine instructions.
-     this code should probably be moved to a special inster-operand routine.
+     this code should probably be moved to a special inter-operand routine.
      Sigh. Affected instructions are Compare Logical, Move and Exclusive OR
      hack alert -- aren't *all* SS instructions affected ??  */
   off_by_one = 0;
@@ -2033,12 +2034,10 @@ md_assemble (char *str)
   for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr++)
     {
       const struct i370_operand *operand;
-      const char *errmsg;
       char *hold;
       expressionS ex;
 
       operand = &i370_operands[*opindex_ptr];
-      errmsg = NULL;
 
       /* If this is an index operand, and we are skipping it,
         just insert a zero.  */
@@ -2071,7 +2070,7 @@ md_assemble (char *str)
                basereg = i370_using_other_regno;
             }
           if (0 > basereg)
-           as_bad ("not using any base register");
+           as_bad (_("not using any base register"));
 
           insn = i370_insert_operand (insn, operand, basereg);
           continue;
@@ -2101,8 +2100,8 @@ md_assemble (char *str)
             }
 
           if (! register_name (&ex))
-           as_bad ("expecting a register for operand %d",
-                   opindex_ptr - opcode->operands + 1);
+           as_bad (_("expecting a register for operand %d"),
+                   (int) (opindex_ptr - opcode->operands + 1));
         }
 
       /* Check for an address constant expression.  */
@@ -2118,16 +2117,16 @@ md_assemble (char *str)
       input_line_pointer = hold;
 
       /* Perform some off-by-one hacks on the length field of certain instructions.
-         Its such a shame to have to do this, but the problem is that HLASM got
+         It's such a shame to have to do this, but the problem is that HLASM got
          defined so that the programmer specifies a length that is one greater
          than what the machine instruction wants.  Sigh.  */
       if (off_by_one && (0 == strcasecmp ("SS L", operand->name)))
        ex.X_add_number --;
 
       if (ex.X_op == O_illegal)
-        as_bad ("illegal operand");
+        as_bad (_("illegal operand"));
       else if (ex.X_op == O_absent)
-        as_bad ("missing operand");
+        as_bad (_("missing operand"));
       else if (ex.X_op == O_register)
        insn = i370_insert_operand (insn, operand, ex.X_add_number);
       else if (ex.X_op == O_constant)
@@ -2207,7 +2206,7 @@ md_assemble (char *str)
     ++str;
 
   if (*str != '\0')
-    as_bad ("junk at end of line: `%s'", str);
+    as_bad (_("junk at end of line: `%s'"), str);
 
   /* Write out the instruction.  */
   f = frag_more (opcode->len);
@@ -2222,7 +2221,7 @@ md_assemble (char *str)
       else
        {
          /* Not used --- don't have any 8 byte instructions.  */
-         as_bad ("Internal Error: bad instruction length");
+         as_bad (_("Internal Error: bad instruction length"));
          md_number_to_chars ((f + 4), insn.i[1], opcode->len -4);
        }
     }
@@ -2232,7 +2231,7 @@ md_assemble (char *str)
      BFD_RELOC_UNUSED plus the operand index.  This lets us easily
      handle fixups for any operand type, although that is admittedly
      not a very exciting feature.  We pick a BFD reloc type in
-     md_apply_fix3.  */
+     md_apply_fix.  */
   for (i = 0; i < fc; i++)
     {
       const struct i370_operand *operand;
@@ -2252,7 +2251,7 @@ md_assemble (char *str)
          if (size < 1 || size > 4)
            abort ();
 
-         printf (" gwana doo fixup %d \n", i);
+         printf (" gwana do fixup %d \n", i);
          fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, size,
                              &fixups[i].exp, reloc_howto->pc_relative,
                              fixups[i].reloc);
@@ -2356,53 +2355,12 @@ i370_tc (int ignore ATTRIBUTE_UNUSED)
     }
 }
 \f
-/* Turn a string in input_line_pointer into a floating point constant
-   of type TYPE, and store the appropriate bytes in *LITP.  The number
-   of LITTLENUMS emitted is stored in *SIZEP.  An error message is
-   returned, or NULL on OK.  */
-
-char *
+const char *
 md_atof (int type, char *litp, int *sizep)
 {
-  int prec;
-  LITTLENUM_TYPE words[4];
-  char *t;
-  int i;
-
-  switch (type)
-    {
-    case 'f':
-    case 'E':
-      type = 'f';
-      prec = 2;
-      break;
-
-    case 'd':
-    case 'D':
-      type = 'd';
-      prec = 4;
-      break;
-
-    default:
-      *sizep = 0;
-      return "bad call to md_atof";
-    }
-
   /* 360/370/390 have two float formats: an old, funky 360 single-precision
-   * format, and the ieee format.  Support only the ieee format.  */
-  t = atof_ieee (input_line_pointer, type, words);
-  if (t)
-    input_line_pointer = t;
-
-  *sizep = prec * 2;
-
-  for (i = 0; i < prec; i++)
-    {
-      md_number_to_chars (litp, (valueT) words[i], 2);
-      litp += 2;
-    }
-
-  return NULL;
+     format, and the ieee format.  Support only the ieee format.  */
+  return ieee_md_atof (type, litp, sizep, TRUE);
 }
 
 /* Write a value out to the object file, using the appropriate
@@ -2421,7 +2379,7 @@ md_section_align (asection *seg, valueT addr)
 {
   int align = bfd_get_section_alignment (stdoutput, seg);
 
-  return (addr + (1 << align) - 1) & (-1 << align);
+  return (addr + (1 << align) - 1) & -(1 << align);
 }
 
 /* We don't have any form of relaxing.  */
@@ -2476,14 +2434,14 @@ md_pcrel_from_section (fixS *fixp, segT sec ATTRIBUTE_UNUSED)
    going on here.  */
 
 void
-md_apply_fix3 (fixS *fixP, valueT * valP, segT seg)
+md_apply_fix (fixS *fixP, valueT * valP, segT seg)
 {
   valueT value = * valP;
 
   if (fixP->fx_addsy != NULL)
     {
 #ifdef DEBUG
-      printf ("\nmd_apply_fix3: symbol %s at 0x%x (%s:%d) val=0x%x addend=0x%x\n",
+      printf ("\nmd_apply_fix: symbol %s at 0x%x (%s:%d) val=0x%x addend=0x%x\n",
              S_GET_NAME (fixP->fx_addsy),
              fixP->fx_frag->fr_address + fixP->fx_where,
              fixP->fx_file, fixP->fx_line,
@@ -2508,7 +2466,7 @@ md_apply_fix3 (fixS *fixP, valueT * valP, segT seg)
       operand = &i370_operands[opindex];
 
 #ifdef DEBUG
-      printf ("\nmd_apply_fix3: fixup operand %s at 0x%x in %s:%d addend=0x%x\n",
+      printf ("\nmd_apply_fix: fixup operand %s at 0x%x in %s:%d addend=0x%x\n",
              operand->name,
              fixP->fx_frag->fr_address + fixP->fx_where,
              fixP->fx_file, fixP->fx_line,
@@ -2541,10 +2499,10 @@ md_apply_fix3 (fixS *fixP, valueT * valP, segT seg)
         We are only prepared to turn a few of the operands into
         relocs.  In fact, we support *zero* operand relocations ...
         Why?  Because we are not expecting the compiler to generate
-        any operands that need relocation.  Due to the 12-bit naturew of
+        any operands that need relocation.  Due to the 12-bit nature of
         i370 addressing, this would be unusual.  */
         {
-          char *sfile;
+          const char *sfile;
           unsigned int sline;
 
           /* Use expr_symbol_where to see if this is an expression
@@ -2568,7 +2526,7 @@ md_apply_fix3 (fixS *fixP, valueT * valP, segT seg)
       i370_elf_validate_fix (fixP, seg);
 #endif
 #ifdef DEBUG
-      printf ("md_apply_fix3: reloc case %d in segment  %s %s:%d\n",
+      printf ("md_apply_fix: reloc case %d in segment  %s %s:%d\n",
              fixP->fx_r_type, segment_name (seg), fixP->fx_file, fixP->fx_line);
       printf ("\tcurrent fixup value is 0x%x \n", value);
 #endif
@@ -2648,9 +2606,9 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
 {
   arelent *reloc;
 
-  reloc = xmalloc (sizeof (arelent));
+  reloc = XNEW (arelent);
 
-  reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+  reloc->sym_ptr_ptr = XNEW (asymbol *);
   *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
   reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
@@ -2709,4 +2667,3 @@ const pseudo_typeS md_pseudo_table[] =
 
   { NULL,       NULL,          0 }
 };
-
This page took 0.034754 seconds and 4 git commands to generate.