The patch fixed invalid compilation of instruction LD IY,(HL) and disassemble of...
[deliverable/binutils-gdb.git] / gas / config / tc-tilepro.c
index e7c7c642d925a80a9cc1d0ada23bc31adcf62910..03e001b36f1057cb20b37cd3d52826a7daa74863 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-tilepro.c -- Assemble for a TILEPro chip.
-   Copyright (C) 2011-2015 Free Software Foundation, Inc.
+   Copyright (C) 2011-2020 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -19,7 +19,6 @@
    MA 02110-1301, USA.  */
 
 #include "as.h"
-#include "struc-symbol.h"
 #include "subsegs.h"
 
 #include "elf/tilepro.h"
@@ -72,7 +71,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
@@ -208,7 +207,7 @@ md_begin (void)
   int i;
 
   /* Guarantee text section is aligned.  */
-  bfd_set_section_alignment (stdoutput, text_section,
+  bfd_set_section_alignment (text_section,
                              TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES);
 
   require_canonical_reg_names = 1;
@@ -352,7 +351,7 @@ static tilepro_bundle_bits
 insert_operand (tilepro_bundle_bits bits,
                 const struct tilepro_operand *operand,
                 int operand_value,
-                char *file,
+                const char *file,
                 unsigned lineno)
 {
   /* Range-check the immediate.  */
@@ -628,16 +627,18 @@ emit_tilepro_instruction (tilepro_bundle_bits bits,
            }
          else if (use_subexp)
            {
+             expressionS *sval = NULL;
              /* Now that we've changed the reloc, change ha16(x) into x,
                 etc.  */
 
-             if (!operand_exp->X_add_symbol->sy_flags.sy_local_symbol
-                  && operand_exp->X_add_symbol->sy_value.X_md)
+             if (symbol_symbolS (operand_exp->X_add_symbol))
+               sval = symbol_get_value_expression (operand_exp->X_add_symbol);
+             if (sval && sval->X_md)
                {
                  /* HACK: We used X_md to mark this symbol as a fake wrapper
                     around a real expression. To unwrap it, we just grab its
                     value here.  */
-                 operand_exp = &operand_exp->X_add_symbol->sy_value;
+                 operand_exp = sval;
 
                  if (require_symbol)
                    {
@@ -837,8 +838,8 @@ tilepro_flush_bundle (void)
 
   /* If the section seems to have no alignment set yet, go ahead and
      make it large enough to hold code.  */
-  if (bfd_get_section_alignment (stdoutput, now_seg) == 0)
-    bfd_set_section_alignment (stdoutput, now_seg,
+  if (bfd_section_alignment (now_seg) == 0)
+    bfd_set_section_alignment (now_seg,
                                TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES);
 
   for (j = 0; j < current_bundle_index; j++)
@@ -958,7 +959,7 @@ tilepro_parse_name (char *name, expressionS *e, char *nextcharP)
          /* HACK: mark this symbol as a temporary wrapper around a proper
             expression, so we can unwrap it later once we have communicated
             the relocation type.  */
-         sym->sy_value.X_md = 1;
+         symbol_get_value_expression (sym)->X_md = 1;
        }
 
       memset (e, 0, sizeof *e);
@@ -980,6 +981,7 @@ parse_reg_expression (expressionS* expression)
   /* Zero everything to make sure we don't miss any flags.  */
   memset (expression, 0, sizeof *expression);
 
+  char *regname;
   char terminating_char = get_symbol_name (&regname);
 
   void* pval = hash_find (main_reg_hash, regname);
@@ -1196,15 +1198,12 @@ const pseudo_typeS md_pseudo_table[] =
   { NULL, 0, 0 }
 };
 
-/* Equal to MAX_PRECISION in atof-ieee.c  */
-#define MAX_LITTLENUMS 6
-
 /* Turn the string pointed to by litP into a floating point constant
    of type TYPE, and emit the appropriate bytes.  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;
@@ -1514,8 +1513,8 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, fixS *fixp)
 {
   arelent *reloc;
 
-  reloc = (arelent *) xmalloc (sizeof (arelent));
-  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;
 
This page took 0.025769 seconds and 4 git commands to generate.