gas output_file_close error message
[deliverable/binutils-gdb.git] / gas / config / tc-alpha.c
index 5762e41d85a52319510bde83aa4a7c4453969589..06432bf9b32ef85b7d62912c054b49ac87c361cc 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-alpha.c - Processor-specific code for the DEC Alpha AXP CPU.
-   Copyright (C) 1989-2015 Free Software Foundation, Inc.
+   Copyright (C) 1989-2020 Free Software Foundation, Inc.
    Contributed by Carnegie Mellon University, 1993.
    Written by Alessandro Forin, based on earlier gas-1.38 target CPU files.
    Modified by Ken Raeburn for gas-2.x and ECOFF support.
@@ -49,7 +49,6 @@
 
 #include "as.h"
 #include "subsegs.h"
-#include "struc-symbol.h"
 #include "ecoff.h"
 
 #include "opcode/alpha.h"
@@ -241,7 +240,7 @@ const char EXP_CHARS[] = "eE";
 /* Characters which mean that a number is a floating point constant,
    as in 0d1.0.  */
 /* XXX: Do all of these really get used on the alpha??  */
-char FLT_CHARS[] = "rRsSfFdDxXpP";
+const char FLT_CHARS[] = "rRsSfFdDxXpP";
 
 #ifdef OBJ_EVAX
 const char *md_shortopts = "Fm:g+1h:HG:";
@@ -298,10 +297,10 @@ static unsigned alpha_target = AXP_OPCODE_BASE;
 static const char *alpha_target_name = "<all>";
 
 /* The hash table of instruction opcodes.  */
-static struct hash_control *alpha_opcode_hash;
+static htab_t alpha_opcode_hash;
 
 /* The hash table of macro opcodes.  */
-static struct hash_control *alpha_macro_hash;
+static htab_t alpha_macro_hash;
 
 #ifdef OBJ_ECOFF
 /* The $gp relocation symbol.  */
@@ -515,7 +514,7 @@ struct alpha_reloc_tag
 };
 
 /* Hash table to link up literals with the appropriate lituse.  */
-static struct hash_control *alpha_literal_hash;
+static htab_t alpha_literal_hash;
 
 /* Sequence numbers for internal use by macros.  */
 static long next_sequence_num = -1;
