X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Ftc-xc16x.c;h=23b9e687c864b7ee9a20369f86615781138ca80e;hb=d4340f89eccb0b0a0811e142ce365efc48beb064;hp=7a369b42ec29ce8e74444492f6e47de8ef10e897;hpb=d70c5fc7c56fa9915f594aca8de15b478f3ab5b0;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/tc-xc16x.c b/gas/config/tc-xc16x.c index 7a369b42ec..23b9e687c8 100644 --- a/gas/config/tc-xc16x.c +++ b/gas/config/tc-xc16x.c @@ -1,12 +1,12 @@ /* tc-xc16x.c -- Assembler for the Infineon XC16X. - Copyright 2006 Free Software Foundation, Inc. - Contributed by KPIT Cummins Infosystems + Copyright (C) 2006-2019 Free Software Foundation, Inc. + Contributed by KPIT Cummins Infosystems 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, @@ -20,7 +20,6 @@ 02110-1301, USA. */ -#include #include "as.h" #include "safe-ctype.h" #include "subsegs.h" @@ -28,7 +27,6 @@ #include "opcodes/xc16x-desc.h" #include "opcodes/xc16x-opc.h" #include "cgen.h" -#include "bfd.h" #include "dwarf2dbg.h" @@ -135,7 +133,7 @@ md_assemble (char *str) if (!insn.insn) { - as_bad (errmsg); + as_bad ("%s", errmsg); return; } @@ -156,47 +154,54 @@ md_cgen_lookup_reloc (const CGEN_INSN *insn ATTRIBUTE_UNUSED, switch (operand->type) { case XC16X_OPERAND_REL: + /* ??? Adjust size? */ fixP->fx_where += 1; fixP->fx_pcrel = 1; return BFD_RELOC_8_PCREL; case XC16X_OPERAND_CADDR: + fixP->fx_size = 2; fixP->fx_where += 2; return BFD_RELOC_16; case XC16X_OPERAND_UIMM7: + /* ??? Adjust size? */ fixP->fx_where += 1; fixP->fx_pcrel = 1; return BFD_RELOC_8_PCREL; case XC16X_OPERAND_UIMM16: case XC16X_OPERAND_MEMORY: + fixP->fx_size = 2; fixP->fx_where += 2; return BFD_RELOC_16; case XC16X_OPERAND_UPOF16: + fixP->fx_size = 2; fixP->fx_where += 2; return BFD_RELOC_XC16X_POF; case XC16X_OPERAND_UPAG16: + fixP->fx_size = 2; fixP->fx_where += 2; return BFD_RELOC_XC16X_PAG; case XC16X_OPERAND_USEG8: + /* ??? This is an 8 bit field, why the 16 bit reloc? */ fixP->fx_where += 1; return BFD_RELOC_XC16X_SEG; case XC16X_OPERAND_USEG16: case XC16X_OPERAND_USOF16: + fixP->fx_size = 2; fixP->fx_where += 2; return BFD_RELOC_XC16X_SOF; - default : /* avoid -Wall warning */ + default : /* Avoid -Wall warning. */ break; } - fixP->fx_where += 2; - return BFD_RELOC_XC16X_SOF; + return BFD_RELOC_NONE; } /* Write a value out to the object file, using the appropriate endianness. */ @@ -215,71 +220,22 @@ md_show_usage (FILE * stream) int md_parse_option (int c ATTRIBUTE_UNUSED, - char *arg ATTRIBUTE_UNUSED) + const char *arg ATTRIBUTE_UNUSED) { return 0; } -/* 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 i; - int prec; - LITTLENUM_TYPE words[MAX_LITTLENUMS]; - char *t; - - switch (type) - { - case 'f': - case 'F': - case 's': - case 'S': - prec = 2; - break; - - case 'd': - case 'D': - case 'r': - case 'R': - 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); - - for (i = prec - 1; i >= 0; i--) - { - md_number_to_chars (litP, (valueT) words[i], - sizeof (LITTLENUM_TYPE)); - litP += sizeof (LITTLENUM_TYPE); - } - - return NULL; + return ieee_md_atof (type, litP, sizeP, FALSE); } valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + int align = bfd_section_alignment (segment); + return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * @@ -292,7 +248,7 @@ int md_estimate_size_before_relax (fragS *fragP ATTRIBUTE_UNUSED, segT segment_type ATTRIBUTE_UNUSED) { - printf (_("call tomd_estimate_size_before_relax \n")); + printf (_("call to md_estimate_size_before_relax \n")); abort (); } @@ -333,13 +289,13 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) || S_GET_SEGMENT (fixp->fx_addsy) == undefined_section) { as_bad_where (fixp->fx_file, fixp->fx_line, - "Difference of symbols in different sections is not supported"); + _("Difference of symbols in different sections is not supported")); return NULL; } } - rel = xmalloc (sizeof (arelent)); - rel->sym_ptr_ptr = xmalloc (sizeof (asymbol *)); + rel = XNEW (arelent); + rel->sym_ptr_ptr = XNEW (asymbol *); *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); rel->address = fixp->fx_frag->fr_address + fixp->fx_where; rel->addend = fixp->fx_offset; @@ -349,7 +305,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) #define DEBUG 0 #if DEBUG fprintf (stderr, "%s\n", bfd_get_reloc_code_name (r_type)); - fflush(stderr); + fflush (stderr); #endif rel->howto = bfd_reloc_type_lookup (stdoutput, r_type); @@ -367,7 +323,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) void md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) { - if(!strstr (seg->name,".debug")) + if (!strstr (seg->name,".debug")) { if (*valP < 128) *valP /= 2; @@ -378,7 +334,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) *valP = 256 - (*valP); } } - + gas_cgen_md_apply_fix (fixP, valP, seg); return; } @@ -391,5 +347,3 @@ md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, printf (_("call to md_convert_frag \n")); abort (); } - -