Automatic date update in version.in
[deliverable/binutils-gdb.git] / gas / config / tc-xstormy16.c
index 1f84ddacbbca23df8d93976908da930ba2f70181..1c708b63625f75be673aaa36a072f0db9cf3d55f 100644 (file)
@@ -1,11 +1,11 @@
 /* tc-xstormy16.c -- Assembler for the Sanyo XSTORMY16.
-   Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation.
+   Copyright (C) 2000-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
-   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,7 +18,6 @@
    the Free Software Foundation, 51 Franklin Street - Fifth Floor,
    Boston, MA 02110-1301, USA.  */
 
-#include <stdio.h>
 #include "as.h"
 #include "subsegs.h"
 #include "symcat.h"
@@ -67,7 +66,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 
 int
 md_parse_option (int    c ATTRIBUTE_UNUSED,
-                char * arg ATTRIBUTE_UNUSED)
+                const char * arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
@@ -122,7 +121,7 @@ md_assemble (char * str)
 
   if (!insn.insn)
     {
-      as_bad (errmsg);
+      as_bad ("%s", errmsg);
       return;
     }
 
@@ -143,7 +142,7 @@ md_operand (expressionS * e)
       SKIP_WHITESPACE ();
       if (*input_line_pointer != '(')
        {
-         as_bad ("Expected '('");
+         as_bad (_("Expected '('"));
          goto err;
        }
       input_line_pointer++;
@@ -152,14 +151,14 @@ md_operand (expressionS * e)
 
       if (*input_line_pointer != ')')
        {
-         as_bad ("Missing ')'");
+         as_bad (_("Missing ')'"));
          goto err;
        }
       input_line_pointer++;
       SKIP_WHITESPACE ();
 
       if (e->X_op != O_symbol)
-       as_bad ("Not a symbolic expression");
+       as_bad (_("Not a symbolic expression"));
       else if (* input_line_pointer == '-')
        /* We are computing the difference of two function pointers
           like this:
@@ -194,11 +193,9 @@ void
 xstormy16_cons_fix_new (fragS *f,
                        int where,
                        int nbytes,
-                       expressionS *exp)
+                       expressionS *exp,
+                       bfd_reloc_code_real_type code)
 {
-  bfd_reloc_code_real_type code;
-  fixS *fix;
-
   if (exp->X_op == O_fptr_symbol)
     {
       switch (nbytes)
@@ -207,9 +204,9 @@ xstormy16_cons_fix_new (fragS *f,
          /* This can happen when gcc is generating debug output.
             For example it can create a stab with the address of
             a function:
-            
+
                .stabs  "foo:F(0,21)",36,0,0,@fptr(foo)
+
             Since this does not involve switching code pages, we
             just allow the reloc to be generated without any
             @fptr behaviour.  */
@@ -223,7 +220,7 @@ xstormy16_cons_fix_new (fragS *f,
          break;
 
        default:
-         as_bad ("unsupported fptr fixup size %d", nbytes);
+         as_bad (_("unsupported fptr fixup size %d"), nbytes);
          return;
        }
     }
@@ -235,11 +232,11 @@ xstormy16_cons_fix_new (fragS *f,
     code = BFD_RELOC_32;
   else
     {
-      as_bad ("unsupported fixup size %d", nbytes);
+      as_bad (_("unsupported fixup size %d"), nbytes);
       return;
     }
 
-  fix = fix_new_exp (f, where, nbytes, exp, 0, code);
+  fix_new_exp (f, where, nbytes, exp, 0, code);
 }
 
 /* Called while parsing an instruction to create a fixup.
@@ -266,7 +263,7 @@ xstormy16_cgen_record_fixup_exp (fragS *              frag,
   if (op == O_fptr_symbol)
     {
       if (operand->type != XSTORMY16_OPERAND_IMM16)
-       as_bad ("unsupported fptr fixup");
+       as_bad (_("unsupported fptr fixup"));
       else
        {
          fixP->fx_r_type = BFD_RELOC_XSTORMY16_FPTR16;
@@ -280,9 +277,9 @@ xstormy16_cgen_record_fixup_exp (fragS *              frag,
 valueT
 md_section_align (segT segment, valueT size)
 {
-  int align = bfd_get_section_alignment (stdoutput, segment);
+  int align = bfd_section_alignment (segment);
 
-  return ((size + (1 << align) - 1) & (-1 << align));
+  return ((size + (1 << align) - 1) & -(1 << align));
 }
 
 symbolS *
@@ -340,7 +337,7 @@ md_pcrel_from_section (fixS * fixP, segT sec)
       || xstormy16_force_relocation (fixP))
     /* The symbol is undefined,
        or it is defined but not in this section,
-       or the relocation will be relative to this symbol not the section symbol.        
+       or the relocation will be relative to this symbol not the section symbol.
        Let the linker figure it out.  */
     return 0;
 