@@ -578,7 +577,7 @@ static void assemble_insn (const struct alpha_opcode *, const expressionS *, int
 static void emit_insn (struct alpha_insn *);
 static void assemble_tokens (const char *, const expressionS *, int, int);
 #ifdef OBJ_EVAX
-static char *s_alpha_section_name (void);
+static const char *s_alpha_section_name (void);
 static symbolS *add_to_link_pool (symbolS *, offsetT);
 #endif
 \f
@@ -590,11 +589,10 @@ get_alpha_reloc_tag (long sequence)
 
   sprintf (buffer, "!%ld", sequence);
 
-  info = (struct alpha_reloc_tag *) hash_find (alpha_literal_hash, buffer);
+  info = (struct alpha_reloc_tag *) str_hash_find (alpha_literal_hash, buffer);
   if (! info)
     {
       size_t len = strlen (buffer);
-      const char *errmsg;
 
       info = (struct alpha_reloc_tag *)
           xcalloc (sizeof (struct alpha_reloc_tag) + len, 1);
@@ -602,9 +600,7 @@ get_alpha_reloc_tag (long sequence)
       info->segment = now_seg;
       info->sequence = sequence;
       strcpy (info->string, buffer);
-      errmsg = hash_insert (alpha_literal_hash, info->string, (void *) info);
-      if (errmsg)
-       as_fatal ("%s", errmsg);
+      str_hash_insert (alpha_literal_hash, info->string, info, 0);
 #ifdef OBJ_EVAX
       info->sym = 0;
       info->psym = 0;
@@ -706,7 +702,7 @@ alpha_adjust_relocs (bfd *abfd ATTRIBUTE_UNUSED,
      present.  Not implemented.
 
      Also suppress the optimization if the !literals/!lituses are spread
-     in different segments.  This can happen with "intersting" uses of
+     in different segments.  This can happen with "interesting" uses of
      inline assembly; examples are present in the Linux kernel semaphores.  */
 
   for (fixp = seginfo->fix_root; fixp; fixp = next)
@@ -1005,6 +1001,7 @@ tokenize_arguments (char *str,
            /* ... then fall through to plain expression.  */
            input_line_pointer = hold;
          }
+         /* Fall through.  */
 
        default:
          if (saw_arg && !saw_comma)
@@ -1021,7 +1018,7 @@ tokenize_arguments (char *str,
        }
     }
 
-fini:
+ fini:
   if (saw_comma)
     goto err;
   input_line_pointer = old_input_line_pointer;
@@ -1035,7 +1032,7 @@ fini:
 
   return ntok - (end_tok - tok);
 
-err:
+ err:
 #ifdef RELOC_OP_P
   is_end_of_line[(unsigned char) '!'] = 0;
 #endif
@@ -1043,7 +1040,7 @@ err:
   return TOKENIZE_ERROR;
 
 #ifdef RELOC_OP_P
-err_report:
+ err_report:
   is_end_of_line[(unsigned char) '!'] = 0;
 #endif
   input_line_pointer = old_input_line_pointer;
@@ -1171,7 +1168,8 @@ assemble_tokens_to_insn (const char *opname,
   const struct alpha_opcode *opcode;
 
   /* Search opcodes.  */
-  opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname);
+  opcode = (const struct alpha_opcode *) str_hash_find (alpha_opcode_hash,
+                                                       opname);
   if (opcode)
     {
       int cpumatch;
@@ -1205,10 +1203,9 @@ create_literal_section (const char *name,
 
   *secp = new_sec = subseg_new (name, 0);
   subseg_set (current_section, current_subsec);
-  bfd_set_section_alignment (stdoutput, new_sec, 4);
-  bfd_set_section_flags (stdoutput, new_sec,
-                        SEC_RELOC | SEC_ALLOC | SEC_LOAD | SEC_READONLY
-                        | SEC_DATA);
+  bfd_set_section_alignment (new_sec, 4);
+  bfd_set_section_flags (new_sec, (SEC_RELOC | SEC_ALLOC | SEC_LOAD
+                                  | SEC_READONLY | SEC_DATA));
 
   S_CLEAR_EXTERNAL (*symp = section_symbol (new_sec));
 }
@@ -1384,13 +1381,14 @@ load_expression (int targreg,
                    ptr1 = strstr (symname, "..") + 2;
                    if (ptr1 > ptr2)
                      ptr1 = symname;
-                   ensymname = (char *) alloca (ptr2 - ptr1 + 5);
+                   ensymname = XNEWVEC (char, ptr2 - ptr1 + 5);
                    memcpy (ensymname, ptr1, ptr2 - ptr1);
                    memcpy (ensymname + (ptr2 - ptr1), "..en", 5);
 
                    gas_assert (insn.nfixups + 1 <= MAX_INSN_FIXUPS);
                    insn.fixups[insn.nfixups].reloc = BFD_RELOC_ALPHA_NOP;
                    ensym = symbol_find_or_make (ensymname);
+                   free (ensymname);
                    symbol_mark_used (ensym);
                    /* The fixup must be the same as the BFD_RELOC_ALPHA_BOH
                       case in emit_jsrjmp.  See B.4.5.2 of the OpenVMS Linker
@@ -1416,13 +1414,12 @@ load_expression (int targreg,
                    ptr1 = strstr (symname, "..") + 2;
                    if (ptr1 > ptr2)
                      ptr1 = symname;
-                   psymname = (char *) alloca (ptr2 - ptr1 + 1);
-                   memcpy (psymname, ptr1, ptr2 - ptr1);
-                   psymname [ptr2 - ptr1] = 0;
+                   psymname = xmemdup0 (ptr1, ptr2 - ptr1);
 
                    gas_assert (insn.nfixups + 1 <= MAX_INSN_FIXUPS);
                    insn.fixups[insn.nfixups].reloc = BFD_RELOC_ALPHA_LDA;
                    psym = symbol_find_or_make (psymname);
+                   free (psymname);
                    symbol_mark_used (psym);
                    insn.fixups[insn.nfixups].exp.X_op = O_subtract;
                    insn.fixups[insn.nfixups].exp.X_add_symbol = psym;
@@ -1973,7 +1970,7 @@ static unsigned
 insert_operand (unsigned insn,
                const struct alpha_operand *operand,
                offsetT val,
-               char *file,
+               const char *file,
                unsigned line)
 {
   if (operand->bits != 32 && !(operand->flags & AXP_OPERAND_NOOVERFLOW))
@@ -2881,7 +2878,7 @@ emit_jsrjmp (const expressionS *tok,
       char *ensymname;
 
       /* Build the entry name as 'NAME..en'.  */
-      ensymname = (char *) alloca (symlen + 5);
+      ensymname = XNEWVEC (char, symlen + 5);
       memcpy (ensymname, symname, symlen);
       memcpy (ensymname + symlen, "..en", 5);
 
@@ -2903,6 +2900,7 @@ emit_jsrjmp (const expressionS *tok,
       insn.fixups[0].procsym = alpha_evax_proc->symbol;
       insn.nfixups++;
       alpha_linkage_symbol = 0;
+      free (ensymname);
     }
 #endif
 
@@ -3318,8 +3316,8 @@ assemble_tokens (const char *opname,
 #endif
   if (local_macros_on)
     {
-      macro = ((const struct alpha_macro *)
-              hash_find (alpha_macro_hash, opname));
+      macro = (const struct alpha_macro *) str_hash_find (alpha_macro_hash,
+                                                         opname);
       if (macro)
        {
          found_something = 1;
@@ -3333,7 +3331,8 @@ assemble_tokens (const char *opname,
     }
 
   /* Search opcodes.  */
-  opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname);
+  opcode = (const struct alpha_opcode *) str_hash_find (alpha_opcode_hash,
+                                                       opname);
   if (opcode)
     {
       found_something = 1;
@@ -3367,7 +3366,7 @@ assemble_tokens (const char *opname,
 #ifdef OBJ_EVAX
 
 /* Add sym+addend to link pool.
-   Return offset from curent procedure value (pv) to entry in link pool.
+   Return offset from current procedure value (pv) to entry in link pool.
 
    Add new fixup only if offset isn't 16bit.  */
 
@@ -3398,14 +3397,15 @@ add_to_link_pool (symbolS *sym, offsetT addend)
            && fixp->fx_offset == (valueT)addend
            && fixp->tc_fix_data.info
            && fixp->tc_fix_data.info->sym
-           && fixp->tc_fix_data.info->sym->sy_value.X_op_symbol == basesym)
+           && symbol_symbolS (fixp->tc_fix_data.info->sym)
+           && (symbol_get_value_expression (fixp->tc_fix_data.info->sym)
+               ->X_op_symbol == basesym))
          return fixp->tc_fix_data.info->sym;
       }
 
   /* Not found, add a new entry.  */
   subseg_set (alpha_link_section, 0);
-  linksym = symbol_new
-    (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now);
+  linksym = symbol_new (FAKE_LABEL_NAME, now_seg, frag_now, frag_now_fix ());
   p = frag_more (8);
   memset (p, 0, 8);
 
@@ -3549,7 +3549,7 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED)
          The symbol is effectively an alias for the section name.  */
 
       segT sec;
-      char *sec_name;
+      const char *sec_name;
       symbolS *sec_symbol;
       segT current_seg = now_seg;
       subsegT current_subseg = now_subseg;
@@ -3626,7 +3626,7 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED)
     }
 
 #ifndef OBJ_EVAX
-  know (symbolP->sy_frag == &zero_address_frag);
+  know (symbol_get_frag (symbolP) == &zero_address_frag);
 #endif
   demand_empty_rest_of_line ();
 }
@@ -3732,8 +3732,7 @@ s_alpha_ent (int dummy ATTRIBUTE_UNUSED)
          sym = symbol_find_or_make (name);
          symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION;
 
-         cur_frame_data = (struct alpha_elf_frame_data *)
-              calloc (1, sizeof (*cur_frame_data));
+         cur_frame_data = XCNEW (struct alpha_elf_frame_data);
          cur_frame_data->func_sym = sym;
 
          /* Provide sensible defaults.  */
@@ -3788,7 +3787,7 @@ s_alpha_end (int dummy ATTRIBUTE_UNUSED)
          if (sym && cur_frame_data)
            {
              OBJ_SYMFIELD_TYPE *obj = symbol_get_obj (sym);
-             expressionS *exp = (expressionS *) xmalloc (sizeof (expressionS));
+             expressionS *exp = XNEW (expressionS);
 
              obj->size = exp;
              exp->X_op = O_subtract;
@@ -3905,8 +3904,8 @@ s_alpha_prologue (int ignore ATTRIBUTE_UNUSED)
 
   arg = get_absolute_expression ();
   demand_empty_rest_of_line ();
-  alpha_prologue_label = symbol_new
-    (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now);
+  alpha_prologue_label = symbol_new (FAKE_LABEL_NAME, now_seg, frag_now,
+                                    frag_now_fix ());
 
   if (ECOFF_DEBUGGING)
     sym = ecoff_get_cur_proc_sym ();
@@ -3956,9 +3955,7 @@ s_alpha_file (int ignore ATTRIBUTE_UNUSED)
       discard_rest_of_line ();
 
       len = input_line_pointer - start;
-      first_file_directive = (char *) xmalloc (len + 1);
-      memcpy (first_file_directive, start, len);
-      first_file_directive[len] = '\0';
+      first_file_directive = xmemdup0 (start, len);
 
       input_line_pointer = start;
     }
@@ -3985,8 +3982,8 @@ s_alpha_stab (int n)
   if (alpha_flag_mdebug < 0)
     {
       segT sec = subseg_new (".mdebug", 0);
-      bfd_set_section_flags (stdoutput, sec, SEC_HAS_CONTENTS | SEC_READONLY);
-      bfd_set_section_alignment (stdoutput, sec, 3);
+      bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY);
+      bfd_set_section_alignment (sec, 3);
 
       ecoff_read_begin_hook ();
 
@@ -4059,8 +4056,8 @@ alpha_elf_md_end (void)
        /* Create a temporary symbol at the same location as our
           function symbol.  This prevents problems with globals.  */
        cfi_new_fde (symbol_temp_new (S_GET_SEGMENT (p->func_sym),
-                                     S_GET_VALUE (p->func_sym),
-                                     symbol_get_frag (p->func_sym)));
+                                     symbol_get_frag (p->func_sym),
+                                     S_GET_VALUE (p->func_sym)));
 
        cfi_set_sections ();
        cfi_set_return_column (p->ra_regno);
