X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Ftc-tilegx.c;h=c08c02d12237a0be7029f9cbeab983912a487d98;hb=de54374205650be71237ce51ef7981d30ddd78dc;hp=efc38563c3925fe27710cac7c8ebb21add483383;hpb=b90efa5b79ac1524ec260f8eb89d1be37e0219a7;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c index efc38563c3..c08c02d122 100644 --- a/gas/config/tc-tilegx.c +++ b/gas/config/tc-tilegx.c @@ -1,5 +1,5 @@ /* tc-tilegx.c -- Assemble for a Tile-Gx 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/tilegx.h" @@ -99,7 +98,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) { @@ -263,7 +262,7 @@ md_begin (void) as_warn (_("Could not set architecture and machine")); /* Guarantee text section is aligned. */ - bfd_set_section_alignment (stdoutput, text_section, + bfd_set_section_alignment (text_section, TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES); require_canonical_reg_names = 1; @@ -396,7 +395,7 @@ static tilegx_bundle_bits insert_operand (tilegx_bundle_bits bits, const struct tilegx_operand *operand, int operand_value, - char *file, + const char *file, unsigned lineno) { /* Range-check the immediate. */ @@ -434,7 +433,8 @@ insert_operand (tilegx_bundle_bits bits, static int -apply_special_operator (operatorT op, offsetT num, char *file, unsigned lineno) +apply_special_operator (operatorT op, offsetT num, const char *file, + unsigned lineno) { int ret; int check_shift = -1; @@ -736,16 +736,18 @@ emit_tilegx_instruction (tilegx_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) { @@ -946,8 +948,8 @@ tilegx_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, TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES); for (j = 0; j < current_bundle_index; j++) @@ -1066,7 +1068,7 @@ tilegx_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); @@ -1085,33 +1087,32 @@ tilegx_parse_name (char *name, expressionS *e, char *nextcharP) static void parse_reg_expression (expressionS* expression) { + char *regname; + char terminating_char; + void *pval; + int regno_and_flags; + int regno; + /* Zero everything to make sure we don't miss any flags. */ memset (expression, 0, sizeof *expression); - char* regname = input_line_pointer; - char terminating_char = get_symbol_end (); - - void* pval = hash_find (main_reg_hash, regname); + terminating_char = get_symbol_name (®name); + pval = hash_find (main_reg_hash, regname); if (pval == NULL) - { - as_bad (_("Expected register, got '%s'."), regname); - } + as_bad (_("Expected register, got '%s'."), regname); - int regno_and_flags = (int)(size_t)pval; - int regno = EXTRACT_REGNO(regno_and_flags); + regno_and_flags = (int)(size_t)pval; + regno = EXTRACT_REGNO(regno_and_flags); if ((regno_and_flags & NONCANONICAL_REG_NAME_FLAG) && require_canonical_reg_names) - { - as_warn (_("Found use of non-canonical register name %s; " - "use %s instead."), - regname, - tilegx_register_names[regno]); - } + as_warn (_("Found use of non-canonical register name %s; " + "use %s instead."), + regname, tilegx_register_names[regno]); /* Restore the old character following the register name. */ - *input_line_pointer = terminating_char; + (void) restore_line_pointer (terminating_char); /* Fill in the expression fields to indicate it's a register. */ expression->X_op = O_register; @@ -1313,9 +1314,6 @@ const pseudo_typeS md_pseudo_table[] = { NULL, 0, 0 } }; -/* Equal to MAX_PRECISION in atof-ieee.c */ -#define MAX_LITTLENUMS 6 - void md_number_to_chars (char * buf, valueT val, int n) { @@ -1330,7 +1328,7 @@ md_number_to_chars (char * buf, valueT val, int n) 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; @@ -1735,8 +1733,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;