@@ -385,6 +382,7 @@ md_cgen_lookup_reloc (const CGEN_INSN *    insn ATTRIBUTE_UNUSED,
 
     case XSTORMY16_OPERAND_REL8_4:
       fixP->fx_addnumber -= 2;
+      /* Fall through.  */
     case XSTORMY16_OPERAND_REL8_2:
       fixP->fx_addnumber -= 2;
       fixP->fx_pcrel = 1;
@@ -392,7 +390,7 @@ md_cgen_lookup_reloc (const CGEN_INSN *    insn ATTRIBUTE_UNUSED,
 
     case XSTORMY16_OPERAND_REL12:
       fixP->fx_where += 2;
-      /* Fall through...  */
+      /* Fall through.  */
     case XSTORMY16_OPERAND_REL12A:
       fixP->fx_addnumber -= 2;
       fixP->fx_pcrel = 1;
@@ -433,11 +431,11 @@ xstormy16_fix_adjustable (fixS * fixP)
   return TRUE;
 }
 
-/* This is a copy of gas_cgen_md_apply_fix3, with some enhancements to
+/* This is a copy of gas_cgen_md_apply_fix, with some enhancements to
    do various things that would not be valid for all ports.  */
 
 void
-xstormy16_md_apply_fix3 (fixS *   fixP,
+xstormy16_md_apply_fix (fixS *   fixP,
                         valueT * valueP,
                         segT     seg ATTRIBUTE_UNUSED)
 {
@@ -489,13 +487,14 @@ xstormy16_md_apply_fix3 (fixS *   fixP,
       const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (cd, opindex);
       const char *errmsg;
       bfd_reloc_code_real_type reloc_type;
-      CGEN_FIELDS *fields = alloca (CGEN_CPU_SIZEOF_FIELDS (cd));
       const CGEN_INSN *insn = fixP->fx_cgen.insn;
 
       /* If the reloc has been fully resolved finish the operand here.  */
       /* FIXME: This duplicates the capabilities of code in BFD.  */
       if (fixP->fx_done)
        {
+         CGEN_FIELDS *fields = xmalloc (CGEN_CPU_SIZEOF_FIELDS (cd));
+
          CGEN_CPU_SET_FIELDS_BITSIZE (cd) (fields, CGEN_INSN_BITSIZE (insn));
          CGEN_CPU_SET_VMA_OPERAND (cd) (cd, opindex, fields, (bfd_vma) value);
 
@@ -519,6 +518,8 @@ xstormy16_md_apply_fix3 (fixS *   fixP,
 #endif
          if (errmsg)
            as_bad_where (fixP->fx_file, fixP->fx_line, "%s", errmsg);
+
+         free (fields);
        }
 
       if (fixP->fx_done)
@@ -596,54 +597,8 @@ md_number_to_chars (char * buf, valueT val, int n)
   number_to_chars_littleendian (buf, val, n);
 }
 
-/* Turn a string in input_line_pointer into a floating point constant of type
-   type, and store the appropriate bytes in *litP.  The number of LITTLENUMS
-   emitted is stored in *sizeP .  An error message is returned, or NULL on OK.
-*/
-
-/* Equal to MAX_PRECISION in atof-ieee.c */
-#define MAX_LITTLENUMS 6
-
-char *
+const char *
 md_atof (int type, char * litP, int * sizeP)
 {
-  int              prec;
-  LITTLENUM_TYPE   words [MAX_LITTLENUMS];
-  LITTLENUM_TYPE   *wordP;
-  char *           t;
-
-  switch (type)
-    {
-    case 'f':
-    case 'F':
-      prec = 2;
-      break;
-
-    case 'd':
-    case 'D':
-      prec = 4;
-      break;
-
-   /* FIXME: Some targets allow other format chars for bigger sizes here.  */
-
-    default:
-      * sizeP = 0;
-      return _("Bad call to md_atof()");
-    }
-
-  t = atof_ieee (input_line_pointer, type, words);
-  if (t)
-    input_line_pointer = t;
-  * sizeP = prec * sizeof (LITTLENUM_TYPE);
-
-  *sizeP = prec * sizeof (LITTLENUM_TYPE);
-  /* This loops outputs the LITTLENUMs in REVERSE order; in accord with
-     the littleendianness of the processor.  */
-  for (wordP = words + prec - 1; prec--;)
-    {
-      md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
-      litP += sizeof (LITTLENUM_TYPE);
-    }
-
-  return 0;
+  return ieee_md_atof (type, litP, sizeP, FALSE);
 }
This page took 0.027459 seconds and 4 git commands to generate.