@@ -4181,7 +4178,7 @@ alpha_cfi_frame_initial_instructions (void)
 #ifdef OBJ_EVAX
 
 /* Get name of section.  */
-static char *
+static const char *
 s_alpha_section_name (void)
 {
   char *name;
@@ -4211,9 +4208,7 @@ s_alpha_section_name (void)
          return NULL;
        }
 
-      name = xmalloc (end - input_line_pointer + 1);
-      memcpy (name, input_line_pointer, end - input_line_pointer);
-      name[end - input_line_pointer] = '\0';
+      name = xmemdup0 (input_line_pointer, end - input_line_pointer);
       input_line_pointer = end;
     }
   SKIP_WHITESPACE ();
@@ -4289,13 +4284,14 @@ s_alpha_section_word (char *str, size_t len)
 
 #define EVAX_SECTION_COUNT 5
 
-static char *section_name[EVAX_SECTION_COUNT + 1] =
+static const char *section_name[EVAX_SECTION_COUNT + 1] =
   { "NULL", ".rdata", ".comm", ".link", ".ctors", ".dtors" };
 
 static void
 s_alpha_section (int secid)
 {
-  char *name, *beg;
+  const char *name;
+  char *beg;
   segT sec;
   flagword vms_flags = 0;
   symbolS *symbol;
@@ -4474,8 +4470,8 @@ static void
 s_alpha_prologue (int ignore ATTRIBUTE_UNUSED)
 {
   demand_empty_rest_of_line ();
-  alpha_prologue_label = symbol_new
-    (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now);
+  alpha_prologue_label = symbol_new (FAKE_LABEL_NAME, now_seg, frag_now,
+                                    frag_now_fix ());
 }
 
 /* Parse .pdesc <entry_name>,{null|stack|reg}
@@ -4710,12 +4706,11 @@ s_alpha_linkage (int ignore ATTRIBUTE_UNUSED)
         BFD_RELOC_ALPHA_LINKAGE);
 
       if (alpha_insn_label == NULL)
-       alpha_insn_label = symbol_new
-         (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now);
+       alpha_insn_label = symbol_new (FAKE_LABEL_NAME, now_seg, frag_now,
+                                      frag_now_fix ());
 
       /* Create a linkage element.  */
-      linkage_fixup = (struct alpha_linkage_fixups *)
-       xmalloc (sizeof (struct alpha_linkage_fixups));
+      linkage_fixup = XNEW (struct alpha_linkage_fixups);
       linkage_fixup->fixp = fixp;
       linkage_fixup->next = NULL;
       linkage_fixup->label = alpha_insn_label;
@@ -4885,7 +4880,7 @@ s_alpha_gprel32 (int ignore ATTRIBUTE_UNUSED)
 }
 
 /* Handle floating point allocation pseudo-ops.  This is like the
-   generic vresion, but it makes sure the current label, if any, is
+   generic version, but it makes sure the current label, if any, is
    correctly aligned.  */
 
 static void
@@ -5139,7 +5134,7 @@ s_alpha_arch (int ignored ATTRIBUTE_UNUSED)
       }
   as_warn (_("Unknown CPU identifier `%s'"), name);
 
-found:
+ found:
   (void) restore_line_pointer (ch);
   demand_empty_rest_of_line ();
 }
@@ -5303,7 +5298,7 @@ maybe_set_gp (asection *sec)
 
   if (!sec)
     return;
-  vma = bfd_get_section_vma (sec->owner, sec);
+  vma = bfd_section_vma (sec);
   if (vma && vma < alpha_gp_value)
     alpha_gp_value = vma;
 }
@@ -5337,7 +5332,7 @@ select_gp_value (void)
 /* Map 's' to SHF_ALPHA_GPREL.  */
 
 bfd_vma
-alpha_elf_section_letter (int letter, char **ptr_msg)
+alpha_elf_section_letter (int letter, const char **ptr_msg)
 {
   if (letter == 's')
     return SHF_ALPHA_GPREL;
@@ -5363,8 +5358,8 @@ alpha_elf_section_flags (flagword flags, bfd_vma attr, int type ATTRIBUTE_UNUSED
 void
 alpha_handle_align (fragS *fragp)
 {
-  static char const unop[4] = { 0x00, 0x00, 0xfe, 0x2f };
-  static char const nopunop[8] =
+  static unsigned char const unop[4] = { 0x00, 0x00, 0xfe, 0x2f };
+  static unsigned char const nopunop[8] =
   {
     0x1f, 0x04, 0xff, 0x47,
     0x00, 0x00, 0xfe, 0x2f
@@ -5422,17 +5417,15 @@ md_begin (void)
   }
 
   /* Create the opcode hash table.  */
-  alpha_opcode_hash = hash_new ();
+  alpha_opcode_hash = str_htab_create ();
 
   for (i = 0; i < alpha_num_opcodes;)
     {
-      const char *name, *retval, *slash;
+      const char *name, *slash;
 
       name = alpha_opcodes[i].name;
-      retval = hash_insert (alpha_opcode_hash, name, (void *) &alpha_opcodes[i]);
-      if (retval)
-       as_fatal (_("internal error: can't hash opcode `%s': %s"),
-                 name, retval);
+      if (str_hash_insert (alpha_opcode_hash, name, &alpha_opcodes[i], 0))
+       as_fatal (_("duplicate %s"), name);
 
       /* Some opcodes include modifiers of various sorts with a "/mod"
         syntax, like the architecture manual suggests.  However, for
@@ -5441,12 +5434,12 @@ md_begin (void)
 
       if ((slash = strchr (name, '/')) != NULL)
        {
-         char *p = (char *) xmalloc (strlen (name));
+         char *p = XNEWVEC (char, strlen (name));
 
          memcpy (p, name, slash - name);
          strcpy (p + (slash - name), slash + 1);
 
-         (void) hash_insert (alpha_opcode_hash, p, (void *) &alpha_opcodes[i]);
+         (void) str_hash_insert (alpha_opcode_hash, p, &alpha_opcodes[i], 0);
          /* Ignore failures -- the opcode table does duplicate some
             variants in different forms, like "hw_stq" and "hw_st/q".  */
        }
@@ -5458,17 +5451,15 @@ md_begin (void)
     }
 
   /* Create the macro hash table.  */
-  alpha_macro_hash = hash_new ();
+  alpha_macro_hash = str_htab_create ();
 
   for (i = 0; i < alpha_num_macros;)
     {
-      const char *name, *retval;
+      const char *name;
 
       name = alpha_macros[i].name;
-      retval = hash_insert (alpha_macro_hash, name, (void *) &alpha_macros[i]);
-      if (retval)
-       as_fatal (_("internal error: can't hash macro `%s': %s"),
-                 name, retval);
+      if (str_hash_insert (alpha_macro_hash, name, &alpha_macros[i], 0))
+       as_fatal (_("duplicate %s"), name);
 
       while (++i < alpha_num_macros
             && (alpha_macros[i].name == name
@@ -5482,8 +5473,8 @@ md_begin (void)
       char name[4];
 
       sprintf (name, "$%d", i);
-      alpha_register_table[i] = symbol_create (name, reg_section, i,
-                                              &zero_address_frag);
+      alpha_register_table[i] = symbol_create (name, reg_section,
+                                              &zero_address_frag, i);
     }
 
   for (; i < 64; ++i)
@@ -5491,8 +5482,8 @@ md_begin (void)
       char name[5];
 
       sprintf (name, "$f%d", i - 32);
-      alpha_register_table[i] = symbol_create (name, reg_section, i,
-                                              &zero_address_frag);
+      alpha_register_table[i] = symbol_create (name, reg_section,
+                                              &zero_address_frag, i);
     }
 
   /* Create the special symbols and sections we'll be using.  */
@@ -5505,8 +5496,8 @@ md_begin (void)
 
   /* For handling the GP, create a symbol that won't be output in the
      symbol table.  We'll edit it out of relocs later.  */
-  alpha_gp_symbol = symbol_create ("<GP value>", alpha_lita_section, 0x8000,
-                                  &zero_address_frag);
+  alpha_gp_symbol = symbol_create ("<GP value>", alpha_lita_section,
+                                  &zero_address_frag, 0x8000);
 #endif
 
 #ifdef OBJ_EVAX
@@ -5517,13 +5508,13 @@ md_begin (void)
   if (ECOFF_DEBUGGING)
     {
       segT sec = subseg_new (".mdebug", (subsegT) 0);
-      bfd_set_section_flags (stdoutput, sec, SEC_HAS_CONTENTS | SEC_READONLY);
-      bfd_set_section_alignment (stdoutput, sec, 3);
+      bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY);
+      bfd_set_section_alignment (sec, 3);
     }
 #endif
 
   /* Create literal lookup hash table.  */
-  alpha_literal_hash = hash_new ();
+  alpha_literal_hash = str_htab_create ();
 
   subseg_set (text_section, 0);
 }
@@ -5565,7 +5556,7 @@ md_assemble (char *str)
 valueT
 md_section_align (segT seg, valueT size)
 {
-  int align = bfd_get_section_alignment (stdoutput, seg);
+  int align = bfd_section_alignment (seg);
   valueT mask = ((valueT) 1 << align) - 1;
 
   return (size + mask) & ~mask;
@@ -5576,10 +5567,10 @@ md_section_align (segT seg, valueT size)
    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)
 {
-  extern char *vax_md_atof (int, char *, int *);
+  extern const char *vax_md_atof (int, char *, int *);
 
   switch (type)
     {
@@ -5587,6 +5578,7 @@ md_atof (int type, char *litP, int *sizeP)
     case 'G':
       /* vax_md_atof() doesn't like "G" for some reason.  */
       type = 'g';
+      /* Fall through.  */
     case 'F':
     case 'D':
       return vax_md_atof (type, litP, sizeP);
@@ -5599,7 +5591,7 @@ md_atof (int type, char *litP, int *sizeP)
 /* Take care of the target-specific command-line options.  */
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
@@ -5771,6 +5763,12 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
       md_number_to_chars (fixpos, value, 2);
       break;
 
+    case BFD_RELOC_8:
+      if (fixP->fx_pcrel)
+       fixP->fx_r_type = BFD_RELOC_8_PCREL;
+      size = 1;
+      goto do_reloc_xx;
+
     case BFD_RELOC_16:
       if (fixP->fx_pcrel)
        fixP->fx_r_type = BFD_RELOC_16_PCREL;
@@ -5873,7 +5871,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
          return;
        }
 
-      if ((abs (value) >> 2) & ~0xfffff)
+      if (value + (1u << 22) >= (1u << 23))
        goto done;
       else
        {
@@ -5892,7 +5890,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
          return;
        }
 
-      if ((abs (value)) & ~0x7fff)
+      if (value + (1u << 15) >= (1u << 16))
        goto done;
       else
        {
@@ -5912,7 +5910,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
          return;
        }
 
-      if ((abs (value) >> 2) & ~0xfffff)
+      if (value + (1u << 22) >= (1u << 23))
        {
          /* Out of range.  */
          if (fixP->fx_r_type == BFD_RELOC_ALPHA_BOH)
@@ -5972,10 +5970,10 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
       goto done;
     }
 
-write_done:
+ write_done:
   md_number_to_chars (fixpos, image, 4);
 
-done:
+ done:
   fixP->fx_done = 1;
 }
 
@@ -6222,8 +6220,8 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED,
 {
   arelent *reloc;
 
-  reloc = (arelent *) xmalloc (sizeof (* reloc));
-  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  reloc = XNEW (arelent);
+  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;
 
@@ -6279,11 +6277,9 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED,
       if (pname_len > 4 && strcmp (pname + pname_len - 4, "..en") == 0)
        {
          symbolS *sym;
-         char *my_pname = (char *) alloca (pname_len - 4 + 1);
-
-         memcpy (my_pname, pname, pname_len - 4);
-         my_pname [pname_len - 4] = 0;
+         char *my_pname = xmemdup0 (pname, pname_len - 4);
          sym = symbol_find (my_pname);
+         free (my_pname);
          if (sym == NULL)
            abort ();
 
@@ -6300,8 +6296,7 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED,
          pname = symbol_get_bfdsym (sym)->name;
        }
 
-      udata = (struct evax_private_udata_struct *)
-       xmalloc (sizeof (struct evax_private_udata_struct));
+      udata = XNEW (struct evax_private_udata_struct);
       udata->enbsym = symbol_get_bfdsym (fixp->fx_addsy);
       udata->bsym = symbol_get_bfdsym (fixp->tc_fix_data.info->psym);
       udata->origname = (char *)pname;
@@ -6342,7 +6337,7 @@ tc_get_register (int frame ATTRIBUTE_UNUSED)
     }
   as_warn (_("frame reg expected, using $%d."), framereg);
 
-found:
+ found:
   note_gpreg (framereg);
   return framereg;
 }
This page took 0.034547 seconds and 4 git commands to generate.