aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/atof-ieee.c24
-rw-r--r--gas/config/kvx-parse.c20
-rw-r--r--gas/config/loongarch-parse.y35
-rw-r--r--gas/config/obj-aout.c2
-rw-r--r--gas/config/obj-coff-seh.c4
-rw-r--r--gas/config/obj-coff.c65
-rw-r--r--gas/config/obj-coff.h3
-rw-r--r--gas/config/obj-elf.c118
-rw-r--r--gas/config/obj-elf.h6
-rw-r--r--gas/config/obj-evax.c3
-rw-r--r--gas/config/obj-macho.c29
-rw-r--r--gas/config/obj-som.c8
-rw-r--r--gas/config/tc-aarch64.c353
-rw-r--r--gas/config/tc-aarch64.h54
-rw-r--r--gas/config/tc-alpha.c349
-rw-r--r--gas/config/tc-alpha.h2
-rw-r--r--gas/config/tc-arc.c25
-rw-r--r--gas/config/tc-arc.h4
-rw-r--r--gas/config/tc-arm.c160
-rw-r--r--gas/config/tc-arm.h15
-rw-r--r--gas/config/tc-avr.c92
-rw-r--r--gas/config/tc-bfin.c16
-rw-r--r--gas/config/tc-bpf.c77
-rw-r--r--gas/config/tc-cr16.c35
-rw-r--r--gas/config/tc-cris.c22
-rw-r--r--gas/config/tc-crx.c22
-rw-r--r--gas/config/tc-csky.c133
-rw-r--r--gas/config/tc-csky.h2
-rw-r--r--gas/config/tc-d10v.c36
-rw-r--r--gas/config/tc-d30v.c70
-rw-r--r--gas/config/tc-dlx.c10
-rw-r--r--gas/config/tc-epiphany.c26
-rw-r--r--gas/config/tc-epiphany.h1
-rw-r--r--gas/config/tc-fr30.c4
-rw-r--r--gas/config/tc-frv.c14
-rw-r--r--gas/config/tc-frv.h2
-rw-r--r--gas/config/tc-ft32.c7
-rw-r--r--gas/config/tc-h8300.c5
-rw-r--r--gas/config/tc-hppa.c71
-rw-r--r--gas/config/tc-i386.c331
-rw-r--r--gas/config/tc-i386.h54
-rw-r--r--gas/config/tc-ia64.c47
-rw-r--r--gas/config/tc-ia64.h2
-rw-r--r--gas/config/tc-iq2000.c56
-rw-r--r--gas/config/tc-kvx.c112
-rw-r--r--gas/config/tc-kvx.h1
-rw-r--r--gas/config/tc-lm32.c14
-rw-r--r--gas/config/tc-loongarch.c217
-rw-r--r--gas/config/tc-loongarch.h23
-rw-r--r--gas/config/tc-m32c.c8
-rw-r--r--gas/config/tc-m32c.h2
-rw-r--r--gas/config/tc-m32r.c27
-rw-r--r--gas/config/tc-m32r.h2
-rw-r--r--gas/config/tc-m68hc11.c61
-rw-r--r--gas/config/tc-m68k.c37
-rw-r--r--gas/config/tc-mcore.c4
-rw-r--r--gas/config/tc-mep.c8
-rw-r--r--gas/config/tc-metag.c66
-rw-r--r--gas/config/tc-metag.h1
-rw-r--r--gas/config/tc-microblaze.c55
-rw-r--r--gas/config/tc-mips.c178
-rw-r--r--gas/config/tc-mips.h2
-rw-r--r--gas/config/tc-mmix.c56
-rw-r--r--gas/config/tc-mn10200.c29
-rw-r--r--gas/config/tc-mn10300.c28
-rw-r--r--gas/config/tc-moxie.c9
-rw-r--r--gas/config/tc-msp430.c132
-rw-r--r--gas/config/tc-msp430.h3
-rw-r--r--gas/config/tc-mt.c8
-rw-r--r--gas/config/tc-nds32.c71
-rw-r--r--gas/config/tc-nds32.h1
-rw-r--r--gas/config/tc-ns32k.c42
-rw-r--r--gas/config/tc-or1k.c5
-rw-r--r--gas/config/tc-pdp11.c8
-rw-r--r--gas/config/tc-pj.c2
-rw-r--r--gas/config/tc-ppc.c134
-rw-r--r--gas/config/tc-ppc.h5
-rw-r--r--gas/config/tc-pru.c24
-rw-r--r--gas/config/tc-riscv.c239
-rw-r--r--gas/config/tc-riscv.h14
-rw-r--r--gas/config/tc-rl78.c6
-rw-r--r--gas/config/tc-rl78.h2
-rw-r--r--gas/config/tc-rx.c10
-rw-r--r--gas/config/tc-rx.h2
-rw-r--r--gas/config/tc-s12z.c26
-rw-r--r--gas/config/tc-s390.c113
-rw-r--r--gas/config/tc-s390.h34
-rw-r--r--gas/config/tc-score.c850
-rw-r--r--gas/config/tc-score.h2
-rw-r--r--gas/config/tc-score7.c647
-rw-r--r--gas/config/tc-sh.c102
-rw-r--r--gas/config/tc-sh.h2
-rw-r--r--gas/config/tc-sparc.c59
-rw-r--r--gas/config/tc-sparc.h4
-rw-r--r--gas/config/tc-spu.c28
-rw-r--r--gas/config/tc-spu.h2
-rw-r--r--gas/config/tc-tic30.c68
-rw-r--r--gas/config/tc-tic4x.c26
-rw-r--r--gas/config/tc-tic54x.c92
-rw-r--r--gas/config/tc-tic6x.c18
-rw-r--r--gas/config/tc-tic6x.h4
-rw-r--r--gas/config/tc-tilegx.c54
-rw-r--r--gas/config/tc-tilegx.h2
-rw-r--r--gas/config/tc-tilepro.c64
-rw-r--r--gas/config/tc-tilepro.h2
-rw-r--r--gas/config/tc-v850.c142
-rw-r--r--gas/config/tc-vax.c14
-rw-r--r--gas/config/tc-visium.c58
-rw-r--r--gas/config/tc-visium.h1
-rw-r--r--gas/config/tc-wasm32.c6
-rw-r--r--gas/config/tc-wasm32.h1
-rw-r--r--gas/config/tc-xgate.c35
-rw-r--r--gas/config/tc-xstormy16.c16
-rw-r--r--gas/config/tc-xtensa.c51
-rw-r--r--gas/config/tc-xtensa.h2
-rw-r--r--gas/config/tc-z80.c43
-rw-r--r--gas/config/tc-z8k.c13
-rw-r--r--gas/config/te-nacl.h30
-rw-r--r--gas/config/te-vms.c4
119 files changed, 3401 insertions, 3276 deletions
diff --git a/gas/config/atof-ieee.c b/gas/config/atof-ieee.c
index b03919e..a1c3ca2 100644
--- a/gas/config/atof-ieee.c
+++ b/gas/config/atof-ieee.c
@@ -147,12 +147,12 @@ make_invalid_floating_point_number (LITTLENUM_TYPE *words)
{
as_bad (_("cannot create floating-point number"));
/* Zero the leftmost bit. */
- words[0] = (LITTLENUM_TYPE) ((unsigned) -1) >> 1;
- words[1] = (LITTLENUM_TYPE) -1;
- words[2] = (LITTLENUM_TYPE) -1;
- words[3] = (LITTLENUM_TYPE) -1;
- words[4] = (LITTLENUM_TYPE) -1;
- words[5] = (LITTLENUM_TYPE) -1;
+ words[0] = (LITTLENUM_TYPE) -1 >> 1;
+ words[1] = -1;
+ words[2] = -1;
+ words[3] = -1;
+ words[4] = -1;
+ words[5] = -1;
}
/* Build a floating point constant at str into a IEEE floating
@@ -283,7 +283,7 @@ atof_ieee (char *str, /* Text to convert to binary. */
default:
make_invalid_floating_point_number (words);
- return (NULL);
+ return NULL;
}
return atof_ieee_detail (str, precision, exponent_bits, words, NULL);
@@ -553,7 +553,7 @@ gen_to_words (LITTLENUM_TYPE *words, int precision, long exponent_bits)
tmp_bits = prec_bits;
while (tmp_bits > LITTLENUM_NUMBER_OF_BITS)
{
- if (lp[n] != (LITTLENUM_TYPE) - 1)
+ if (lp[n] != (LITTLENUM_TYPE) -1)
break;
--n;
tmp_bits -= LITTLENUM_NUMBER_OF_BITS;
@@ -835,17 +835,17 @@ ieee_md_atof (int type,
if (big_wordian)
{
- for (wordP = words; prec --;)
+ for (wordP = words; prec--;)
{
- md_number_to_chars (litP, (valueT) (* wordP ++), sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, *wordP++, sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
}
else
{
- for (wordP = words + prec; prec --;)
+ for (wordP = words + prec; prec--;)
{
- md_number_to_chars (litP, (valueT) (* -- wordP), sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, *--wordP, sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
}
diff --git a/gas/config/kvx-parse.c b/gas/config/kvx-parse.c
index 942eab3..ea96f3d 100644
--- a/gas/config/kvx-parse.c
+++ b/gas/config/kvx-parse.c
@@ -68,7 +68,7 @@ has_relocation_of_size (const struct kvx_reloc **relocs)
if (!relocs)
return 0;
- struct kvx_reloc **relocs_it = (struct kvx_reloc **) relocs;
+ const struct kvx_reloc **relocs_it = relocs;
int has_only_one_p = relocs[0] && !relocs[1];
while (*relocs_it)
@@ -101,15 +101,13 @@ has_relocation_of_size (const struct kvx_reloc **relocs)
return 0;
}
-struct pseudo_func *
-kvx_get_pseudo_func2 (symbolS * sym, struct kvx_reloc **relocs);
-struct pseudo_func *
-kvx_get_pseudo_func2 (symbolS *sym, struct kvx_reloc **relocs)
+static struct pseudo_func *
+kvx_get_pseudo_func2 (symbolS *sym, const struct kvx_reloc **relocs)
{
if (!relocs)
return NULL;
- struct kvx_reloc **relocs_it = (struct kvx_reloc **) relocs;
+ const struct kvx_reloc **relocs_it = relocs;
for (int i = 0; i < 26; i++)
{
@@ -409,7 +407,7 @@ promote_token (struct token_s tok)
: tok.class_id;
case CAT_IMMEDIATE:
{
- expressionS exp = { 0 };
+ expressionS exp;
char *ilp_save = input_line_pointer;
input_line_pointer = tok.insn + tok.begin;
expression (&exp);
@@ -460,9 +458,9 @@ get_token_class (struct token_s *token, struct token_classes *classes, int insn_
{
int cur = 0;
int found = 0;
- int tok_sz = token->end - token->begin;
+ size_t tok_sz = token->end - token->begin;
char *tok = token->insn + token->begin;
- expressionS exp = {0};
+ expressionS exp;
token->val = 0;
int token_val_p = 0;
@@ -559,7 +557,7 @@ get_token_class (struct token_s *token, struct token_classes *classes, int insn_
for (int i = 0; !found && i < class[cur].sz; ++i)
{
const char *ref = class[cur].class_values[i];
- found = ((long) strlen (ref) == tok_sz) && !strncmp (tok, ref, tok_sz);
+ found = (strlen (ref) == tok_sz) && !strncmp (tok, ref, tok_sz);
token->val = i;
}
@@ -671,7 +669,7 @@ static struct token_list *
create_token (struct token_s tok, int len, int loc)
{
struct token_list *tl = calloc (1, sizeof *tl);
- int tok_sz = tok.end - tok.begin;
+ size_t tok_sz = tok.end - tok.begin;
tl->tok = calloc (tok_sz + 1, sizeof (char));
memcpy (tl->tok, tok.insn + tok.begin, tok_sz * sizeof (char));
tl->val = tok.val;
diff --git a/gas/config/loongarch-parse.y b/gas/config/loongarch-parse.y
index ac35dee..d575748 100644
--- a/gas/config/loongarch-parse.y
+++ b/gas/config/loongarch-parse.y
@@ -42,7 +42,7 @@ is_const (struct reloc_info *info)
}
int
-loongarch_parse_expr (const char *expr,
+loongarch_parse_expr (const char *exp,
struct reloc_info *reloc_stack_top,
size_t max_reloc_num,
size_t *reloc_num,
@@ -52,7 +52,7 @@ loongarch_parse_expr (const char *expr,
struct yy_buffer_state *buffstate;
top = reloc_stack_top;
end = top + max_reloc_num;
- buffstate = yy_scan_string (expr);
+ buffstate = yy_scan_string (exp);
ret = yyparse ();
if (ret == 0)
@@ -207,26 +207,41 @@ emit_bin (int op)
switch (op)
{
case '*':
- opr1 = opr1 * opr2;
+ opr1 = (valueT) opr1 * (valueT) opr2;
break;
case '/':
- opr1 = opr1 / opr2;
+ if (opr2 == 0)
+ {
+ as_warn (_("Divide by zero!"));
+ opr1 = 0;
+ }
+ else
+ opr1 = opr1 / opr2;
break;
case '%':
- opr1 = opr1 % opr2;
+ if (opr2 == 0)
+ {
+ as_warn (_("Divide by zero!"));
+ opr1 = 0;
+ }
+ else
+ opr1 = opr1 % opr2;
break;
case '+':
- opr1 = opr1 + opr2;
+ opr1 = (valueT) opr1 + (valueT) opr2;
break;
case '-':
- opr1 = opr1 - opr2;
+ opr1 = (valueT) opr1 - (valueT) opr2;
break;
case LEFT_OP:
- opr1 = opr1 << opr2;
+ opr1 = (valueT) opr1 << opr2;
break;
case RIGHT_OP:
- /* Algorithm right shift. */
- opr1 = (offsetT)opr1 >> (offsetT)opr2;
+ if (opr1 < 0)
+ as_warn (_("Right shift of negative numbers may be changed "
+ "from arithmetic right shift to logical right shift!"));
+ /* Arithmetic right shift. */
+ opr1 = opr1 >> opr2;
break;
case '<':
opr1 = opr1 < opr2;
diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c
index f481ad4..20167e9 100644
--- a/gas/config/obj-aout.c
+++ b/gas/config/obj-aout.c
@@ -155,7 +155,7 @@ obj_aout_line (int ignore ATTRIBUTE_UNUSED)
/* Assume delimiter is part of expression.
BSD4.2 as fails with delightful bug, so we
are not being incompatible here. */
- new_logical_line ((char *) NULL, (int) (get_absolute_expression ()));
+ new_logical_line (NULL, get_absolute_expression ());
demand_empty_rest_of_line ();
}
diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c
index 70cb4e4..1607a43 100644
--- a/gas/config/obj-coff-seh.c
+++ b/gas/config/obj-coff-seh.c
@@ -64,7 +64,7 @@ get_pxdata_name (segT seg, const char *base_name)
else
name = dollar;
- sname = notes_concat (base_name, name, NULL);
+ sname = notes_concat (base_name, name, (const char *) NULL);
return sname;
}
@@ -121,7 +121,7 @@ seh_hash_insert (const char *name, struct seh_seg_list *item)
static struct seh_seg_list *
seh_hash_find (char *name)
{
- return (struct seh_seg_list *) str_hash_find (seh_hash, name);
+ return str_hash_find (seh_hash, name);
}
static struct seh_seg_list *
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index 19759cd..be6a965 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -90,7 +90,7 @@ stack_init (unsigned long chunk_size,
}
static char *
-stack_push (stack *st, char *element)
+stack_push (stack *st, void *element)
{
if (st->pointer + st->element_size >= st->size)
{
@@ -133,7 +133,7 @@ tag_insert (const char *name, symbolS *symbolP)
static symbolS *
tag_find (char *name)
{
- return (symbolS *) str_hash_find (tag_hash, name);
+ return str_hash_find (tag_hash, name);
}
static symbolS *
@@ -369,10 +369,10 @@ void
coff_obj_symbol_new_hook (symbolS *symbolP)
{
size_t sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type);
- char *s = notes_alloc (sz);
+ combined_entry_type *s = notes_alloc (sz);
memset (s, 0, sz);
- coffsymbol (symbol_get_bfdsym (symbolP))->native = (combined_entry_type *) s;
+ coffsymbol (symbol_get_bfdsym (symbolP))->native = s;
coffsymbol (symbol_get_bfdsym (symbolP))->native->is_sym = true;
S_SET_DATA_TYPE (symbolP, T_NULL);
@@ -462,7 +462,7 @@ obj_coff_ln (int ignore ATTRIBUTE_UNUSED)
/* If there is no lineno symbol, treat a .ln directive
as if it were a (no longer existing) .appline one. */
if (current_lineno_sym == NULL)
- new_logical_line ((char *) NULL, l - 1);
+ new_logical_line (NULL, l - 1);
else
add_lineno (frag_now, frag_now_fix (), l);
@@ -569,7 +569,7 @@ obj_coff_ident (int ignore ATTRIBUTE_UNUSED)
#define SKIP_WHITESPACES() while (is_whitespace (*input_line_pointer)) \
input_line_pointer++;
-static void
+void
obj_coff_def (int what ATTRIBUTE_UNUSED)
{
if (def_symbol_in_progress != NULL)
@@ -903,7 +903,7 @@ obj_coff_line (int ignore ATTRIBUTE_UNUSED)
extern int listing;
if (listing)
- listing_source_line ((unsigned int) this_base);
+ listing_source_line (this_base);
}
#endif
}
@@ -982,8 +982,8 @@ obj_coff_type (int ignore ATTRIBUTE_UNUSED)
S_SET_DATA_TYPE (def_symbol_in_progress, get_absolute_expression ());
- if (ISFCN (S_GET_DATA_TYPE (def_symbol_in_progress)) &&
- S_GET_STORAGE_CLASS (def_symbol_in_progress) != C_TPDEF)
+ if (ISFCN (S_GET_DATA_TYPE (def_symbol_in_progress))
+ && S_GET_STORAGE_CLASS (def_symbol_in_progress) != C_TPDEF)
SF_SET_FUNCTION (def_symbol_in_progress);
demand_empty_rest_of_line ();
@@ -1011,7 +1011,7 @@ obj_coff_val (int ignore ATTRIBUTE_UNUSED)
{
/* If the .val is != from the .def (e.g. statics). */
symbol_set_frag (def_symbol_in_progress, frag_now);
- S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ());
+ S_SET_VALUE (def_symbol_in_progress, frag_now_fix ());
}
else if (! streq (S_GET_NAME (def_symbol_in_progress), symbol_name))
{
@@ -1187,7 +1187,6 @@ coff_assign_symbol (symbolS *symp ATTRIBUTE_UNUSED)
#endif
}
-symbolS *coff_last_function;
#ifndef OBJ_XCOFF
static symbolS *coff_last_bf;
#endif
@@ -1195,6 +1194,7 @@ static symbolS *coff_last_bf;
void
coff_frob_symbol (symbolS *symp, int *punt)
{
+ static symbolS *last_functionP;
static symbolS *last_tagP;
static stack *block_stack;
static symbolS *set_end;
@@ -1325,7 +1325,7 @@ coff_frob_symbol (symbolS *symp, int *punt)
if (S_GET_STORAGE_CLASS (symp) == C_BLOCK)
{
if (streq (S_GET_NAME (symp), ".bb"))
- stack_push (block_stack, (char *) &symp);
+ stack_push (block_stack, &symp);
else
{
symbolS *begin;
@@ -1338,30 +1338,26 @@ coff_frob_symbol (symbolS *symp, int *punt)
}
}
- if (coff_last_function == 0 && SF_GET_FUNCTION (symp)
- && S_IS_DEFINED (symp))
+ if (SF_GET_FUNCTION (symp) && S_IS_DEFINED (symp))
{
union internal_auxent *auxp;
- coff_last_function = symp;
if (S_GET_NUMBER_AUXILIARY (symp) < 1)
S_SET_NUMBER_AUXILIARY (symp, 1);
auxp = SYM_AUXENT (symp);
- memset (auxp->x_sym.x_fcnary.x_ary.x_dimen, 0,
- sizeof (auxp->x_sym.x_fcnary.x_ary.x_dimen));
+ memset (&auxp->x_sym.x_fcnary.x_fcn, 0,
+ sizeof (auxp->x_sym.x_fcnary.x_fcn));
}
if (S_GET_STORAGE_CLASS (symp) == C_EFCN
&& S_IS_DEFINED (symp))
{
- if (coff_last_function == 0)
+ if (!last_functionP)
as_fatal (_("C_EFCN symbol for %s out of scope"),
S_GET_NAME (symp));
- SA_SET_SYM_FSIZE (coff_last_function,
- (long) (S_GET_VALUE (symp)
- - S_GET_VALUE (coff_last_function)));
- next_set_end = coff_last_function;
- coff_last_function = 0;
+ SA_SET_SYM_FSIZE (last_functionP,
+ (S_GET_VALUE (symp)
+ - S_GET_VALUE (last_functionP)));
}
}
@@ -1396,7 +1392,7 @@ coff_frob_symbol (symbolS *symp, int *punt)
*punt = 1;
#endif
- if (set_end != (symbolS *) NULL
+ if (set_end != NULL
&& ! *punt
&& ((symbol_get_bfdsym (symp)->flags & BSF_NOT_AT_END) != 0
|| (S_IS_DEFINED (symp)
@@ -1415,6 +1411,13 @@ coff_frob_symbol (symbolS *symp, int *punt)
set_end = next_set_end;
}
+ if (SF_GET_FUNCTION (symp) && S_IS_DEFINED (symp) && !*punt)
+ {
+ if (last_functionP)
+ SA_SET_SYM_ENDNDX (last_functionP, symp);
+ last_functionP = symp;
+ }
+
#ifndef OBJ_XCOFF
if (! *punt
&& S_GET_STORAGE_CLASS (symp) == C_FCN
@@ -1666,7 +1669,7 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED)
}
}
- sec = subseg_new (name, (subsegT) exp);
+ sec = subseg_new (name, exp);
if (is_bss)
seg_info (sec)->bss = 1;
@@ -1809,8 +1812,8 @@ coff_frob_section (segT sec)
/* Store the values. */
p = fragp->fr_literal;
- bfd_h_put_16 (stdoutput, n_entries, (bfd_byte *) p + 6);
- bfd_h_put_32 (stdoutput, size, (bfd_byte *) p + 8);
+ bfd_h_put_16 (stdoutput, n_entries, p + 6);
+ bfd_h_put_32 (stdoutput, size, p + 8);
}
void
@@ -1824,7 +1827,7 @@ obj_coff_init_stab_section (segT stab ATTRIBUTE_UNUSED, segT stabstr)
p = frag_more (12);
/* Zero it out. */
memset (p, 0, 12);
- file = as_where ((unsigned int *) NULL);
+ file = as_where (NULL);
stroff = get_stab_string_offset (file, stabstr);
know (stroff == 1);
md_number_to_chars (p, stroff, 4);
@@ -1836,7 +1839,7 @@ const char * s_get_name (symbolS *);
const char *
s_get_name (symbolS *s)
{
- return ((s == NULL) ? "(NULL)" : S_GET_NAME (s));
+ return s == NULL ? "(NULL)" : S_GET_NAME (s);
}
void symbol_dump (void);
@@ -1887,8 +1890,8 @@ static const pseudo_typeS coff_pseudo_table[] =
{"loc", obj_coff_loc, 0},
{"optim", s_ignore, 0}, /* For sun386i cc (?) */
{"weak", obj_coff_weak, 0},
-#if defined TC_TIC4X
- /* The tic4x uses sdef instead of def. */
+#if defined (TC_TIC4X) || defined (TC_TIC54X)
+ /* The tic4x and tic54x use sdef instead of def. */
{"sdef", obj_coff_def, 0},
#endif
#if defined(SEH_CMDS)
diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h
index c083ad2..51dfd56 100644
--- a/gas/config/obj-coff.h
+++ b/gas/config/obj-coff.h
@@ -242,7 +242,6 @@
extern int text_lineno_number;
extern int coff_line_base;
extern int coff_n_line_nos;
-extern symbolS *coff_last_function;
#define obj_emit_lineno(WHERE, LINE, FILE_START) abort ()
#define obj_app_file(name) c_dot_file_symbol (name)
@@ -330,7 +329,7 @@ extern void pecoff_obj_clear_weak_hook (symbolS *);
#endif
extern void obj_coff_section (int);
extern segT obj_coff_add_segment (const char *);
-extern void obj_coff_section (int);
+extern void obj_coff_def (int);
extern segT s_get_segment (symbolS *);
#ifndef tc_coff_symbol_emit_hook
extern void tc_coff_symbol_emit_hook (symbolS *);
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index d37d0fd..315d08e 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -205,7 +205,7 @@ elf_file_symbol (const char *s)
if (name_length > strlen (S_GET_NAME (sym)))
{
obstack_grow (&notes, s, name_length + 1);
- S_SET_NAME (sym, (const char *) obstack_finish (&notes));
+ S_SET_NAME (sym, obstack_finish (&notes));
}
else
strcpy ((char *) S_GET_NAME (sym), s);
@@ -481,7 +481,7 @@ match_section (const asection *sec, const struct elf_section_match *match)
static bool
get_section_by_match (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
{
- struct elf_section_match *match = (struct elf_section_match *) inf;
+ struct elf_section_match *match = inf;
const char *gname = match->group_name;
const char *group_name = elf_group_name (sec);
@@ -492,13 +492,6 @@ get_section_by_match (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
&& match_section (sec, match));
}
-static void
-free_section_idx (void *ent)
-{
- string_tuple_t *tuple = ent;
- free ((char *) tuple->value);
-}
-
/* Go look in section lists kept per group for SEC_NAME with
properties given by MATCH. If info for the group named by
MATCH->GROUP_NAME has been initialised, set GROUP_IDX. */
@@ -506,24 +499,24 @@ free_section_idx (void *ent)
static asection *
group_section_find (const struct elf_section_match *match,
const char *sec_name,
- unsigned int **group_idx)
+ unsigned int *group_idx)
{
if (!groups.indexes)
{
groups.num_group = 0;
groups.head = NULL;
groups.indexes = htab_create_alloc (16, hash_string_tuple, eq_string_tuple,
- free_section_idx, notes_calloc, NULL);
- *group_idx = NULL;
+ NULL, notes_calloc, NULL);
+ *group_idx = ~0u;
return NULL;
}
- *group_idx = str_hash_find (groups.indexes, match->group_name);
- if (*group_idx == NULL)
+ *group_idx = str_hash_find_int (groups.indexes, match->group_name);
+ if (*group_idx == ~0u)
return NULL;
asection *s;
- for (s = groups.head[**group_idx]; s != NULL; s = elf_next_in_group (s))
+ for (s = groups.head[*group_idx]; s != NULL; s = elf_next_in_group (s))
if ((s->name == sec_name
|| strcmp (s->name, sec_name) == 0)
&& match_section (s, match))
@@ -537,12 +530,12 @@ group_section_find (const struct elf_section_match *match,
static void
group_section_insert (const struct elf_section_match *match,
asection *sec,
- unsigned int **group_idx)
+ unsigned int *group_idx)
{
- if (*group_idx != NULL)
+ if (*group_idx != ~0u)
{
- elf_next_in_group (sec) = groups.head[**group_idx];
- groups.head[**group_idx] = sec;
+ elf_next_in_group (sec) = groups.head[*group_idx];
+ groups.head[*group_idx] = sec;
return;
}
@@ -553,14 +546,8 @@ group_section_insert (const struct elf_section_match *match,
groups.num_group += 1;
/* We keep the index into groups.head rather than the entry address
- because groups.head may be realloc'd, and because str_hash values
- are a void* we make a copy of the index. Strictly speaking there
- is no guarantee that void* can represent any int value, so doing
- without the indirection by casting an int or even uintptr_t may
- for example lose lsbs of the value. */
- unsigned int *idx_ptr = XNEW (unsigned int);
- *idx_ptr = i;
- str_hash_insert (groups.indexes, match->group_name, idx_ptr, 0);
+ because groups.head may be realloc'd. */
+ str_hash_insert_int (groups.indexes, match->group_name, i, 0);
}
/* Handle the .section pseudo-op. This code supports two different
@@ -622,12 +609,12 @@ change_section (const char *name,
obj_elf_section_change_hook ();
- unsigned int *group_idx = NULL;
+ unsigned int group_idx = ~0u;
if (match_p->group_name)
old_sec = group_section_find (match_p, name, &group_idx);
else
old_sec = bfd_get_section_by_name_if (stdoutput, name, get_section_by_match,
- (void *) match_p);
+ match_p);
if (old_sec)
{
sec = old_sec;
@@ -781,7 +768,7 @@ change_section (const char *name,
|| startswith (name, ".note.gnu"))
flags |= SEC_ELF_OCTETS;
}
-
+
if (old_sec == NULL)
{
symbolS *secsym;
@@ -955,13 +942,12 @@ obj_elf_parse_section_letters (char *str, size_t len,
if (ISDIGIT (*str))
{
char * end;
- struct elf_backend_data *bed;
+ const struct elf_backend_data *bed;
bfd_vma numeric_flags = strtoul (str, &end, 0);
attr |= numeric_flags;
- bed = (struct elf_backend_data *)
- get_elf_backend_data (stdoutput);
+ bed = get_elf_backend_data (stdoutput);
if (bed->elf_osabi == ELFOSABI_NONE
|| bed->elf_osabi == ELFOSABI_STANDALONE
@@ -1151,7 +1137,7 @@ elf_set_group_name (asection *sec, const char *gname)
& SEC_ASSEMBLER_SHF_MASK);
match.flags = bfd_section_flags (sec) & SEC_ASSEMBLER_SECTION_ID;
- unsigned int *group_idx;
+ unsigned int group_idx;
if (!group_section_find (&match, sec->name, &group_idx))
group_section_insert (&match, sec, &group_idx);
}
@@ -1177,6 +1163,15 @@ obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED)
elf_set_group_name (now_seg, gname);
}
+/* Handle section related directives.
+
+ Note on support for SFrame sections: These are generally expected to be
+ generated by the assembler. However, this function permits their direct
+ creation by the user. At the moment though, we go no extra mile by adding
+ an explicit @sframe for SHT_GNU_SFRAME (using the numeric value of section
+ type should suffice); Nor do we implement any outright refusal for
+ non-supported targets via ELFOSABI-specific checks. */
+
void
obj_elf_section (int push)
{
@@ -1242,7 +1237,7 @@ obj_elf_section (int push)
if (push && ISDIGIT (*input_line_pointer))
{
/* .pushsection has an optional subsection. */
- new_subsection = (subsegT) get_absolute_expression ();
+ new_subsection = get_absolute_expression ();
SKIP_WHITESPACE ();
@@ -1473,7 +1468,7 @@ obj_elf_section (int push)
char *t = input_line_pointer;
match.sh_info = strtoul (input_line_pointer,
&input_line_pointer, 0);
- if (match.sh_info == (unsigned int) -1)
+ if (match.sh_info == -1u)
{
as_warn (_("unsupported mbind section info: %s"), t);
match.sh_info = 0;
@@ -1510,8 +1505,7 @@ obj_elf_section (int push)
errno = 0;
id = strtoul (input_line_pointer,
&input_line_pointer, 0);
- overflow = (id == (unsigned long) -1
- && errno == ERANGE);
+ overflow = id == -1ul && errno == ERANGE;
}
else
{
@@ -1520,7 +1514,7 @@ obj_elf_section (int push)
(const char **) &input_line_pointer, 0);
overflow = id == ~(bfd_vma) 0;
}
- if (overflow || id > (unsigned int) -1)
+ if (overflow || id > -1u)
{
char *linefeed, saved_char = 0;
if ((linefeed = strchr (t, '\n')) != NULL)
@@ -1627,7 +1621,7 @@ obj_elf_bss (int i ATTRIBUTE_UNUSED)
obj_elf_section_change_hook ();
temp = get_absolute_expression ();
- subseg_set (bss_section, (subsegT) temp);
+ subseg_set (bss_section, temp);
demand_empty_rest_of_line ();
#ifdef md_elf_section_change_hook
@@ -1701,7 +1695,7 @@ obj_elf_subsection (int ignore ATTRIBUTE_UNUSED)
obj_elf_section_change_hook ();
temp = get_absolute_expression ();
- subseg_set (now_seg, (subsegT) temp);
+ subseg_set (now_seg, temp);
demand_empty_rest_of_line ();
#ifdef md_elf_section_change_hook
@@ -2273,39 +2267,25 @@ elf_obj_symbol_new_hook (symbolS *symbolP)
#endif
}
-/* Deduplicate size expressions. We might get into trouble with
- multiple freeing or use after free if we leave them pointing to the
- same expressionS. */
-
+/* If size is unset, copy size from src. Because we don't track whether
+ .size has been used, we can't differentiate .size dest, 0 from the case
+ where dest's size is unset. */
void
-elf_obj_symbol_clone_hook (symbolS *newsym, symbolS *orgsym ATTRIBUTE_UNUSED)
+elf_copy_symbol_size (symbolS *dest, symbolS *src)
{
- struct elf_obj_sy *newelf = symbol_get_obj (newsym);
- if (newelf->size)
+ struct elf_obj_sy *srcelf = symbol_get_obj (src);
+ struct elf_obj_sy *destelf = symbol_get_obj (dest);
+ if (!destelf->size && S_GET_SIZE (dest) == 0)
{
- expressionS *exp = XNEW (expressionS);
- *exp = *newelf->size;
- newelf->size = exp;
+ destelf->size = srcelf->size;
+ S_SET_SIZE (dest, S_GET_SIZE (src));
}
}
void
elf_copy_symbol_attributes (symbolS *dest, symbolS *src)
{
- struct elf_obj_sy *srcelf = symbol_get_obj (src);
- struct elf_obj_sy *destelf = symbol_get_obj (dest);
- /* If size is unset, copy size from src. Because we don't track whether
- .size has been used, we can't differentiate .size dest, 0 from the case
- where dest's size is unset. */
- if (!destelf->size && S_GET_SIZE (dest) == 0)
- {
- if (srcelf->size)
- {
- destelf->size = XNEW (expressionS);
- *destelf->size = *srcelf->size;
- }
- S_SET_SIZE (dest, S_GET_SIZE (src));
- }
+ elf_copy_symbol_size (dest, src);
/* Don't copy visibility. */
S_SET_OTHER (dest, (ELF_ST_VISIBILITY (S_GET_OTHER (dest))
| (S_GET_OTHER (src) & ~ELF_ST_VISIBILITY (-1))));
@@ -2404,12 +2384,11 @@ obj_elf_size (int ignore ATTRIBUTE_UNUSED)
if (exp.X_op == O_constant)
{
S_SET_SIZE (sym, exp.X_add_number);
- xfree (symbol_get_obj (sym)->size);
symbol_get_obj (sym)->size = NULL;
}
else
{
- symbol_get_obj (sym)->size = XNEW (expressionS);
+ symbol_get_obj (sym)->size = notes_alloc (sizeof (exp));
*symbol_get_obj (sym)->size = exp;
}
@@ -2719,7 +2698,7 @@ set_additional_section_info (bfd *abfd,
if (!strcmp ("str", sec->name + strlen (sec->name) - 3))
return;
- name = concat (sec->name, "str", NULL);
+ name = concat (sec->name, "str", (const char *) NULL);
strsec = bfd_get_section_by_name (abfd, name);
if (strsec)
strsz = bfd_section_size (strsec);
@@ -2805,7 +2784,6 @@ elf_frob_symbol (symbolS *symp, int *puntp)
as_warn (_(".size expression for %s "
"does not evaluate to a constant"), S_GET_NAME (symp));
}
- free (sy_obj->size);
sy_obj->size = NULL;
}
@@ -3336,7 +3314,7 @@ const struct format_ops elf_format_ops =
#endif
elf_obj_read_begin_hook,
elf_obj_symbol_new_hook,
- elf_obj_symbol_clone_hook,
+ 0,
elf_adjust_symtab
};
diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h
index c8b5740..1e0ac58 100644
--- a/gas/config/obj-elf.h
+++ b/gas/config/obj-elf.h
@@ -224,11 +224,7 @@ void elf_obj_symbol_new_hook (symbolS *);
#define obj_symbol_new_hook elf_obj_symbol_new_hook
#endif
-void elf_obj_symbol_clone_hook (symbolS *, symbolS *);
-#ifndef obj_symbol_clone_hook
-#define obj_symbol_clone_hook elf_obj_symbol_clone_hook
-#endif
-
+void elf_copy_symbol_size (symbolS *, symbolS *);
void elf_copy_symbol_attributes (symbolS *, symbolS *);
#ifndef OBJ_COPY_SYMBOL_ATTRIBUTES
#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST, SRC) \
diff --git a/gas/config/obj-evax.c b/gas/config/obj-evax.c
index c5317e8..9fbde27 100644
--- a/gas/config/obj-evax.c
+++ b/gas/config/obj-evax.c
@@ -107,8 +107,7 @@ evax_frob_symbol (symbolS *sym, int *punt)
else if ((symbol->flags & BSF_GLOBAL) && (symbol->flags & BSF_FUNCTION))
{
- struct evax_private_udata_struct *udata
- = (struct evax_private_udata_struct *)symbol->udata.p;
+ struct evax_private_udata_struct *udata = symbol->udata.p;
/* Fix up equates of function definitions. */
while (udata->enbsym == NULL)
diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
index d0cd3af..01e76c5 100644
--- a/gas/config/obj-macho.c
+++ b/gas/config/obj-macho.c
@@ -531,8 +531,8 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED)
SKIP_WHITESPACE ();
if (*input_line_pointer == ',')
{
- align = (unsigned int) parse_align (0);
- if (align == (unsigned int) -1)
+ align = parse_align (0);
+ if (align == -1u)
{
as_warn (_("align value not recognized, using size"));
align = size;
@@ -552,7 +552,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED)
new_seg = obj_mach_o_make_or_get_sect (segname, sectname, specified_mask,
BFD_MACH_O_S_ZEROFILL,
BFD_MACH_O_S_ATTR_NONE,
- align, (offsetT) 0 /*stub size*/);
+ align, 0 /*stub size*/);
if (new_seg == NULL)
return;
@@ -960,7 +960,7 @@ obj_mach_o_fileprop (int prop)
if (prop < 0 || prop >= OBJ_MACH_O_FILE_PROP_MAX)
as_fatal (_("internal error: bad file property ID %d"), prop);
- switch ((obj_mach_o_file_properties) prop)
+ switch (prop)
{
case OBJ_MACH_O_FILE_PROP_SUBSECTS_VIA_SYMS:
obj_mach_o_subsections_by_symbols = 1;
@@ -1023,7 +1023,7 @@ obj_mach_o_set_symbol_qualifier (symbolS *sym, int type)
if (sec != NULL)
sectype = sec->flags & BFD_MACH_O_SECTION_TYPE_MASK;
- switch ((obj_mach_o_symbol_type) type)
+ switch (type)
{
case OBJ_MACH_O_SYM_LOCAL:
/* This is an extension over the system tools. */
@@ -1613,7 +1613,7 @@ obj_mach_o_check_before_writing (bfd *abfd ATTRIBUTE_UNUSED,
void
obj_mach_o_pre_output_hook (void)
{
- bfd_map_over_sections (stdoutput, obj_mach_o_check_before_writing, (char *) 0);
+ bfd_map_over_sections (stdoutput, obj_mach_o_check_before_writing, NULL);
}
/* Here we count up frags in each subsection (where a sub-section is defined
@@ -1662,7 +1662,7 @@ obj_mach_o_set_subsections (bfd *abfd ATTRIBUTE_UNUSED,
void
obj_mach_o_pre_relax_hook (void)
{
- bfd_map_over_sections (stdoutput, obj_mach_o_set_subsections, (char *) 0);
+ bfd_map_over_sections (stdoutput, obj_mach_o_set_subsections, NULL);
}
/* Zerofill and GB Zerofill sections must be sorted to follow all other
@@ -1698,7 +1698,7 @@ obj_mach_o_set_section_vma (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *v_p
{
bfd_mach_o_section *ms = bfd_mach_o_get_mach_o_section (sec);
unsigned bfd_align = bfd_section_alignment (sec);
- obj_mach_o_set_vma_data *p = (struct obj_mach_o_set_vma_data *)v_p;
+ obj_mach_o_set_vma_data *p = v_p;
unsigned sectype = (ms->flags & BFD_MACH_O_SECTION_TYPE_MASK);
unsigned zf;
@@ -1741,11 +1741,11 @@ void obj_mach_o_post_relax_hook (void)
memset (&d, 0, sizeof (d));
- bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, (char *) &d);
+ bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, &d);
if ((d.vma_pass = d.zerofill_seen) != 0)
- bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, (char *) &d);
+ bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, &d);
if ((d.vma_pass = d.gb_zerofill_seen) != 0)
- bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, (char *) &d);
+ bfd_map_over_sections (stdoutput, obj_mach_o_set_section_vma, &d);
}
static void
@@ -1777,8 +1777,7 @@ obj_mach_o_set_indirect_symbols (bfd *abfd, asection *sec,
obj_mach_o_indirect_sym *isym;
obj_mach_o_indirect_sym *list = NULL;
obj_mach_o_indirect_sym *list_tail = NULL;
- unsigned long eltsiz =
- bfd_mach_o_section_get_entry_size (abfd, ms);
+ unsigned long eltsiz = bfd_mach_o_section_get_entry_size (abfd, ms);
for (isym = indirect_syms; isym != NULL; isym = isym->next)
{
@@ -1801,7 +1800,7 @@ obj_mach_o_set_indirect_symbols (bfd *abfd, asection *sec,
entry size, we're dead ... */
gas_assert (eltsiz != 0);
- ncalc = (unsigned int) (sect_size / eltsiz);
+ ncalc = sect_size / eltsiz;
if (nactual != ncalc)
as_bad (_("the number of .indirect_symbols defined in section %s"
" does not match the number expected (%d defined, %d"
@@ -1875,7 +1874,7 @@ obj_mach_o_set_indirect_symbols (bfd *abfd, asection *sec,
void
obj_mach_o_frob_file_after_relocs (void)
{
- bfd_map_over_sections (stdoutput, obj_mach_o_set_indirect_symbols, (char *) 0);
+ bfd_map_over_sections (stdoutput, obj_mach_o_set_indirect_symbols, NULL);
}
/* Reverse relocations order to make ld happy. */
diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c
index 0d8108f..7cfc9cb 100644
--- a/gas/config/obj-som.c
+++ b/gas/config/obj-som.c
@@ -246,7 +246,7 @@ obj_som_init_stab_section (segT stab, segT stabstr)
the call to get_stab_string_offset. */
p = frag_more (12);
memset (p, 0, 12);
- file = as_where ((unsigned int *) NULL);
+ file = as_where (NULL);
stroff = get_stab_string_offset (file, stabstr);
know (stroff == 1);
md_number_to_chars (p, stroff, 4);
@@ -284,8 +284,8 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
p = seg_info (sec)->stabu.p;
gas_assert (p != 0);
- bfd_h_put_16 (abfd, (bfd_vma) nsyms, (bfd_byte *) p + 6);
- bfd_h_put_32 (abfd, (bfd_vma) strsz, (bfd_byte *) p + 8);
+ bfd_h_put_16 (abfd, nsyms, p + 6);
+ bfd_h_put_32 (abfd, strsz, p + 8);
}
/* Called late in the assembly phase to adjust the special
@@ -294,7 +294,7 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
void
som_frob_file (void)
{
- bfd_map_over_sections (stdoutput, adjust_stab_sections, (void *) 0);
+ bfd_map_over_sections (stdoutput, adjust_stab_sections, NULL);
}
static void
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index e071ad1..96bfe74 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -907,7 +907,7 @@ parse_reg (char **ccp)
p++;
while (ISALPHA (*p) || ISDIGIT (*p) || *p == '_');
- reg = (reg_entry *) str_hash_find_n (aarch64_reg_hsh, start, p - start);
+ reg = str_hash_find_n (aarch64_reg_hsh, start, p - start);
if (!reg)
return NULL;
@@ -2351,6 +2351,14 @@ s_aarch64_cfi_b_key_frame (int ignored ATTRIBUTE_UNUSED)
fde->pauth_key = AARCH64_PAUTH_KEY_B;
}
+static void
+s_aarch64_mte_tagged_frame (int ignored ATTRIBUTE_UNUSED)
+{
+ demand_empty_rest_of_line ();
+ struct fde_entry *fde = frchain_now->frch_cfi_data->cur_fde_data;
+ fde->memtag_frame_p = true;
+}
+
#ifdef OBJ_ELF
/* Emit BFD_RELOC_AARCH64_TLSDESC_ADD on the next ADD instruction. */
@@ -2476,6 +2484,7 @@ const pseudo_typeS md_pseudo_table[] = {
{"arch_extension", s_aarch64_arch_extension, 0},
{"inst", s_aarch64_inst, 0},
{"cfi_b_key_frame", s_aarch64_cfi_b_key_frame, 0},
+ {"cfi_mte_tagged_frame", s_aarch64_mte_tagged_frame, 0},
#ifdef OBJ_ELF
{"tlsdescadd", s_tlsdescadd, 0},
{"tlsdesccall", s_tlsdesccall, 0},
@@ -4607,7 +4616,9 @@ parse_hint_opt (const char *name, char **str,
&& o->value != HINT_OPD_CSYNC)
|| ((strcmp ("bti", name) == 0)
&& (o->value != HINT_OPD_C && o->value != HINT_OPD_J
- && o->value != HINT_OPD_JC)))
+ && o->value != HINT_OPD_JC))
+ || ((strcmp ("stshh", name) == 0)
+ && (o->value != HINT_OPD_KEEP && o->value != HINT_OPD_STRM)))
return false;
*str = q;
@@ -4954,6 +4965,10 @@ parse_sme_sm_za (char **str)
return TOLOWER (p[0]);
}
+/* By default, system register accesses are unguarded (apart from the
+ requirement of +d128 for mrrs/msrr). */
+static int sysreg_checking_p = 0;
+
/* Parse a system register or a PSTATE field name for an MSR/MRS instruction.
Returns the encoding for the option, or PARSE_FAIL.
@@ -5008,10 +5023,11 @@ parse_sys_reg (char **str, htab_t sys_regs,
}
else
{
- if (pstatefield_p && !aarch64_pstatefield_supported_p (cpu_variant, o))
+ if (pstatefield_p && sysreg_checking_p
+ && !aarch64_pstatefield_supported_p (cpu_variant, o))
as_bad (_("selected processor does not support PSTATE field "
"name '%s'"), buf);
- if (!pstatefield_p
+ if (!pstatefield_p && sysreg_checking_p
&& !aarch64_sys_ins_reg_supported_p (cpu_variant, o->name,
o->flags, &o->features))
as_bad (_("selected processor does not support system register "
@@ -5092,12 +5108,14 @@ parse_sys_ins_reg (char **str, htab_t sys_ins_regs, bool sysreg128_p)
} while (0)
#define po_imm_nc_or_fail() do { \
- if (! parse_constant_immediate (&str, &val, imm_reg_type)) \
+ aarch64_reg_type invalid_types = imm_invalid_reg_types (opcode->flags); \
+ if (! parse_constant_immediate (&str, &val, invalid_types)) \
goto failure; \
} while (0)
#define po_imm_or_fail(min, max) do { \
- if (! parse_constant_immediate (&str, &val, imm_reg_type)) \
+ aarch64_reg_type invalid_types = imm_invalid_reg_types (opcode->flags); \
+ if (! parse_constant_immediate (&str, &val, invalid_types)) \
goto failure; \
if (val < min || val > max) \
{ \
@@ -5108,8 +5126,9 @@ parse_sys_ins_reg (char **str, htab_t sys_ins_regs, bool sysreg128_p)
} while (0)
#define po_enum_or_fail(array) do { \
+ aarch64_reg_type invalid_types = imm_invalid_reg_types (opcode->flags); \
if (!parse_enum_string (&str, &val, array, \
- ARRAY_SIZE (array), imm_reg_type)) \
+ ARRAY_SIZE (array), invalid_types)) \
goto failure; \
} while (0)
@@ -5175,6 +5194,13 @@ encode_branch_ofs_26 (uint32_t ofs)
return ofs & ((1 << 26) - 1);
}
+/* encode the 9-bit offset of FEAT_CMPBR compare and branch */
+static inline uint32_t
+encode_cond_branch_ofs_9 (uint32_t ofs)
+{
+ return (ofs & ((1 << 9) - 1)) << 5;
+}
+
/* encode the 19-bit offset of conditional branch and compare & branch */
static inline uint32_t
encode_cond_branch_ofs_19 (uint32_t ofs)
@@ -5615,7 +5641,7 @@ static const char *aarch64_apply_style
{
int res;
char *ptr;
- struct obstack *stack = (struct obstack *) styler->state;
+ struct obstack *stack = styler->state;
va_list ap;
/* Calculate the required space. */
@@ -5625,7 +5651,7 @@ static const char *aarch64_apply_style
gas_assert (res >= 0);
/* Allocate space on the obstack and format the result. */
- ptr = (char *) obstack_alloc (stack, res + 1);
+ ptr = obstack_alloc (stack, res + 1);
res = vsnprintf (ptr, (res + 1), fmt, args);
gas_assert (res >= 0);
@@ -5644,7 +5670,7 @@ print_operands (char *buf, const aarch64_opcode *opcode,
obstack_init (&content);
styler.apply_style = aarch64_apply_style;
- styler.state = (void *) &content;
+ styler.state = &content;
for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)
{
@@ -6254,10 +6280,7 @@ typedef struct templates templates;
static templates *
lookup_mnemonic (const char *start, int len)
{
- templates *templ = NULL;
-
- templ = str_hash_find_n (aarch64_ops_hsh, start, len);
- return templ;
+ return str_hash_find_n (aarch64_ops_hsh, start, len);
}
/* Subroutine of md_assemble, responsible for looking up the primary
@@ -6388,6 +6411,8 @@ process_omitted_operand (enum aarch64_opnd type, const aarch64_opcode *opcode,
case AARCH64_OPND_UIMM3_OP2:
case AARCH64_OPND_IMM:
case AARCH64_OPND_IMM_2:
+ case AARCH64_OPND_IMMP1_2:
+ case AARCH64_OPND_IMMS1_2:
case AARCH64_OPND_WIDTH:
case AARCH64_OPND_UIMM7:
case AARCH64_OPND_NZCV:
@@ -6649,6 +6674,28 @@ reg_list_valid_p (uint32_t reginfo, struct aarch64_reglist *list,
return true;
}
+static aarch64_reg_type
+imm_invalid_reg_types (uint64_t flags)
+{
+ switch (flags & F_INVALID_IMM_SYMS)
+ {
+ case F_INVALID_IMM_SYMS_1:
+ return REG_TYPE_R_ZR_BHSDQ_V;
+
+ case F_INVALID_IMM_SYMS_2:
+ return REG_TYPE_R_ZR_SP_BHSDQ_VZP;
+
+ case F_INVALID_IMM_SYMS_3:
+ return REG_TYPE_R_ZR_SP_BHSDQ_VZP_PN;
+
+ default:
+ /* All instructions with immediate operands require an explicit flag -
+ this ensures that the flags will not be forgotten when adding new
+ instructions. */
+ gas_assert (0);
+ }
+}
+
/* Generic instruction operand parser. This does no encoding and no
semantic validation; it merely squirrels values away in the inst
structure. Returns TRUE or FALSE depending on whether the
@@ -6661,19 +6708,10 @@ parse_operands (char *str, const aarch64_opcode *opcode)
char *backtrack_pos = 0;
const enum aarch64_opnd *operands = opcode->operands;
const uint64_t flags = opcode->flags;
- aarch64_reg_type imm_reg_type;
clear_error ();
skip_whitespace (str);
- if (AARCH64_CPU_HAS_FEATURE (*opcode->avariant, SME2))
- imm_reg_type = REG_TYPE_R_ZR_SP_BHSDQ_VZP_PN;
- else if (AARCH64_CPU_HAS_FEATURE (*opcode->avariant, SVE)
- || AARCH64_CPU_HAS_FEATURE (*opcode->avariant, SVE2))
- imm_reg_type = REG_TYPE_R_ZR_SP_BHSDQ_VZP;
- else
- imm_reg_type = REG_TYPE_R_ZR_BHSDQ_V;
-
for (i = 0; operands[i] != AARCH64_OPND_NIL; i++)
{
int64_t val;
@@ -6823,6 +6861,7 @@ parse_operands (char *str, const aarch64_opcode *opcode)
case AARCH64_OPND_SVE_Zn:
case AARCH64_OPND_SVE_Zt:
case AARCH64_OPND_SME_Zm:
+ case AARCH64_OPND_SME_Zm_17:
reg_type = REG_TYPE_Z;
goto vector_reg;
@@ -6910,6 +6949,7 @@ parse_operands (char *str, const aarch64_opcode *opcode)
case AARCH64_OPND_SME_Zn_INDEX1_16:
case AARCH64_OPND_SME_Zn_INDEX2_15:
case AARCH64_OPND_SME_Zn_INDEX2_16:
+ case AARCH64_OPND_SME_Zn_INDEX2_19:
case AARCH64_OPND_SME_Zn_INDEX3_14:
case AARCH64_OPND_SME_Zn_INDEX3_15:
case AARCH64_OPND_SME_Zn_INDEX4_14:
@@ -7154,6 +7194,16 @@ parse_operands (char *str, const aarch64_opcode *opcode)
info->imm.value = val;
break;
+ case AARCH64_OPND_IMMP1_2:
+ po_imm_or_fail (1, 64);
+ info->imm.value = val - 1;
+ break;
+
+ case AARCH64_OPND_IMMS1_2:
+ po_imm_or_fail (-1, 62);
+ info->imm.value = val + 1;
+ break;
+
case AARCH64_OPND_SVE_AIMM:
case AARCH64_OPND_SVE_ASIMM:
po_imm_nc_or_fail ();
@@ -7217,13 +7267,15 @@ parse_operands (char *str, const aarch64_opcode *opcode)
{
int qfloat;
bool res1 = false, res2 = false;
+ aarch64_reg_type invalid_types
+ = imm_invalid_reg_types (opcode->flags);
/* N.B. -0.0 will be rejected; although -0.0 shouldn't be rejected,
it is probably not worth the effort to support it. */
if (!(res1 = parse_aarch64_imm_float (&str, &qfloat, false,
- imm_reg_type))
+ invalid_types))
&& (error_p ()
|| !(res2 = parse_constant_immediate (&str, &val,
- imm_reg_type))))
+ invalid_types))))
goto failure;
if ((res1 && qfloat == 0) || (res2 && val == 0))
{
@@ -7257,7 +7309,8 @@ parse_operands (char *str, const aarch64_opcode *opcode)
case AARCH64_OPND_SIMD_IMM:
case AARCH64_OPND_SIMD_IMM_SFT:
- if (! parse_big_immediate (&str, &val, imm_reg_type))
+ if (! parse_big_immediate (&str, &val,
+ imm_invalid_reg_types (opcode->flags)))
goto failure;
assign_imm_if_const_or_fixup_later (&inst.reloc, info,
/* addr_off_p */ 0,
@@ -7285,11 +7338,13 @@ parse_operands (char *str, const aarch64_opcode *opcode)
case AARCH64_OPND_SIMD_FPIMM:
case AARCH64_OPND_SVE_FPIMM8:
{
+ aarch64_reg_type invalid_types
+ = imm_invalid_reg_types (opcode->flags);
int qfloat;
bool dp_p;
dp_p = double_precision_operand_p (&inst.base.operands[0]);
- if (!parse_aarch64_imm_float (&str, &qfloat, dp_p, imm_reg_type)
+ if (!parse_aarch64_imm_float (&str, &qfloat, dp_p, invalid_types)
|| !aarch64_imm_float_p (qfloat))
{
if (!error_p ())
@@ -7306,11 +7361,13 @@ parse_operands (char *str, const aarch64_opcode *opcode)
case AARCH64_OPND_SVE_I1_HALF_TWO:
case AARCH64_OPND_SVE_I1_ZERO_ONE:
{
+ aarch64_reg_type invalid_types
+ = imm_invalid_reg_types (opcode->flags);
int qfloat;
bool dp_p;
dp_p = double_precision_operand_p (&inst.base.operands[0]);
- if (!parse_aarch64_imm_float (&str, &qfloat, dp_p, imm_reg_type))
+ if (!parse_aarch64_imm_float (&str, &qfloat, dp_p, invalid_types))
{
if (!error_p ())
set_fatal_syntax_error (_("invalid floating-point"
@@ -7399,13 +7456,17 @@ parse_operands (char *str, const aarch64_opcode *opcode)
case AARCH64_OPND_EXCEPTION:
case AARCH64_OPND_UNDEFINED:
- po_misc_or_fail (parse_immediate_expression (&str, &inst.reloc.exp,
- imm_reg_type));
- assign_imm_if_const_or_fixup_later (&inst.reloc, info,
- /* addr_off_p */ 0,
- /* need_libopcodes_p */ 0,
- /* skip_p */ 1);
- break;
+ {
+ aarch64_reg_type invalid_types
+ = imm_invalid_reg_types (opcode->flags);
+ po_misc_or_fail (parse_immediate_expression (&str, &inst.reloc.exp,
+ invalid_types));
+ assign_imm_if_const_or_fixup_later (&inst.reloc, info,
+ /* addr_off_p */ 0,
+ /* need_libopcodes_p */ 0,
+ /* skip_p */ 1);
+ break;
+ }
case AARCH64_OPND_NZCV:
{
@@ -7450,6 +7511,7 @@ parse_operands (char *str, const aarch64_opcode *opcode)
info->imm.value = 0;
break;
+ case AARCH64_OPND_ADDR_PCREL9:
case AARCH64_OPND_ADDR_PCREL14:
case AARCH64_OPND_ADDR_PCREL19:
case AARCH64_OPND_ADDR_PCREL21:
@@ -7487,8 +7549,11 @@ parse_operands (char *str, const aarch64_opcode *opcode)
case compbranch:
case condbranch:
/* e.g. CBZ or B.COND */
- gas_assert (operands[i] == AARCH64_OPND_ADDR_PCREL19);
- inst.reloc.type = BFD_RELOC_AARCH64_BRANCH19;
+ gas_assert (operands[i] == AARCH64_OPND_ADDR_PCREL9
+ || operands[i] == AARCH64_OPND_ADDR_PCREL19);
+ inst.reloc.type = (operands[i] == AARCH64_OPND_ADDR_PCREL9)
+ ? BFD_RELOC_AARCH64_BRANCH9
+ : BFD_RELOC_AARCH64_BRANCH19;
break;
case testbranch:
/* e.g. TBZ */
@@ -7806,8 +7871,12 @@ parse_operands (char *str, const aarch64_opcode *opcode)
info->addr.offset.imm = inst.reloc.exp.X_add_number;
break;
- case AARCH64_OPND_SVE_ADDR_R:
- /* [<Xn|SP>{, <R><m>}]
+ case AARCH64_OPND_SVE_ADDR_RR:
+ case AARCH64_OPND_SVE_ADDR_RR_LSL1:
+ case AARCH64_OPND_SVE_ADDR_RR_LSL2:
+ case AARCH64_OPND_SVE_ADDR_RR_LSL3:
+ case AARCH64_OPND_SVE_ADDR_RR_LSL4:
+ /* [<Xn|SP>{, <R><m>{, lsl #<amount>}}]
but recognizing SVE registers. */
po_misc_or_fail (parse_sve_address (&str, info, &base_qualifier,
&offset_qualifier));
@@ -7816,8 +7885,21 @@ parse_operands (char *str, const aarch64_opcode *opcode)
offset_qualifier = AARCH64_OPND_QLF_X;
info->addr.offset.is_reg = 1;
info->addr.offset.regno = 31;
+
+ /* We set the shifter amount here, but let regoff_addr assign the
+ shifter kind. */
+ if (operands[i] == AARCH64_OPND_SVE_ADDR_RR)
+ info->shifter.amount = 0;
+ else if (operands[i] == AARCH64_OPND_SVE_ADDR_RR_LSL1)
+ info->shifter.amount = 1;
+ else if (operands[i] == AARCH64_OPND_SVE_ADDR_RR_LSL2)
+ info->shifter.amount = 2;
+ else if (operands[i] == AARCH64_OPND_SVE_ADDR_RR_LSL3)
+ info->shifter.amount = 3;
+ else
+ info->shifter.amount = 4;
}
- else if (base_qualifier != AARCH64_OPND_QLF_X
+ if (base_qualifier != AARCH64_OPND_QLF_X
|| offset_qualifier != AARCH64_OPND_QLF_X)
{
set_syntax_error (_("invalid addressing mode"));
@@ -7825,11 +7907,11 @@ parse_operands (char *str, const aarch64_opcode *opcode)
}
goto regoff_addr;
- case AARCH64_OPND_SVE_ADDR_RR:
- case AARCH64_OPND_SVE_ADDR_RR_LSL1:
- case AARCH64_OPND_SVE_ADDR_RR_LSL2:
- case AARCH64_OPND_SVE_ADDR_RR_LSL3:
- case AARCH64_OPND_SVE_ADDR_RR_LSL4:
+ case AARCH64_OPND_SVE_ADDR_RM:
+ case AARCH64_OPND_SVE_ADDR_RM_LSL1:
+ case AARCH64_OPND_SVE_ADDR_RM_LSL2:
+ case AARCH64_OPND_SVE_ADDR_RM_LSL3:
+ case AARCH64_OPND_SVE_ADDR_RM_LSL4:
case AARCH64_OPND_SVE_ADDR_RX:
case AARCH64_OPND_SVE_ADDR_RX_LSL1:
case AARCH64_OPND_SVE_ADDR_RX_LSL2:
@@ -8053,7 +8135,9 @@ parse_operands (char *str, const aarch64_opcode *opcode)
{
/* DSB nXS barrier variant accept 5-bit unsigned immediate, with
possible values 16, 20, 24 or 28 , encoded as val<3:2>. */
- if (! parse_constant_immediate (&str, &val, imm_reg_type))
+ aarch64_reg_type invalid_types
+ = imm_invalid_reg_types (opcode->flags);
+ if (! parse_constant_immediate (&str, &val, invalid_types))
goto failure;
if (!(val == 16 || val == 20 || val == 24 || val == 28))
{
@@ -8068,9 +8152,18 @@ parse_operands (char *str, const aarch64_opcode *opcode)
case AARCH64_OPND_PRFOP:
val = parse_pldop (&str);
+
+ if (opcode->iclass != ldst_pos && val == 0x18)
+ {
+ set_syntax_error (_("invalid prefetch operation (IR is not valid for"
+ " this instruction variant)"));
+ goto failure;
+ }
+
/* This is an extension to accept a 0..31 immediate. */
if (val == PARSE_FAIL)
po_imm_or_fail (0, 31);
+
inst.base.operands[i].prfop = aarch64_prfops + val;
break;
@@ -8150,6 +8243,11 @@ parse_operands (char *str, const aarch64_opcode *opcode)
goto failure;
break;
+ case AARCH64_OPND_STSHH_POLICY:
+ if (!parse_hint_opt (opcode->name, &str, &(info->hint_option)))
+ goto failure;
+ break;
+
case AARCH64_OPND_SME_ZAda_1b:
case AARCH64_OPND_SME_ZAda_2b:
case AARCH64_OPND_SME_ZAda_3b:
@@ -8624,7 +8722,7 @@ md_assemble (char *str)
if (last_label_seen != NULL)
{
symbol_set_frag (last_label_seen, frag_now);
- S_SET_VALUE (last_label_seen, (valueT) frag_now_fix ());
+ S_SET_VALUE (last_label_seen, frag_now_fix ());
S_SET_SEGMENT (last_label_seen, now_seg);
}
@@ -9041,12 +9139,15 @@ aarch64_handle_align (fragS * fragP)
#endif
memset (p, 0, fix);
p += fix;
+ bytes -= fix;
fragP->fr_fix += fix;
}
- if (noop_size)
- memcpy (p, aarch64_noop, noop_size);
- fragP->fr_var = noop_size;
+ if (bytes != 0)
+ {
+ fragP->fr_var = noop_size;
+ memcpy (p, aarch64_noop, noop_size);
+ }
}
/* Perform target specific initialisation of a frag.
@@ -9121,7 +9222,7 @@ aarch64_sframe_cfa_ra_offset (void)
return (offsetT) SFRAME_CFA_FIXED_RA_INVALID;
}
-/* Get the abi/arch indentifier for SFrame. */
+/* Get the abi/arch identifier for SFrame. */
unsigned char
aarch64_sframe_get_abi_arch (void)
@@ -9306,6 +9407,10 @@ try_to_encode_as_unscaled_ldst (aarch64_inst *instr)
if (new_op == OP_NIL)
return false;
+ if ((instr->opcode->op == OP_PRFM_POS)
+ && (instr->operands[0].prfop->value == 0x18))
+ return false;
+
new_opcode = aarch64_get_opcode (new_op);
gas_assert (new_opcode != NULL);
@@ -9670,6 +9775,20 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg)
}
break;
+ case BFD_RELOC_AARCH64_BRANCH9:
+ if (fixP->fx_done || !seg->use_rela_p)
+ {
+ if (value & 3)
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("conditional branch target not word aligned"));
+ if (signed_overflow (value, 11))
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("conditional branch out of range"));
+ insn = get_aarch64_insn (buf);
+ insn |= encode_cond_branch_ofs_9 (value >> 2);
+ put_aarch64_insn (buf, insn);
+ }
+ break;
case BFD_RELOC_AARCH64_BRANCH19:
if (fixP->fx_done || !seg->use_rela_p)
{
@@ -10068,7 +10187,7 @@ cons_fix_new_aarch64 (fragS * frag, int where, int size, expressionS * exp)
}
#endif
- fix_new_exp (frag, where, (int) size, exp, pcrel, type);
+ fix_new_exp (frag, where, size, exp, pcrel, type);
}
/* Implement md_after_parse_args. This is the earliest time we need to decide
@@ -10214,20 +10333,20 @@ aarch64_adjust_symtab (void)
{
#ifdef OBJ_ELF
/* Remove any overlapping mapping symbols generated by alignment frags. */
- bfd_map_over_sections (stdoutput, check_mapping_symbols, (char *) 0);
+ bfd_map_over_sections (stdoutput, check_mapping_symbols, NULL);
/* Now do generic ELF adjustments. */
elf_adjust_symtab ();
#endif
}
static void
-checked_hash_insert (htab_t table, const char *key, void *value)
+checked_hash_insert (htab_t table, const char *key, const void *value)
{
str_hash_insert (table, key, value, 0);
}
static void
-sysreg_hash_insert (htab_t table, const char *key, void *value)
+sysreg_hash_insert (htab_t table, const char *key, const void *value)
{
gas_assert (strlen (key) < AARCH64_MAX_SYSREG_NAME_LEN);
checked_hash_insert (table, key, value);
@@ -10248,7 +10367,7 @@ fill_instruction_hash_table (void)
new_templ->next = NULL;
if (!templ)
- checked_hash_insert (aarch64_ops_hsh, opcode->name, (void *) new_templ);
+ checked_hash_insert (aarch64_ops_hsh, opcode->name, new_templ);
else
{
new_templ->next = templ->next;
@@ -10307,54 +10426,54 @@ md_begin (void)
for (i = 0; aarch64_sys_regs[i].name != NULL; ++i)
sysreg_hash_insert (aarch64_sys_regs_hsh, aarch64_sys_regs[i].name,
- (void *) (aarch64_sys_regs + i));
+ aarch64_sys_regs + i);
for (i = 0; aarch64_pstatefields[i].name != NULL; ++i)
sysreg_hash_insert (aarch64_pstatefield_hsh,
- aarch64_pstatefields[i].name,
- (void *) (aarch64_pstatefields + i));
+ aarch64_pstatefields[i].name,
+ aarch64_pstatefields + i);
for (i = 0; aarch64_sys_regs_ic[i].name != NULL; i++)
sysreg_hash_insert (aarch64_sys_regs_ic_hsh,
- aarch64_sys_regs_ic[i].name,
- (void *) (aarch64_sys_regs_ic + i));
+ aarch64_sys_regs_ic[i].name,
+ aarch64_sys_regs_ic + i);
for (i = 0; aarch64_sys_regs_dc[i].name != NULL; i++)
sysreg_hash_insert (aarch64_sys_regs_dc_hsh,
- aarch64_sys_regs_dc[i].name,
- (void *) (aarch64_sys_regs_dc + i));
+ aarch64_sys_regs_dc[i].name,
+ aarch64_sys_regs_dc + i);
for (i = 0; aarch64_sys_regs_at[i].name != NULL; i++)
sysreg_hash_insert (aarch64_sys_regs_at_hsh,
- aarch64_sys_regs_at[i].name,
- (void *) (aarch64_sys_regs_at + i));
+ aarch64_sys_regs_at[i].name,
+ aarch64_sys_regs_at + i);
for (i = 0; aarch64_sys_regs_tlbi[i].name != NULL; i++)
sysreg_hash_insert (aarch64_sys_regs_tlbi_hsh,
- aarch64_sys_regs_tlbi[i].name,
- (void *) (aarch64_sys_regs_tlbi + i));
+ aarch64_sys_regs_tlbi[i].name,
+ aarch64_sys_regs_tlbi + i);
for (i = 0; aarch64_sys_regs_sr[i].name != NULL; i++)
sysreg_hash_insert (aarch64_sys_regs_sr_hsh,
- aarch64_sys_regs_sr[i].name,
- (void *) (aarch64_sys_regs_sr + i));
+ aarch64_sys_regs_sr[i].name,
+ aarch64_sys_regs_sr + i);
for (i = 0; i < ARRAY_SIZE (reg_names); i++)
checked_hash_insert (aarch64_reg_hsh, reg_names[i].name,
- (void *) (reg_names + i));
+ reg_names + i);
for (i = 0; i < ARRAY_SIZE (nzcv_names); i++)
checked_hash_insert (aarch64_nzcv_hsh, nzcv_names[i].template,
- (void *) (nzcv_names + i));
+ nzcv_names + i);
for (i = 0; aarch64_operand_modifiers[i].name != NULL; i++)
{
const char *name = aarch64_operand_modifiers[i].name;
checked_hash_insert (aarch64_shift_hsh, name,
- (void *) (aarch64_operand_modifiers + i));
+ aarch64_operand_modifiers + i);
/* Also hash the name in the upper case. */
checked_hash_insert (aarch64_shift_hsh, get_upper_str (name),
- (void *) (aarch64_operand_modifiers + i));
+ aarch64_operand_modifiers + i);
}
for (i = 0; i < ARRAY_SIZE (aarch64_conds); i++)
@@ -10368,10 +10487,10 @@ md_begin (void)
if (name == NULL)
break;
checked_hash_insert (aarch64_cond_hsh, name,
- (void *) (aarch64_conds + i));
+ aarch64_conds + i);
/* Also hash the name in the upper case. */
checked_hash_insert (aarch64_cond_hsh, get_upper_str (name),
- (void *) (aarch64_conds + i));
+ aarch64_conds + i);
}
}
@@ -10382,20 +10501,20 @@ md_begin (void)
if ((i & 0x3) == 0)
continue;
checked_hash_insert (aarch64_barrier_opt_hsh, name,
- (void *) (aarch64_barrier_options + i));
+ aarch64_barrier_options + i);
/* Also hash the name in the upper case. */
checked_hash_insert (aarch64_barrier_opt_hsh, get_upper_str (name),
- (void *) (aarch64_barrier_options + i));
+ aarch64_barrier_options + i);
}
for (i = 0; i < ARRAY_SIZE (aarch64_barrier_dsb_nxs_options); i++)
{
const char *name = aarch64_barrier_dsb_nxs_options[i].name;
checked_hash_insert (aarch64_barrier_opt_hsh, name,
- (void *) (aarch64_barrier_dsb_nxs_options + i));
+ aarch64_barrier_dsb_nxs_options + i);
/* Also hash the name in the upper case. */
checked_hash_insert (aarch64_barrier_opt_hsh, get_upper_str (name),
- (void *) (aarch64_barrier_dsb_nxs_options + i));
+ aarch64_barrier_dsb_nxs_options + i);
}
for (i = 0; i < ARRAY_SIZE (aarch64_prfops); i++)
@@ -10405,10 +10524,10 @@ md_begin (void)
if (name == NULL)
continue;
checked_hash_insert (aarch64_pldop_hsh, name,
- (void *) (aarch64_prfops + i));
+ aarch64_prfops + i);
/* Also hash the name in the upper case. */
checked_hash_insert (aarch64_pldop_hsh, get_upper_str (name),
- (void *) (aarch64_prfops + i));
+ aarch64_prfops + i);
}
for (i = 0; aarch64_hint_options[i].name != NULL; i++)
@@ -10417,12 +10536,12 @@ md_begin (void)
const char* upper_name = get_upper_str(name);
checked_hash_insert (aarch64_hint_opt_hsh, name,
- (void *) (aarch64_hint_options + i));
+ aarch64_hint_options + i);
/* Also hash the name in the upper case if not the same. */
if (strcmp (name, upper_name) != 0)
checked_hash_insert (aarch64_hint_opt_hsh, upper_name,
- (void *) (aarch64_hint_options + i));
+ aarch64_hint_options + i);
}
/* Set the cpu variant based on the command-line options. */
@@ -10498,6 +10617,9 @@ static struct aarch64_option_table aarch64_opts[] = {
NULL},
{"mno-verbose-error", N_("do not output verbose error messages"),
&verbose_error_p, 0, NULL},
+ {"menable-sysreg-checking",
+ N_("enable feature flag gating for system registers"),
+ &sysreg_checking_p, 1, NULL},
{NULL, NULL, NULL, 0, NULL}
};
@@ -10620,6 +10742,7 @@ static const struct aarch64_arch_option_table aarch64_archs[] = {
{"armv9.3-a", AARCH64_ARCH_FEATURES (V9_3A)},
{"armv9.4-a", AARCH64_ARCH_FEATURES (V9_4A)},
{"armv9.5-a", AARCH64_ARCH_FEATURES (V9_5A)},
+ {"armv9.6-a", AARCH64_ARCH_FEATURES (V9_6A)},
{NULL, AARCH64_NO_FEATURES}
};
@@ -10641,7 +10764,9 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = {
AARCH64_FEATURE (SIMD)},
{"fp", AARCH64_FEATURE (FP), AARCH64_NO_FEATURES},
{"lse", AARCH64_FEATURE (LSE), AARCH64_NO_FEATURES},
+ {"lsfe", AARCH64_FEATURE (LSFE), AARCH64_FEATURE (FP)},
{"lse128", AARCH64_FEATURE (LSE128), AARCH64_FEATURE (LSE)},
+ {"lsui", AARCH64_FEATURE (LSUI), AARCH64_NO_FEATURES},
{"simd", AARCH64_FEATURE (SIMD), AARCH64_FEATURE (FP)},
{"pan", AARCH64_FEATURE (PAN), AARCH64_NO_FEATURES},
{"lor", AARCH64_FEATURE (LOR), AARCH64_NO_FEATURES},
@@ -10650,6 +10775,7 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = {
{"rdm", AARCH64_FEATURE (RDMA), AARCH64_FEATURE (SIMD)},
{"fp16", AARCH64_FEATURE (F16), AARCH64_FEATURE (FP)},
{"fp16fml", AARCH64_FEATURE (F16_FML), AARCH64_FEATURE (F16)},
+ {"fprcvt", AARCH64_FEATURE (FPRCVT), AARCH64_FEATURE (FP)},
{"profile", AARCH64_FEATURE (PROFILE), AARCH64_NO_FEATURES},
{"sve", AARCH64_FEATURE (SVE), AARCH64_FEATURE (COMPNUM)},
{"tme", AARCH64_FEATURE (TME), AARCH64_NO_FEATURES},
@@ -10672,11 +10798,13 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = {
{"rng", AARCH64_FEATURE (RNG), AARCH64_NO_FEATURES},
{"ssbs", AARCH64_FEATURE (SSBS), AARCH64_NO_FEATURES},
{"memtag", AARCH64_FEATURE (MEMTAG), AARCH64_NO_FEATURES},
+ {"occmo", AARCH64_FEATURE (OCCMO), AARCH64_NO_FEATURES},
+ {"cmpbr", AARCH64_FEATURE (CMPBR), AARCH64_NO_FEATURES},
{"sve2", AARCH64_FEATURE (SVE2), AARCH64_FEATURE (SVE)},
{"sve2-sm4", AARCH64_FEATURE (SVE2_SM4),
AARCH64_FEATURES (2, SVE2, SM4)},
{"sve2-aes", AARCH64_FEATURE (SVE2_AES),
- AARCH64_FEATURES (2, SVE2, AES)},
+ AARCH64_FEATURES (2, SVE2, SVE_AES)},
{"sve2-sha3", AARCH64_FEATURE (SVE2_SHA3),
AARCH64_FEATURES (2, SVE2, SHA3)},
{"sve2-bitperm", AARCH64_FEATURE (SVE2_BITPERM),
@@ -10708,8 +10836,15 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = {
{"ite", AARCH64_FEATURE (ITE), AARCH64_NO_FEATURES},
{"d128", AARCH64_FEATURE (D128), D128_FEATURE_DEPS},
{"sve-b16b16", AARCH64_FEATURE (SVE_B16B16), AARCH64_NO_FEATURES},
+ {"sve-bfscale", AARCH64_FEATURE (SVE_BFSCALE), AARCH64_NO_FEATURES},
{"sme2p1", AARCH64_FEATURE (SME2p1), AARCH64_FEATURE (SME2)},
{"sve2p1", AARCH64_FEATURE (SVE2p1), AARCH64_FEATURE (SVE2)},
+ {"sve-f16f32mm", AARCH64_FEATURE (SVE_F16F32MM), AARCH64_FEATURE (SVE)},
+ {"f8f32mm", AARCH64_FEATURE (F8F32MM), AARCH64_FEATURES (2, SIMD, FP8)},
+ {"f8f16mm", AARCH64_FEATURE (F8F16MM), AARCH64_FEATURES (2, SIMD, FP8)},
+ {"sve-aes", AARCH64_FEATURE (SVE_AES), AARCH64_FEATURE (AES)},
+ {"sve-aes2", AARCH64_FEATURE (SVE_AES2), AARCH64_NO_FEATURES},
+ {"ssve-aes", AARCH64_FEATURE (SSVE_AES), AARCH64_FEATURES (2, SME2, SVE_AES)},
{"rcpc3", AARCH64_FEATURE (RCPC3), AARCH64_FEATURE (RCPC2)},
{"cpa", AARCH64_FEATURE (CPA), AARCH64_NO_FEATURES},
{"faminmax", AARCH64_FEATURE (FAMINMAX), AARCH64_FEATURE (SIMD)},
@@ -10733,6 +10868,9 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = {
{"sme-f16f16", AARCH64_FEATURE (SME_F16F16), AARCH64_FEATURE (SME2)},
{"sme-b16b16", AARCH64_FEATURE (SME_B16B16),
AARCH64_FEATURES (2, SVE_B16B16, SME2)},
+ {"pops", AARCH64_FEATURE (PoPS), AARCH64_NO_FEATURES},
+ {"sve2p2", AARCH64_FEATURE (SVE2p2), AARCH64_FEATURE (SVE2p1)},
+ {"sme2p2", AARCH64_FEATURE (SME2p2), AARCH64_FEATURE (SME2p1)},
{NULL, AARCH64_NO_FEATURES, AARCH64_NO_FEATURES},
};
@@ -10745,6 +10883,8 @@ struct aarch64_virtual_dependency_table
};
static const struct aarch64_virtual_dependency_table aarch64_dependencies[] = {
+ {AARCH64_FEATURE (SVE2), AARCH64_FEATURE (SVE2_SSVE_AES)},
+ {AARCH64_FEATURE (SSVE_AES), AARCH64_FEATURE (SVE2_SSVE_AES)},
{AARCH64_FEATURES (2, FP8FMA, SVE2), AARCH64_FEATURE (FP8FMA_SVE)},
{AARCH64_FEATURE (SSVE_FP8FMA), AARCH64_FEATURE (FP8FMA_SVE)},
{AARCH64_FEATURES (2, FP8DOT4, SVE2), AARCH64_FEATURE (FP8DOT4_SVE)},
@@ -10753,11 +10893,15 @@ static const struct aarch64_virtual_dependency_table aarch64_dependencies[] = {
{AARCH64_FEATURE (SSVE_FP8DOT2), AARCH64_FEATURE (FP8DOT2_SVE)},
{AARCH64_FEATURE (SME_F16F16), AARCH64_FEATURE (SME_F16F16_F8F16)},
{AARCH64_FEATURE (SME_F8F16), AARCH64_FEATURE (SME_F16F16_F8F16)},
+ {AARCH64_FEATURE (SVE), AARCH64_FEATURE (SVE_SME2p2)},
+ {AARCH64_FEATURE (SME), AARCH64_FEATURE (SVE2p1_SME)},
+ {AARCH64_FEATURE (SVE2), AARCH64_FEATURE (SVE2_SME2)},
+ {AARCH64_FEATURE (SME2), AARCH64_FEATURES (2, SVE2_SME2, SVE2p1_SME2)},
{AARCH64_FEATURE (SVE2p1), AARCH64_FEATURES (3, SVE2p1_SME, SVE2p1_SME2,
SVE2p1_SME2p1)},
- {AARCH64_FEATURE (SME), AARCH64_FEATURE (SVE2p1_SME)},
- {AARCH64_FEATURE (SME2), AARCH64_FEATURE (SVE2p1_SME2)},
{AARCH64_FEATURE (SME2p1), AARCH64_FEATURE (SVE2p1_SME2p1)},
+ {AARCH64_FEATURE (SVE2p2), AARCH64_FEATURE (SVE2p2_SME2p2)},
+ {AARCH64_FEATURE (SME2p2), AARCH64_FEATURES (2, SVE_SME2p2, SVE2p2_SME2p2)},
};
static aarch64_feature_set
@@ -10987,7 +11131,7 @@ aarch64_parse_arch (const char *str)
return aarch64_parse_features (ext, &march_cpu_opt, false);
}
- as_bad (_("unknown architecture `%s'\n"), str);
+ as_bad (_("unknown architecture `%s'"), str);
return 0;
}
@@ -11025,7 +11169,7 @@ aarch64_parse_abi (const char *str)
return 1;
}
- as_bad (_("unknown abi `%s'\n"), str);
+ as_bad (_("unknown abi `%s'"), str);
return 0;
}
@@ -11224,7 +11368,7 @@ s_aarch64_arch (int ignored ATTRIBUTE_UNUSED)
return;
}
- as_bad (_("unknown architecture `%s'\n"), name);
+ as_bad (_("unknown architecture `%s'"), name);
*input_line_pointer = saved_char;
ignore_rest_of_line ();
}
@@ -11257,34 +11401,3 @@ aarch64_copy_symbol_attributes (symbolS * dest, symbolS * src)
{
AARCH64_GET_FLAG (dest) = AARCH64_GET_FLAG (src);
}
-
-#ifdef OBJ_ELF
-/* Same as elf_copy_symbol_attributes, but without copying st_other.
- This is needed so AArch64 specific st_other values can be independently
- specified for an IFUNC resolver (that is called by the dynamic linker)
- and the symbol it resolves (aliased to the resolver). In particular,
- if a function symbol has special st_other value set via directives,
- then attaching an IFUNC resolver to that symbol should not override
- the st_other setting. Requiring the directive on the IFUNC resolver
- symbol would be unexpected and problematic in C code, where the two
- symbols appear as two independent function declarations. */
-
-void
-aarch64_elf_copy_symbol_attributes (symbolS *dest, symbolS *src)
-{
- struct elf_obj_sy *srcelf = symbol_get_obj (src);
- struct elf_obj_sy *destelf = symbol_get_obj (dest);
- /* If size is unset, copy size from src. Because we don't track whether
- .size has been used, we can't differentiate .size dest, 0 from the case
- where dest's size is unset. */
- if (!destelf->size && S_GET_SIZE (dest) == 0)
- {
- if (srcelf->size)
- {
- destelf->size = XNEW (expressionS);
- *destelf->size = *srcelf->size;
- }
- S_SET_SIZE (dest, S_GET_SIZE (src));
- }
-}
-#endif
diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h
index acf1ce4..fce34ed 100644
--- a/gas/config/tc-aarch64.h
+++ b/gas/config/tc-aarch64.h
@@ -90,13 +90,21 @@ enum pointer_auth_key {
/* The extra fields required by AArch64 in fde_entry and cie_entry. Currently
only used to store the key used to sign the frame's return address. */
-#define tc_fde_entry_extras enum pointer_auth_key pauth_key;
-#define tc_cie_entry_extras enum pointer_auth_key pauth_key;
+#define tc_fde_entry_extras enum pointer_auth_key pauth_key; \
+ bool memtag_frame_p;
+#define tc_cie_entry_extras enum pointer_auth_key pauth_key; \
+ bool memtag_frame_p;
/* The extra initialisation steps needed by AArch64 in alloc_fde_entry.
Currently only used to initialise the key used to sign the return
address. */
-#define tc_fde_entry_init_extra(fde) fde->pauth_key = AARCH64_PAUTH_KEY_A;
+#define tc_fde_entry_init_extra(fde) \
+ do \
+ { \
+ fde->pauth_key = AARCH64_PAUTH_KEY_A; \
+ fde->memtag_frame_p = false; \
+ } \
+ while (0)
/* Extra checks required by AArch64 when outputting the current cie_entry.
Currently only used to output a 'B' if the return address is signed with the
@@ -106,18 +114,29 @@ enum pointer_auth_key {
{ \
if (cie->pauth_key == AARCH64_PAUTH_KEY_B) \
out_one ('B'); \
+ if (cie->memtag_frame_p) \
+ out_one ('G'); \
} \
while (0)
/* Extra equivalence checks required by AArch64 when selecting the correct cie
- for some fde. Currently only used to check for quivalence between keys used
- to sign ther return address. */
-#define tc_cie_fde_equivalent_extra(cie, fde) (cie->pauth_key == fde->pauth_key)
+ for some fde. Currently used to check for equivalence between - keys used
+ to sign the return address, and if stack locations have MTE tagging
+ enabled. */
+#define tc_cie_fde_equivalent_extra(cie, fde) \
+ ((cie->pauth_key == fde->pauth_key) \
+ && (cie->memtag_frame_p == fde->memtag_frame_p))
/* The extra initialisation steps needed by AArch64 in select_cie_for_fde.
Currently only used to initialise the key used to sign the return
address. */
-#define tc_cie_entry_init_extra(cie, fde) cie->pauth_key = fde->pauth_key;
+#define tc_cie_entry_init_extra(cie, fde) \
+ do \
+ { \
+ cie->pauth_key = fde->pauth_key; \
+ cie->memtag_frame_p = fde->memtag_frame_p; \
+ } \
+ while (0)
#define TC_FIX_TYPE struct aarch64_fix
#define TC_INIT_FIX_DATA(FIX) { (FIX)->tc_fix_data.inst = NULL; \
@@ -133,9 +152,17 @@ void aarch64_copy_symbol_attributes (symbolS *, symbolS *);
#endif
#ifdef OBJ_ELF
-void aarch64_elf_copy_symbol_attributes (symbolS *, symbolS *);
+/* Don't copy st_other.
+ This is needed so AArch64 specific st_other values can be independently
+ specified for an IFUNC resolver (that is called by the dynamic linker)
+ and the symbol it resolves (aliased to the resolver). In particular,
+ if a function symbol has special st_other value set via directives,
+ then attaching an IFUNC resolver to that symbol should not override
+ the st_other setting. Requiring the directive on the IFUNC resolver
+ symbol would be unexpected and problematic in C code, where the two
+ symbols appear as two independent function declarations. */
#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST, SRC) \
- aarch64_elf_copy_symbol_attributes (DEST, SRC)
+ elf_copy_symbol_size (DEST, SRC)
#endif
#define TC_START_LABEL(STR, NUL_CHAR, NEXT_CHAR) \
@@ -162,10 +189,6 @@ void aarch64_elf_copy_symbol_attributes (symbolS *, symbolS *);
#define TC_CONS_FIX_NEW(f,w,s,e,r) cons_fix_new_aarch64 ((f), (w), (s), (e))
-/* Max space for a rs_align_code fragment is 3 unaligned bytes
- (fr_fix) plus 4 bytes to contain the repeating NOP (fr_var). */
-#define MAX_MEM_FOR_RS_ALIGN_CODE 7
-
/* For frags in code sections we need to record whether they contain
code or data. */
struct aarch64_frag_type
@@ -183,6 +206,9 @@ struct aarch64_frag_type
#define TC_FRAG_TYPE struct aarch64_frag_type
#define TC_FRAG_INIT(fragp, max_bytes) aarch64_init_frag (fragp, max_bytes)
#define HANDLE_ALIGN(sec, fragp) aarch64_handle_align (fragp)
+/* Max space for a rs_align_code fragment is 3 unaligned bytes
+ (fr_fix) plus 4 bytes to contain the repeating NOP (fr_var). */
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 4)
#define md_do_align(N, FILL, LEN, MAX, LABEL) \
if (FILL == NULL && (N) != 0 && ! need_pass_2 && subseg_text_p (now_seg)) \
@@ -309,7 +335,7 @@ extern bool aarch64_sframe_ra_tracking_p (void);
extern offsetT aarch64_sframe_cfa_ra_offset (void);
#define sframe_cfa_ra_offset aarch64_sframe_cfa_ra_offset
-/* The abi/arch indentifier for SFrame. */
+/* The abi/arch identifier for SFrame. */
unsigned char aarch64_sframe_get_abi_arch (void);
#define sframe_get_abi_arch aarch64_sframe_get_abi_arch
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index a90ceb4..9558425 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -99,7 +99,7 @@ struct alpha_insn
long sequence;
};
-enum alpha_macro_arg
+typedef enum
{
MACRO_EOA = 1,
MACRO_IR,
@@ -108,14 +108,20 @@ enum alpha_macro_arg
MACRO_CPIR,
MACRO_FPR,
MACRO_EXP
- };
+ } alpha_macro_argset;
+
+typedef union
+{
+ const void *p;
+ uintptr_t i;
+} alpha_macro_arg;
struct alpha_macro
{
const char *name;
- void (*emit) (const expressionS *, int, const void *);
- const void * arg;
- enum alpha_macro_arg argsets[16];
+ void (*emit) (const expressionS *, int, alpha_macro_arg);
+ alpha_macro_arg arg;
+ alpha_macro_argset argsets[16];
};
/* Extra expression types. */
@@ -170,33 +176,13 @@ struct alpha_macro
#define note_fpreg(R) (alpha_fprmask |= (1 << (R)))
/* Predicates for 16- and 32-bit ranges */
-/* XXX: The non-shift version appears to trigger a compiler bug when
- cross-assembling from x86 w/ gcc 2.7.2. */
-
-#if 1
-#define range_signed_16(x) \
- (((offsetT) (x) >> 15) == 0 || ((offsetT) (x) >> 15) == -1)
-#define range_signed_32(x) \
- (((offsetT) (x) >> 31) == 0 || ((offsetT) (x) >> 31) == -1)
-#else
-#define range_signed_16(x) ((offsetT) (x) >= -(offsetT) 0x8000 && \
- (offsetT) (x) <= (offsetT) 0x7FFF)
-#define range_signed_32(x) ((offsetT) (x) >= -(offsetT) 0x80000000 && \
- (offsetT) (x) <= (offsetT) 0x7FFFFFFF)
-#endif
+#define range_signed_16(x) ((valueT) (x) + 0x8000 <= 0xFFFF)
+#define range_signed_32(x) ((valueT) (x) + 0x80000000 <= 0xFFFFFFFF)
/* Macros for sign extending from 16- and 32-bits. */
-/* XXX: The cast macros will work on all the systems that I care about,
- but really a predicate should be found to use the non-cast forms. */
-
-#if 1
-#define sign_extend_16(x) ((short) (x))
-#define sign_extend_32(x) ((int) (x))
-#else
-#define sign_extend_16(x) ((offsetT) (((x) & 0xFFFF) ^ 0x8000) - 0x8000)
-#define sign_extend_32(x) ((offsetT) (((x) & 0xFFFFFFFF) \
- ^ 0x80000000) - 0x80000000)
-#endif
+#define sign_extend_16(x) ((((valueT) (x) & 0xFFFF) ^ 0x8000) - 0x8000)
+#define sign_extend_32(x) ((((valueT) (x) & 0xFFFFFFFF) ^ 0x80000000) \
+ - 0x80000000)
/* Macros to build tokens. */
@@ -442,7 +428,7 @@ static int alpha_flag_show_after_trunc = 0; /* -H */
#define ALPHA_RELOC_TABLE(op) \
(&alpha_reloc_op[ ((!USER_RELOC_P (op)) \
? (abort (), 0) \
- : (int) (op) - (int) O_literal) ])
+ : (op) - O_literal) ])
#define DEF(NAME, RELOC, REQ, ALLOW) \
{ #NAME, sizeof(#NAME)-1, O_##NAME, RELOC, REQ, ALLOW}
@@ -589,7 +575,7 @@ get_alpha_reloc_tag (long sequence)
sprintf (buffer, "!%ld", sequence);
- info = (struct alpha_reloc_tag *) str_hash_find (alpha_literal_hash, buffer);
+ info = str_hash_find (alpha_literal_hash, buffer);
if (! info)
{
size_t len = strlen (buffer);
@@ -638,7 +624,7 @@ alpha_adjust_relocs (bfd *abfd ATTRIBUTE_UNUSED,
for (fixp = seginfo->fix_root; fixp; fixp = next)
{
next = fixp->fx_next;
- fixp->fx_next = (fixS *) 0;
+ fixp->fx_next = NULL;
switch (fixp->fx_r_type)
{
@@ -736,7 +722,7 @@ alpha_adjust_relocs (bfd *abfd ATTRIBUTE_UNUSED,
&& ! fixp->tc_fix_data.info->multi_section_p)
{
for (slave = fixp->tc_fix_data.info->slaves;
- slave != (fixS *) 0;
+ slave != NULL;
slave = slave->tc_fix_data.next_reloc)
{
slave->fx_next = fixp->fx_next;
@@ -1170,8 +1156,7 @@ assemble_tokens_to_insn (const char *opname,
const struct alpha_opcode *opcode;
/* Search opcodes. */
- opcode = (const struct alpha_opcode *) str_hash_find (alpha_opcode_hash,
- opname);
+ opcode = str_hash_find (alpha_opcode_hash, opname);
if (opcode)
{
int cpumatch;
@@ -1662,7 +1647,7 @@ load_expression (int targreg,
static void
emit_lda (const expressionS *tok,
int ntok,
- const void * unused ATTRIBUTE_UNUSED)
+ alpha_macro_arg unused ATTRIBUTE_UNUSED)
{
int basereg;
@@ -1680,7 +1665,7 @@ emit_lda (const expressionS *tok,
static void
emit_ldah (const expressionS *tok,
int ntok ATTRIBUTE_UNUSED,
- const void * unused ATTRIBUTE_UNUSED)
+ alpha_macro_arg unused ATTRIBUTE_UNUSED)
{
expressionS newtok[3];
@@ -1720,7 +1705,7 @@ alpha_align (int n,
if (label != NULL && S_GET_SEGMENT (label) == now_seg)
{
symbol_set_frag (label, frag_now);
- S_SET_VALUE (label, (valueT) frag_now_fix ());
+ S_SET_VALUE (label, frag_now_fix ());
}
record_alignment (now_seg, n);
@@ -1739,7 +1724,7 @@ emit_insn (struct alpha_insn *insn)
/* Take care of alignment duties. */
if (alpha_auto_align_on && alpha_current_align < 2)
- alpha_align (2, (char *) NULL, alpha_insn_label, 0);
+ alpha_align (2, NULL, alpha_insn_label, 0);
if (alpha_current_align > 2)
alpha_current_align = 2;
alpha_insn_label = NULL;
@@ -1755,7 +1740,7 @@ emit_insn (struct alpha_insn *insn)
/* Apply the fixups in order. */
for (i = 0; i < insn->nfixups; ++i)
{
- const struct alpha_operand *operand = (const struct alpha_operand *) 0;
+ const struct alpha_operand *operand = NULL;
struct alpha_fixup *fixup = &insn->fixups[i];
struct alpha_reloc_tag *info = NULL;
int size, pcrel;
@@ -1778,8 +1763,7 @@ emit_insn (struct alpha_insn *insn)
else
{
reloc_howto_type *reloc_howto =
- bfd_reloc_type_lookup (stdoutput,
- (bfd_reloc_code_real_type) fixup->reloc);
+ bfd_reloc_type_lookup (stdoutput, fixup->reloc);
gas_assert (reloc_howto);
size = bfd_get_reloc_size (reloc_howto);
@@ -1801,7 +1785,7 @@ emit_insn (struct alpha_insn *insn)
}
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, size,
- &fixup->exp, pcrel, (bfd_reloc_code_real_type) fixup->reloc);
+ &fixup->exp, pcrel, fixup->reloc);
/* Turn off complaints that the addend is too large for some fixups,
and copy in the sequence number for the explicit relocations. */
@@ -2030,7 +2014,7 @@ assemble_insn (const struct alpha_opcode *opcode,
for (argidx = opcode->operands; *argidx; ++argidx)
{
const struct alpha_operand *operand = &alpha_operands[*argidx];
- const expressionS *t = (const expressionS *) 0;
+ const expressionS *t = NULL;
if (operand->flags & AXP_OPERAND_FAKE)
{
@@ -2139,8 +2123,7 @@ assemble_insn (const struct alpha_opcode *opcode,
else if (reloc < BFD_RELOC_UNUSED && reloc > 0)
{
reloc_howto_type *reloc_howto
- = bfd_reloc_type_lookup (stdoutput,
- (bfd_reloc_code_real_type) reloc);
+ = bfd_reloc_type_lookup (stdoutput, reloc);
if (reloc_operand == NULL
|| reloc_howto->bitsize != reloc_operand->bits)
{
@@ -2167,7 +2150,7 @@ assemble_insn (const struct alpha_opcode *opcode,
static void
emit_ir_load (const expressionS *tok,
int ntok,
- const void * opname)
+ alpha_macro_arg opname)
{
int basereg;
long lituse;
@@ -2183,7 +2166,7 @@ emit_ir_load (const expressionS *tok,
basereg = tok[2].X_add_number;
lituse = load_expression (tok[0].X_add_number, &tok[1],
- &basereg, &newtok[1], (const char *) opname);
+ &basereg, &newtok[1], opname.p);
if (basereg == alpha_gp_register &&
(symlen > 4 && strcmp (&symname [symlen - 4], "..lk") == 0))
@@ -2192,7 +2175,7 @@ emit_ir_load (const expressionS *tok,
newtok[0] = tok[0];
set_tok_preg (newtok[2], basereg);
- assemble_tokens_to_insn ((const char *) opname, newtok, 3, &insn);
+ assemble_tokens_to_insn (opname.p, newtok, 3, &insn);
if (lituse)
{
@@ -2212,7 +2195,7 @@ emit_ir_load (const expressionS *tok,
static void
emit_loadstore (const expressionS *tok,
int ntok,
- const void * opname)
+ alpha_macro_arg opname)
{
int basereg;
long lituse;
@@ -2230,7 +2213,7 @@ emit_loadstore (const expressionS *tok,
as_bad (_("macro requires $at register while noat in effect"));
lituse = load_expression (AXP_REG_AT, &tok[1],
- &basereg, &newtok[1], (const char *) opname);
+ &basereg, &newtok[1], opname.p);
}
else
{
@@ -2241,7 +2224,7 @@ emit_loadstore (const expressionS *tok,
newtok[0] = tok[0];
set_tok_preg (newtok[2], basereg);
- assemble_tokens_to_insn ((const char *) opname, newtok, 3, &insn);
+ assemble_tokens_to_insn (opname.p, newtok, 3, &insn);
if (lituse)
{
@@ -2260,10 +2243,10 @@ emit_loadstore (const expressionS *tok,
static void
emit_ldXu (const expressionS *tok,
int ntok,
- const void * vlgsize)
+ alpha_macro_arg lgsize)
{
if (alpha_target & AXP_OPCODE_BWX)
- emit_ir_load (tok, ntok, ldXu_op[(long) vlgsize]);
+ emit_ir_load (tok, ntok, (alpha_macro_arg) { ldXu_op[lgsize.i] });
else
{
expressionS newtok[3];
@@ -2303,7 +2286,7 @@ emit_ldXu (const expressionS *tok,
/* Emit "extXl targ, $at, targ". */
set_tok_reg (newtok[1], basereg);
newtok[2] = newtok[0];
- assemble_tokens_to_insn (extXl_op[(long) vlgsize], newtok, 3, &insn);
+ assemble_tokens_to_insn (extXl_op[lgsize.i], newtok, 3, &insn);
if (lituse)
{
@@ -2323,10 +2306,10 @@ emit_ldXu (const expressionS *tok,
static void
emit_ldX (const expressionS *tok,
int ntok,
- const void * vlgsize)
+ alpha_macro_arg lgsize)
{
- emit_ldXu (tok, ntok, vlgsize);
- assemble_tokens (sextX_op[(long) vlgsize], tok, 1, 1);
+ emit_ldXu (tok, ntok, lgsize);
+ assemble_tokens (sextX_op[lgsize.i], tok, 1, 1);
}
/* Load an integral value from an unaligned address as an unsigned
@@ -2335,9 +2318,8 @@ emit_ldX (const expressionS *tok,
static void
emit_uldXu (const expressionS *tok,
int ntok,
- const void * vlgsize)
+ alpha_macro_arg lgsize)
{
- long lgsize = (long) vlgsize;
expressionS newtok[3];
if (alpha_noat_on)
@@ -2356,19 +2338,19 @@ emit_uldXu (const expressionS *tok,
/* Emit "ldq_u $t10, size-1($at)". */
set_tok_reg (newtok[0], AXP_REG_T10);
- set_tok_const (newtok[1], (1 << lgsize) - 1);
+ set_tok_const (newtok[1], (1 << lgsize.i) - 1);
assemble_tokens ("ldq_u", newtok, 3, 1);
/* Emit "extXl $t9, $at, $t9". */
set_tok_reg (newtok[0], AXP_REG_T9);
set_tok_reg (newtok[1], AXP_REG_AT);
set_tok_reg (newtok[2], AXP_REG_T9);
- assemble_tokens (extXl_op[lgsize], newtok, 3, 1);
+ assemble_tokens (extXl_op[lgsize.i], newtok, 3, 1);
/* Emit "extXh $t10, $at, $t10". */
set_tok_reg (newtok[0], AXP_REG_T10);
set_tok_reg (newtok[2], AXP_REG_T10);
- assemble_tokens (extXh_op[lgsize], newtok, 3, 1);
+ assemble_tokens (extXh_op[lgsize.i], newtok, 3, 1);
/* Emit "or $t9, $t10, targ". */
set_tok_reg (newtok[0], AXP_REG_T9);
@@ -2384,10 +2366,10 @@ emit_uldXu (const expressionS *tok,
static void
emit_uldX (const expressionS *tok,
int ntok,
- const void * vlgsize)
+ alpha_macro_arg lgsize)
{
- emit_uldXu (tok, ntok, vlgsize);
- assemble_tokens (sextX_op[(long) vlgsize], tok, 1, 1);
+ emit_uldXu (tok, ntok, lgsize);
+ assemble_tokens (sextX_op[lgsize.i], tok, 1, 1);
}
/* Implement the ldil macro. */
@@ -2395,7 +2377,7 @@ emit_uldX (const expressionS *tok,
static void
emit_ldil (const expressionS *tok,
int ntok,
- const void * unused ATTRIBUTE_UNUSED)
+ alpha_macro_arg unused ATTRIBUTE_UNUSED)
{
expressionS newtok[2];
@@ -2410,12 +2392,10 @@ emit_ldil (const expressionS *tok,
static void
emit_stX (const expressionS *tok,
int ntok,
- const void * vlgsize)
+ alpha_macro_arg lgsize)
{
- int lgsize = (int) (long) vlgsize;
-
if (alpha_target & AXP_OPCODE_BWX)
- emit_loadstore (tok, ntok, stX_op[lgsize]);
+ emit_loadstore (tok, ntok, (alpha_macro_arg) { stX_op[lgsize.i] });
else
{
expressionS newtok[3];
@@ -2456,7 +2436,7 @@ emit_stX (const expressionS *tok,
newtok[0] = tok[0];
set_tok_reg (newtok[1], basereg);
set_tok_reg (newtok[2], AXP_REG_T10);
- assemble_tokens_to_insn (insXl_op[lgsize], newtok, 3, &insn);
+ assemble_tokens_to_insn (insXl_op[lgsize.i], newtok, 3, &insn);
if (lituse)
{
@@ -2472,7 +2452,7 @@ emit_stX (const expressionS *tok,
/* Emit "mskXl $t9, $at, $t9". */
set_tok_reg (newtok[0], AXP_REG_T9);
newtok[2] = newtok[0];
- assemble_tokens_to_insn (mskXl_op[lgsize], newtok, 3, &insn);
+ assemble_tokens_to_insn (mskXl_op[lgsize.i], newtok, 3, &insn);
if (lituse)
{
@@ -2512,9 +2492,8 @@ emit_stX (const expressionS *tok,
static void
emit_ustX (const expressionS *tok,
int ntok,
- const void * vlgsize)
+ alpha_macro_arg lgsize)
{
- int lgsize = (int) (long) vlgsize;
expressionS newtok[3];
/* Emit "lda $at, exp". */
@@ -2530,28 +2509,28 @@ emit_ustX (const expressionS *tok,
/* Emit "ldq_u $10, size-1($at)". */
set_tok_reg (newtok[0], AXP_REG_T10);
- set_tok_const (newtok[1], (1 << lgsize) - 1);
+ set_tok_const (newtok[1], (1 << lgsize.i) - 1);
assemble_tokens ("ldq_u", newtok, 3, 1);
/* Emit "insXl src, $at, $t11". */
newtok[0] = tok[0];
set_tok_reg (newtok[1], AXP_REG_AT);
set_tok_reg (newtok[2], AXP_REG_T11);
- assemble_tokens (insXl_op[lgsize], newtok, 3, 1);
+ assemble_tokens (insXl_op[lgsize.i], newtok, 3, 1);
/* Emit "insXh src, $at, $t12". */
set_tok_reg (newtok[2], AXP_REG_T12);
- assemble_tokens (insXh_op[lgsize], newtok, 3, 1);
+ assemble_tokens (insXh_op[lgsize.i], newtok, 3, 1);
/* Emit "mskXl $t9, $at, $t9". */
set_tok_reg (newtok[0], AXP_REG_T9);
newtok[2] = newtok[0];
- assemble_tokens (mskXl_op[lgsize], newtok, 3, 1);
+ assemble_tokens (mskXl_op[lgsize.i], newtok, 3, 1);
/* Emit "mskXh $t10, $at, $t10". */
set_tok_reg (newtok[0], AXP_REG_T10);
newtok[2] = newtok[0];
- assemble_tokens (mskXh_op[lgsize], newtok, 3, 1);
+ assemble_tokens (mskXh_op[lgsize.i], newtok, 3, 1);
/* Emit "or $t9, $t11, $t9". */
set_tok_reg (newtok[0], AXP_REG_T9);
@@ -2567,7 +2546,7 @@ emit_ustX (const expressionS *tok,
/* Emit "stq_u $t10, size-1($at)". */
set_tok_reg (newtok[0], AXP_REG_T10);
- set_tok_const (newtok[1], (1 << lgsize) - 1);
+ set_tok_const (newtok[1], (1 << lgsize.i) - 1);
set_tok_preg (newtok[2], AXP_REG_AT);
assemble_tokens ("stq_u", newtok, 3, 1);
@@ -2583,15 +2562,13 @@ emit_ustX (const expressionS *tok,
static void
emit_sextX (const expressionS *tok,
int ntok,
- const void * vlgsize)
+ alpha_macro_arg lgsize)
{
- long lgsize = (long) vlgsize;
-
if (alpha_target & AXP_OPCODE_BWX)
- assemble_tokens (sextX_op[lgsize], tok, ntok, 0);
+ assemble_tokens (sextX_op[lgsize.i], tok, ntok, 0);
else
{
- int bitshift = 64 - 8 * (1 << lgsize);
+ int bitshift = 64 - 8 * (1 << lgsize.i);
expressionS newtok[3];
/* Emit "sll src,bits,dst". */
@@ -2616,7 +2593,7 @@ emit_sextX (const expressionS *tok,
static void
emit_division (const expressionS *tok,
int ntok,
- const void * symname)
+ alpha_macro_arg symname)
{
/* DIVISION and MODULUS. Yech.
@@ -2687,7 +2664,7 @@ emit_division (const expressionS *tok,
}
}
- sym = symbol_find_or_make ((const char *) symname);
+ sym = symbol_find_or_make (symname.p);
set_tok_reg (newtok[0], AXP_REG_AT);
set_tok_sym (newtok[1], sym, 0);
@@ -2713,7 +2690,7 @@ emit_division (const expressionS *tok,
static void
emit_division (const expressionS *tok,
int ntok,
- const void * symname)
+ alpha_macro_arg symname)
{
/* DIVISION and MODULUS. Yech.
Convert
@@ -2740,7 +2717,7 @@ emit_division (const expressionS *tok,
else
rr = regno (tok[2].X_add_number);
- sym = symbol_find_or_make ((const char *) symname);
+ sym = symbol_find_or_make (symname.p);
/* Move the operands into the right place. */
if (yr == AXP_REG_T10 && xr == AXP_REG_T11)
@@ -2819,9 +2796,8 @@ FIXME
static void
emit_jsrjmp (const expressionS *tok,
int ntok,
- const void * vopname)
+ alpha_macro_arg opname)
{
- const char *opname = (const char *) vopname;
struct alpha_insn insn;
expressionS newtok[3];
int r, tokidx = 0;
@@ -2830,7 +2806,7 @@ emit_jsrjmp (const expressionS *tok,
if (tokidx < ntok && tok[tokidx].X_op == O_register)
r = regno (tok[tokidx++].X_add_number);
else
- r = strcmp (opname, "jmp") == 0 ? AXP_REG_ZERO : AXP_REG_RA;
+ r = strcmp (opname.p, "jmp") == 0 ? AXP_REG_ZERO : AXP_REG_RA;
set_tok_reg (newtok[0], r);
@@ -2844,7 +2820,7 @@ emit_jsrjmp (const expressionS *tok,
{
int basereg = alpha_gp_register;
lituse = load_expression (r = AXP_REG_PV, &tok[tokidx],
- &basereg, NULL, opname);
+ &basereg, NULL, opname.p);
}
#endif
@@ -2857,7 +2833,7 @@ emit_jsrjmp (const expressionS *tok,
#endif
set_tok_const (newtok[2], 0);
- assemble_tokens_to_insn (opname, newtok, 3, &insn);
+ assemble_tokens_to_insn (opname.p, newtok, 3, &insn);
if (lituse)
{
@@ -2915,9 +2891,8 @@ emit_jsrjmp (const expressionS *tok,
static void
emit_retjcr (const expressionS *tok,
int ntok,
- const void * vopname)
+ alpha_macro_arg opname)
{
- const char *opname = (const char *) vopname;
expressionS newtok[3];
int r, tokidx = 0;
@@ -2939,9 +2914,9 @@ emit_retjcr (const expressionS *tok,
if (tokidx < ntok)
newtok[2] = tok[tokidx];
else
- set_tok_const (newtok[2], strcmp (opname, "ret") == 0);
+ set_tok_const (newtok[2], strcmp (opname.p, "ret") == 0);
- assemble_tokens (opname, newtok, 3, 0);
+ assemble_tokens (opname.p, newtok, 3, 0);
}
/* Implement the ldgp macro. */
@@ -2949,7 +2924,7 @@ emit_retjcr (const expressionS *tok,
static void
emit_ldgp (const expressionS *tok ATTRIBUTE_UNUSED,
int ntok ATTRIBUTE_UNUSED,
- const void * unused ATTRIBUTE_UNUSED)
+ alpha_macro_arg unused ATTRIBUTE_UNUSED)
{
#ifdef OBJ_AOUT
FIXME
@@ -3010,167 +2985,167 @@ FIXME
static const struct alpha_macro alpha_macros[] =
{
/* Load/Store macros. */
- { "lda", emit_lda, NULL,
+ { "lda", emit_lda, { NULL },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldah", emit_ldah, NULL,
+ { "ldah", emit_ldah, { NULL },
{ MACRO_IR, MACRO_EXP, MACRO_EOA } },
- { "ldl", emit_ir_load, "ldl",
+ { "ldl", emit_ir_load, { "ldl" },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldl_l", emit_ir_load, "ldl_l",
+ { "ldl_l", emit_ir_load, { "ldl_l" },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldq", emit_ir_load, "ldq",
+ { "ldq", emit_ir_load, { "ldq" },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldq_l", emit_ir_load, "ldq_l",
+ { "ldq_l", emit_ir_load, { "ldq_l" },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldq_u", emit_ir_load, "ldq_u",
+ { "ldq_u", emit_ir_load, { "ldq_u" },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldf", emit_loadstore, "ldf",
+ { "ldf", emit_loadstore, { "ldf" },
{ MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldg", emit_loadstore, "ldg",
+ { "ldg", emit_loadstore, { "ldg" },
{ MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "lds", emit_loadstore, "lds",
+ { "lds", emit_loadstore, { "lds" },
{ MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldt", emit_loadstore, "ldt",
+ { "ldt", emit_loadstore, { "ldt" },
{ MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldb", emit_ldX, (void *) 0,
+ { "ldb", emit_ldX, { .i = 0 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldbu", emit_ldXu, (void *) 0,
+ { "ldbu", emit_ldXu, { .i = 0 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldw", emit_ldX, (void *) 1,
+ { "ldw", emit_ldX, { .i = 1 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldwu", emit_ldXu, (void *) 1,
+ { "ldwu", emit_ldXu, { .i = 1 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "uldw", emit_uldX, (void *) 1,
+ { "uldw", emit_uldX, { .i = 1 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "uldwu", emit_uldXu, (void *) 1,
+ { "uldwu", emit_uldXu, { .i = 1 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "uldl", emit_uldX, (void *) 2,
+ { "uldl", emit_uldX, { .i = 2 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "uldlu", emit_uldXu, (void *) 2,
+ { "uldlu", emit_uldXu, { .i = 2 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "uldq", emit_uldXu, (void *) 3,
+ { "uldq", emit_uldXu, { .i = 3 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ldgp", emit_ldgp, NULL,
+ { "ldgp", emit_ldgp, { NULL },
{ MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA } },
- { "ldi", emit_lda, NULL,
+ { "ldi", emit_lda, { NULL },
{ MACRO_IR, MACRO_EXP, MACRO_EOA } },
- { "ldil", emit_ldil, NULL,
+ { "ldil", emit_ldil, { NULL },
{ MACRO_IR, MACRO_EXP, MACRO_EOA } },
- { "ldiq", emit_lda, NULL,
+ { "ldiq", emit_lda, { NULL },
{ MACRO_IR, MACRO_EXP, MACRO_EOA } },
- { "stl", emit_loadstore, "stl",
+ { "stl", emit_loadstore, { "stl" },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "stl_c", emit_loadstore, "stl_c",
+ { "stl_c", emit_loadstore, { "stl_c" },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "stq", emit_loadstore, "stq",
+ { "stq", emit_loadstore, { "stq" },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "stq_c", emit_loadstore, "stq_c",
+ { "stq_c", emit_loadstore, { "stq_c" },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "stq_u", emit_loadstore, "stq_u",
+ { "stq_u", emit_loadstore, { "stq_u" },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "stf", emit_loadstore, "stf",
+ { "stf", emit_loadstore, { "stf" },
{ MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "stg", emit_loadstore, "stg",
+ { "stg", emit_loadstore, { "stg" },
{ MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "sts", emit_loadstore, "sts",
+ { "sts", emit_loadstore, { "sts" },
{ MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "stt", emit_loadstore, "stt",
+ { "stt", emit_loadstore, { "stt" },
{ MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "stb", emit_stX, (void *) 0,
+ { "stb", emit_stX, { .i = 0 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "stw", emit_stX, (void *) 1,
+ { "stw", emit_stX, { .i = 1 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ustw", emit_ustX, (void *) 1,
+ { "ustw", emit_ustX, { .i = 1 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ustl", emit_ustX, (void *) 2,
+ { "ustl", emit_ustX, { .i = 2 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
- { "ustq", emit_ustX, (void *) 3,
+ { "ustq", emit_ustX, { .i = 3 },
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } },
/* Arithmetic macros. */
- { "sextb", emit_sextX, (void *) 0,
+ { "sextb", emit_sextX, { .i = 0 },
{ MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EOA,
/* MACRO_EXP, MACRO_IR, MACRO_EOA */ } },
- { "sextw", emit_sextX, (void *) 1,
+ { "sextw", emit_sextX, { .i = 1 },
{ MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EOA,
/* MACRO_EXP, MACRO_IR, MACRO_EOA */ } },
- { "divl", emit_division, "__divl",
+ { "divl", emit_division, { "__divl" },
{ MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_IR, MACRO_EOA,
/* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EXP, MACRO_EOA */ } },
- { "divlu", emit_division, "__divlu",
+ { "divlu", emit_division, { "__divlu" },
{ MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_IR, MACRO_EOA,
/* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EXP, MACRO_EOA */ } },
- { "divq", emit_division, "__divq",
+ { "divq", emit_division, { "__divq" },
{ MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_IR, MACRO_EOA,
/* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EXP, MACRO_EOA */ } },
- { "divqu", emit_division, "__divqu",
+ { "divqu", emit_division, { "__divqu" },
{ MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_IR, MACRO_EOA,
/* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EXP, MACRO_EOA */ } },
- { "reml", emit_division, "__reml",
+ { "reml", emit_division, { "__reml" },
{ MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_IR, MACRO_EOA,
/* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EXP, MACRO_EOA */ } },
- { "remlu", emit_division, "__remlu",
+ { "remlu", emit_division, { "__remlu" },
{ MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_IR, MACRO_EOA,
/* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EXP, MACRO_EOA */ } },
- { "remq", emit_division, "__remq",
+ { "remq", emit_division, { "__remq" },
{ MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_IR, MACRO_EOA,
/* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EXP, MACRO_EOA */ } },
- { "remqu", emit_division, "__remqu",
+ { "remqu", emit_division, { "__remqu" },
{ MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_IR, MACRO_EOA,
/* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EXP, MACRO_EOA */ } },
- { "jsr", emit_jsrjmp, "jsr",
+ { "jsr", emit_jsrjmp, { "jsr" },
{ MACRO_PIR, MACRO_EXP, MACRO_EOA,
MACRO_PIR, MACRO_EOA,
MACRO_IR, MACRO_EXP, MACRO_EOA,
MACRO_EXP, MACRO_EOA } },
- { "jmp", emit_jsrjmp, "jmp",
+ { "jmp", emit_jsrjmp, { "jmp" },
{ MACRO_PIR, MACRO_EXP, MACRO_EOA,
MACRO_PIR, MACRO_EOA,
MACRO_IR, MACRO_EXP, MACRO_EOA,
MACRO_EXP, MACRO_EOA } },
- { "ret", emit_retjcr, "ret",
+ { "ret", emit_retjcr, { "ret" },
{ MACRO_IR, MACRO_EXP, MACRO_EOA,
MACRO_IR, MACRO_EOA,
MACRO_PIR, MACRO_EXP, MACRO_EOA,
MACRO_PIR, MACRO_EOA,
MACRO_EXP, MACRO_EOA,
MACRO_EOA } },
- { "jcr", emit_retjcr, "jcr",
+ { "jcr", emit_retjcr, { "jcr" },
{ MACRO_IR, MACRO_EXP, MACRO_EOA,
MACRO_IR, MACRO_EOA,
MACRO_PIR, MACRO_EXP, MACRO_EOA,
MACRO_PIR, MACRO_EOA,
MACRO_EXP, MACRO_EOA,
MACRO_EOA } },
- { "jsr_coroutine", emit_retjcr, "jcr",
+ { "jsr_coroutine", emit_retjcr, { "jcr" },
{ MACRO_IR, MACRO_EXP, MACRO_EOA,
MACRO_IR, MACRO_EOA,
MACRO_PIR, MACRO_EXP, MACRO_EOA,
@@ -3196,7 +3171,7 @@ find_macro_match (const struct alpha_macro *first_macro,
do
{
- const enum alpha_macro_arg *arg = macro->argsets;
+ const alpha_macro_argset *arg = macro->argsets;
int tokidx = 0;
while (*arg)
@@ -3318,8 +3293,7 @@ assemble_tokens (const char *opname,
#endif
if (local_macros_on)
{
- macro = (const struct alpha_macro *) str_hash_find (alpha_macro_hash,
- opname);
+ macro = str_hash_find (alpha_macro_hash, opname);
if (macro)
{
found_something = 1;
@@ -3333,8 +3307,7 @@ assemble_tokens (const char *opname,
}
/* Search opcodes. */
- opcode = (const struct alpha_opcode *) str_hash_find (alpha_opcode_hash,
- opname);
+ opcode = str_hash_find (alpha_opcode_hash, opname);
if (opcode)
{
found_something = 1;
@@ -3392,11 +3365,11 @@ add_to_link_pool (symbolS *sym, offsetT addend)
if (seginfo->frchainP)
for (fixp = seginfo->frchainP->fix_root;
- fixp != (fixS *) NULL;
+ fixp != NULL;
fixp = fixp->fx_next)
{
if (fixp->fx_addsy == sym
- && fixp->fx_offset == (valueT)addend
+ && fixp->fx_offset == (valueT) addend
&& fixp->tc_fix_data.info
&& fixp->tc_fix_data.info->sym
&& symbol_symbolS (fixp->tc_fix_data.info->sym)
@@ -3419,8 +3392,8 @@ add_to_link_pool (symbolS *sym, offsetT addend)
expsym = make_expr_symbol (&e);
/* Create a fixup for the entry. */
- fixp = fix_new
- (frag_now, p - frag_now->fr_literal, 8, sym, addend, 0, BFD_RELOC_64);
+ fixp = fix_new (frag_now, p - frag_now->fr_literal, 8,
+ sym, addend, 0, BFD_RELOC_64);
fixp->tc_fix_data.info = get_alpha_reloc_tag (next_sequence_num--);
fixp->tc_fix_data.info->sym = expsym;
@@ -3555,7 +3528,7 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED)
symbolS *sec_symbol;
segT current_seg = now_seg;
subsegT current_subseg = now_subseg;
- int cur_size;
+ offsetT cur_size;
input_line_pointer++;
SKIP_WHITESPACE ();
@@ -3570,13 +3543,12 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED)
/* Reuse stab_string_size to store the size of the section. */
cur_size = seg_info (sec)->stabu.stab_string_size;
- if ((int) size > cur_size)
+ if (size > cur_size)
{
- char *pfrag
- = frag_var (rs_fill, 1, 1, (relax_substateT)0, NULL,
- (valueT)size - (valueT)cur_size, NULL);
+ char *pfrag = frag_var (rs_fill, 1, 1, 0, NULL,
+ size - cur_size, NULL);
*pfrag = 0;
- seg_info (sec)->stabu.stab_string_size = (int)size;
+ seg_info (sec)->stabu.stab_string_size = size;
}
S_SET_SEGMENT (symbolP, sec);
@@ -3601,8 +3573,7 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED)
record_alignment (bss_section, log_align);
symbol_set_frag (symbolP, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP,
- size, NULL);
+ pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
*pfrag = 0;
S_SET_SEGMENT (symbolP, bss_section);
@@ -3789,7 +3760,7 @@ s_alpha_end (int dummy ATTRIBUTE_UNUSED)
if (sym && cur_frame_data)
{
OBJ_SYMFIELD_TYPE *obj = symbol_get_obj (sym);
- expressionS *exp = XNEW (expressionS);
+ expressionS *exp = notes_alloc (sizeof (*exp));
obj->size = exp;
exp->X_op = O_subtract;
@@ -4593,7 +4564,7 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED)
*(p + 3) = alpha_evax_proc->ra_save;
break;
case PDSC_S_K_KIND_FP_STACK:
- md_number_to_chars (p + 2, (valueT) alpha_evax_proc->rsa_offset, 2);
+ md_number_to_chars (p + 2, alpha_evax_proc->rsa_offset, 2);
break;
default: /* impossible */
break;
@@ -4603,7 +4574,7 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED)
*(p + 5) = alpha_evax_proc->type & 0x0f;
/* Signature offset. */
- md_number_to_chars (p + 6, (valueT) 0, 2);
+ md_number_to_chars (p + 6, 0, 2);
fix_new_exp (frag_now, p - frag_now->fr_literal + 8,
8, &exp, 0, BFD_RELOC_64);
@@ -4613,8 +4584,8 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED)
/* pdesc+16: Size. */
p = frag_more (6);
- md_number_to_chars (p, (valueT) alpha_evax_proc->framesize, 4);
- md_number_to_chars (p + 4, (valueT) 0, 2);
+ md_number_to_chars (p, alpha_evax_proc->framesize, 4);
+ md_number_to_chars (p + 4, 0, 2);
/* Entry length. */
exp.X_op = O_subtract;
@@ -4871,7 +4842,7 @@ s_alpha_gprel32 (int ignore ATTRIBUTE_UNUSED)
#endif
if (alpha_auto_align_on && alpha_current_align < 2)
- alpha_align (2, (char *) NULL, alpha_insn_label, 0);
+ alpha_align (2, NULL, alpha_insn_label, 0);
if (alpha_current_align > 2)
alpha_current_align = 2;
alpha_insn_label = NULL;
@@ -4914,7 +4885,7 @@ s_alpha_float_cons (int type)
}
if (alpha_auto_align_on && alpha_current_align < log_size)
- alpha_align (log_size, (char *) NULL, alpha_insn_label, 0);
+ alpha_align (log_size, NULL, alpha_insn_label, 0);
if (alpha_current_align > log_size)
alpha_current_align = log_size;
alpha_insn_label = NULL;
@@ -5099,7 +5070,7 @@ alpha_cons_align (int size)
++log_size;
if (alpha_auto_align_on && alpha_current_align < log_size)
- alpha_align (log_size, (char *) NULL, alpha_insn_label, 0);
+ alpha_align (log_size, NULL, alpha_insn_label, 0);
if (alpha_current_align > log_size)
alpha_current_align = log_size;
alpha_insn_label = NULL;
@@ -5368,7 +5339,7 @@ alpha_handle_align (fragS *fragp)
0x00, 0x00, 0xfe, 0x2f
};
- int bytes, fix;
+ size_t bytes, fix;
char *p;
if (fragp->fr_type != rs_align_code)
@@ -5376,16 +5347,14 @@ alpha_handle_align (fragS *fragp)
bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
p = fragp->fr_literal + fragp->fr_fix;
- fix = 0;
- if (bytes & 3)
+ fix = bytes & 3;
+ if (fix)
{
- fix = bytes & 3;
memset (p, 0, fix);
p += fix;
bytes -= fix;
}
-
if (bytes & 4)
{
memcpy (p, unop, 4);
@@ -5393,11 +5362,13 @@ alpha_handle_align (fragS *fragp)
bytes -= 4;
fix += 4;
}
-
- memcpy (p, nopunop, 8);
-
fragp->fr_fix += fix;
- fragp->fr_var = 8;
+
+ if (bytes)
+ {
+ memcpy (p, nopunop, 8);
+ fragp->fr_var = 8;
+ }
}
/* Public interface functions. */
@@ -5512,7 +5483,7 @@ md_begin (void)
#ifdef OBJ_ELF
if (ECOFF_DEBUGGING)
{
- segT sec = subseg_new (".mdebug", (subsegT) 0);
+ segT sec = subseg_new (".mdebug", 0);
bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY);
bfd_set_section_alignment (sec, 3);
}
diff --git a/gas/config/tc-alpha.h b/gas/config/tc-alpha.h
index 466a7a0..a5144e5 100644
--- a/gas/config/tc-alpha.h
+++ b/gas/config/tc-alpha.h
@@ -111,7 +111,7 @@ extern void alpha_cons_align (int);
#define HANDLE_ALIGN(sec, fragp) alpha_handle_align (fragp)
extern void alpha_handle_align (struct frag *);
-#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 8)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 4 + 8)
#ifdef OBJ_ECOFF
#define tc_frob_file_before_adjust() alpha_frob_file_before_adjust ()
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 30d6cb9..4c27c60 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -522,7 +522,7 @@ static unsigned cl_features = 0;
#define ARC_RELOC_TABLE(op) \
(&arc_reloc_op[ ((!USER_RELOC_P (op)) \
? (abort (), 0) \
- : (int) (op) - (int) O_gotoff) ])
+ : (op) - O_gotoff) ])
#define DEF(NAME, RELOC, REQ) \
{ #NAME, sizeof (#NAME)-1, O_##NAME, RELOC, REQ}
@@ -778,7 +778,7 @@ arc_insert_opcode (const struct arc_opcode *opcode)
static void
arc_opcode_free (void *elt)
{
- string_tuple_t *tuple = (string_tuple_t *) elt;
+ string_tuple_t *tuple = elt;
struct arc_opcode_hash_entry *entry = (void *) tuple->value;
free (entry->opcode);
free (entry);
@@ -1444,7 +1444,7 @@ apply_fixups (struct arc_insn *insn, fragS *fragP, int fix)
offset = insn->len;
/* Some fixups are only used internally, thus no howto. */
- if ((int) fixup->reloc == 0)
+ if (fixup->reloc == 0)
as_fatal (_("Unhandled reloc type"));
if ((int) fixup->reloc < 0)
@@ -1457,8 +1457,7 @@ apply_fixups (struct arc_insn *insn, fragS *fragP, int fix)
else
{
reloc_howto_type *reloc_howto =
- bfd_reloc_type_lookup (stdoutput,
- (bfd_reloc_code_real_type) fixup->reloc);
+ bfd_reloc_type_lookup (stdoutput, fixup->reloc);
gas_assert (reloc_howto);
/* FIXME! the reloc size is wrong in the BFD file.
@@ -2768,7 +2767,7 @@ md_pcrel_from_section (fixS *fixP,
pr_debug ("pcrel_from_section, fx_offset = %d\n", (int) fixP->fx_offset);
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (!S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
{
@@ -3660,7 +3659,7 @@ find_reloc (const char *name,
if (!nflg)
continue;
found_flag = false;
- unsigned * psflg = (unsigned *)r->flags;
+ const unsigned *psflg = r->flags;
do
{
tmp = false;
@@ -3918,7 +3917,7 @@ assemble_insn (const struct arc_opcode *opcode,
for (argidx = opcode->operands; *argidx; ++argidx)
{
const struct arc_operand *operand = &arc_operands[*argidx];
- const expressionS *t = (const expressionS *) 0;
+ const expressionS *t = NULL;
if (ARC_OPERAND_IS_FAKE (operand))
continue;
@@ -4058,8 +4057,7 @@ assemble_insn (const struct arc_opcode *opcode,
{
/* sanity checks. */
reloc_howto_type *reloc_howto
- = bfd_reloc_type_lookup (stdoutput,
- (bfd_reloc_code_real_type) reloc);
+ = bfd_reloc_type_lookup (stdoutput, reloc);
unsigned reloc_bitsize = reloc_howto->bitsize;
if (reloc_howto->rightshift)
reloc_bitsize -= reloc_howto->rightshift;
@@ -4083,8 +4081,7 @@ assemble_insn (const struct arc_opcode *opcode,
else
{
reloc_howto_type *reloc_howto =
- bfd_reloc_type_lookup (stdoutput,
- (bfd_reloc_code_real_type) fixup->reloc);
+ bfd_reloc_type_lookup (stdoutput, fixup->reloc);
pcrel = reloc_howto->pc_relative;
}
fixup->pcrel = pcrel;
@@ -4676,7 +4673,7 @@ arc_extinsn (int ignore ATTRIBUTE_UNUSED)
as_warn ("%s", errmsg);
/* Insert the extension instruction. */
- arc_insert_opcode ((const struct arc_opcode *) arc_ext_opcodes);
+ arc_insert_opcode (arc_ext_opcodes);
create_extinst_section (&einsn);
}
@@ -4974,7 +4971,7 @@ arc_stralloc (char * s1, const char * s2)
gas_assert (s2);
len += strlen (s2) + 1;
- p = (char *) xmalloc (len);
+ p = xmalloc (len);
if (s1)
{
diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h
index 727041a..65470f0 100644
--- a/gas/config/tc-arc.h
+++ b/gas/config/tc-arc.h
@@ -106,7 +106,7 @@ extern const char *arc_target_format;
/* [ ] is index operator. */
#define NEED_INDEX_OPERATOR
-#define MAX_MEM_FOR_RS_ALIGN_CODE (1+2)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (1 + 2)
/* HANDLE_ALIGN called after all the assembly has been done,
so we can fill in all the rs_align_code type frags with
@@ -271,4 +271,4 @@ struct arc_relax_type
extern void arc_md_end (void);
#define md_end arc_md_end
-#endif
+#endif /* TC_ARC */
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 822fd3d..99c07d4 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -1377,7 +1377,7 @@ arm_reg_parse_multi (char **ccp)
p++;
while (ISALPHA (*p) || ISDIGIT (*p) || *p == '_');
- reg = (struct reg_entry *) str_hash_find_n (arm_reg_hsh, start, p - start);
+ reg = str_hash_find_n (arm_reg_hsh, start, p - start);
if (!reg)
return NULL;
@@ -2505,8 +2505,7 @@ parse_reloc (char **str)
if (*q != ')')
return -1;
- if ((r = (struct reloc_entry *)
- str_hash_find_n (arm_reloc_hsh, p, q - p)) == NULL)
+ if ((r = str_hash_find_n (arm_reloc_hsh, p, q - p)) == NULL)
return -1;
*str = q + 1;
@@ -2521,7 +2520,7 @@ insert_reg_alias (char *str, unsigned number, int type)
struct reg_entry *new_reg;
const char *name;
- if ((new_reg = (struct reg_entry *) str_hash_find (arm_reg_hsh, str)) != 0)
+ if ((new_reg = str_hash_find (arm_reg_hsh, str)) != 0)
{
if (new_reg->builtin)
as_warn (_("ignoring attempt to redefine built-in register '%s'"), str);
@@ -2591,7 +2590,7 @@ create_register_alias (char * newname, char *p)
if (*oldname == '\0')
return false;
- old = (struct reg_entry *) str_hash_find (arm_reg_hsh, oldname);
+ old = str_hash_find (arm_reg_hsh, oldname);
if (!old)
{
as_warn (_("unknown register '%s' -- .req ignored"), oldname);
@@ -2838,8 +2837,7 @@ s_unreq (int a ATTRIBUTE_UNUSED)
as_bad (_("invalid syntax for .unreq directive"));
else
{
- struct reg_entry *reg
- = (struct reg_entry *) str_hash_find (arm_reg_hsh, name);
+ struct reg_entry *reg = str_hash_find (arm_reg_hsh, name);
if (!reg)
as_bad (_("unknown register alias '%s'"), name);
@@ -2863,7 +2861,7 @@ s_unreq (int a ATTRIBUTE_UNUSED)
nbuf = strdup (name);
for (p = nbuf; *p; p++)
*p = TOUPPER (*p);
- reg = (struct reg_entry *) str_hash_find (arm_reg_hsh, nbuf);
+ reg = str_hash_find (arm_reg_hsh, nbuf);
if (reg)
{
str_hash_delete (arm_reg_hsh, nbuf);
@@ -2874,7 +2872,7 @@ s_unreq (int a ATTRIBUTE_UNUSED)
for (p = nbuf; *p; p++)
*p = TOLOWER (*p);
- reg = (struct reg_entry *) str_hash_find (arm_reg_hsh, nbuf);
+ reg = str_hash_find (arm_reg_hsh, nbuf);
if (reg)
{
str_hash_delete (arm_reg_hsh, nbuf);
@@ -3100,13 +3098,13 @@ find_real_start (symbolS * symbolP)
if (S_IS_LOCAL (symbolP) || name[0] == '.')
return symbolP;
- real_start = concat (STUB_NAME, name, NULL);
+ real_start = concat (STUB_NAME, name, (const char *) NULL);
new_target = symbol_find (real_start);
free (real_start);
if (new_target == NULL)
{
- as_warn (_("Failed to find real start of function: %s\n"), name);
+ as_warn (_("Failed to find real start of function: %s"), name);
new_target = symbolP;
}
@@ -3434,7 +3432,11 @@ s_ccs_def (int name)
if (codecomposer_syntax)
s_globl (name);
else
+#ifdef OBJ_COFF
+ obj_coff_def (name);
+#else
as_bad (_(".def pseudo-op only available with -mccs flag."));
+#endif
}
/* Directives: Literal pools. */
@@ -3699,7 +3701,7 @@ symbol_locate (symbolS * symbolP,
name_length = strlen (name) + 1; /* +1 for \0. */
obstack_grow (&notes, name, name_length);
- preserved_copy_of_name = (char *) obstack_finish (&notes);
+ preserved_copy_of_name = obstack_finish (&notes);
#ifdef tc_canonicalize_symbol_name
preserved_copy_of_name =
@@ -3842,9 +3844,8 @@ s_arm_elf_cons (int nbytes)
emit_expr (&exp, (unsigned int) nbytes);
else
{
- reloc_howto_type *howto = (reloc_howto_type *)
- bfd_reloc_type_lookup (stdoutput,
- (bfd_reloc_code_real_type) reloc);
+ reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput,
+ reloc);
int size = bfd_get_reloc_size (howto);
if (reloc == BFD_RELOC_ARM_PLT32)
@@ -4256,7 +4257,7 @@ s_arm_unwind_save_pseudo (int regno)
add_unwind_opcode (op, 1);
break;
default:
- as_bad (_("Unknown register no. encountered: %d\n"), regno);
+ as_bad (_("Unknown register no. encountered: %d"), regno);
}
}
@@ -5446,9 +5447,7 @@ parse_shift (char **str, int i, enum parse_shift_mode mode)
return FAIL;
}
- shift_name
- = (const struct asm_shift_name *) str_hash_find_n (arm_shift_hsh, *str,
- p - *str);
+ shift_name = str_hash_find_n (arm_shift_hsh, *str, p - *str);
if (shift_name == NULL)
{
@@ -6256,8 +6255,7 @@ parse_psr (char **str, bool lhs)
|| strncasecmp (start, "psr", 3) == 0)
p = start + strcspn (start, "rR") + 1;
- psr = (const struct asm_psr *) str_hash_find_n (arm_v7m_psr_hsh, start,
- p - start);
+ psr = str_hash_find_n (arm_v7m_psr_hsh, start, p - start);
if (!psr)
return FAIL;
@@ -6359,8 +6357,7 @@ parse_psr (char **str, bool lhs)
}
else
{
- psr = (const struct asm_psr *) str_hash_find_n (arm_psr_hsh, start,
- p - start);
+ psr = str_hash_find_n (arm_psr_hsh, start, p - start);
if (!psr)
goto error;
@@ -6557,7 +6554,7 @@ parse_cond (char **str)
n++;
}
- c = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, cond, n);
+ c = str_hash_find_n (arm_cond_hsh, cond, n);
if (!c)
{
inst.error = _("condition required");
@@ -6580,8 +6577,7 @@ parse_barrier (char **str)
while (ISALPHA (*q))
q++;
- o = (const struct asm_barrier_opt *) str_hash_find_n (arm_barrier_opt_hsh, p,
- q - p);
+ o = str_hash_find_n (arm_barrier_opt_hsh, p, q - p);
if (!o)
return FAIL;
@@ -15427,7 +15423,7 @@ do_vfp_nsyn_opcode (const char *opname)
{
const struct asm_opcode *opcode;
- opcode = (const struct asm_opcode *) str_hash_find (arm_ops_hsh, opname);
+ opcode = str_hash_find (arm_ops_hsh, opname);
if (!opcode)
abort ();
@@ -22221,8 +22217,8 @@ fix_new_arm (fragS * frag,
break;
default:
- new_fix = (fixS *) fix_new (frag, where, size, make_expr_symbol (exp), 0,
- pc_rel, (enum bfd_reloc_code_real) reloc);
+ new_fix = fix_new (frag, where, size, make_expr_symbol (exp), 0,
+ pc_rel, reloc);
break;
}
@@ -22481,8 +22477,7 @@ opcode_lookup (char **str)
*str = end;
/* Look for unaffixed or special-case affixed mnemonic. */
- opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base,
- end - base);
+ opcode = str_hash_find_n (arm_ops_hsh, base, end - base);
cond = NULL;
if (opcode)
{
@@ -22496,7 +22491,7 @@ opcode_lookup (char **str)
if (warn_on_deprecated && unified_syntax)
as_tsktsk (_("conditional infixes are deprecated in unified syntax"));
affix = base + (opcode->tag - OT_odd_infix_0);
- cond = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, affix, 2);
+ cond = str_hash_find_n (arm_cond_hsh, affix, 2);
gas_assert (cond);
inst.cond = cond->value;
@@ -22509,9 +22504,8 @@ opcode_lookup (char **str)
if (end - base < 2)
return NULL;
affix = end - 1;
- cond = (const struct asm_cond *) str_hash_find_n (arm_vcond_hsh, affix, 1);
- opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base,
- affix - base);
+ cond = str_hash_find_n (arm_vcond_hsh, affix, 1);
+ opcode = str_hash_find_n (arm_ops_hsh, base, affix - base);
/* A known edge case is a conflict between an 'e' as a suffix for an
Else of a VPT predication block and an 'ne' suffix for an IT block.
@@ -22543,9 +22537,8 @@ opcode_lookup (char **str)
/* Look for suffixed mnemonic. */
affix = end - 2;
- cond = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, affix, 2);
- opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base,
- affix - base);
+ cond = str_hash_find_n (arm_cond_hsh, affix, 2);
+ opcode = str_hash_find_n (arm_ops_hsh, base, affix - base);
}
if (opcode && cond)
@@ -22594,14 +22587,13 @@ opcode_lookup (char **str)
/* Look for infixed mnemonic in the usual position. */
affix = base + 3;
- cond = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, affix, 2);
+ cond = str_hash_find_n (arm_cond_hsh, affix, 2);
if (!cond)
return NULL;
memcpy (save, affix, 2);
memmove (affix, affix + 2, (end - affix) - 2);
- opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base,
- (end - base) - 2);
+ opcode = str_hash_find_n (arm_ops_hsh, base, (end - base) - 2);
memmove (affix + 2, affix, (end - affix) - 2);
memcpy (affix, save, 2);
@@ -26046,14 +26038,13 @@ static valueT
md_chars_to_number (char * buf, int n)
{
valueT result = 0;
- unsigned char * where = (unsigned char *) buf;
if (target_big_endian)
{
while (n--)
{
result <<= 8;
- result |= (*where++ & 255);
+ result |= (*buf++ & 255);
}
}
else
@@ -26061,7 +26052,7 @@ md_chars_to_number (char * buf, int n)
while (n--)
{
result <<= 8;
- result |= (where[n] & 255);
+ result |= (buf[n] & 255);
}
}
@@ -26598,10 +26589,6 @@ arm_handle_align (fragS * fragP)
bytes = fragP->fr_next->fr_address - fragP->fr_address - fragP->fr_fix;
p = fragP->fr_literal + fragP->fr_fix;
- fix = 0;
-
- if (bytes > MAX_MEM_FOR_RS_ALIGN_CODE)
- bytes &= MAX_MEM_FOR_RS_ALIGN_CODE;
gas_assert ((fragP->tc_frag_data.thumb_mode & MODE_RECORDED) != 0);
@@ -26632,11 +26619,9 @@ arm_handle_align (fragS * fragP)
#endif
}
- fragP->fr_var = noop_size;
-
- if (bytes & (noop_size - 1))
+ fix = bytes & (noop_size - 1);
+ if (fix != 0)
{
- fix = bytes & (noop_size - 1);
#ifdef OBJ_ELF
insert_data_mapping_symbol (state, fragP->fr_fix, fragP, fix);
#endif
@@ -26660,45 +26645,12 @@ arm_handle_align (fragS * fragP)
noop_size = 4;
}
- while (bytes >= noop_size)
- {
- memcpy (p, noop, noop_size);
- p += noop_size;
- bytes -= noop_size;
- fix += noop_size;
- }
-
fragP->fr_fix += fix;
-}
-
-/* Called from md_do_align. Used to create an alignment
- frag in a code section. */
-
-void
-arm_frag_align_code (int n, int max)
-{
- char * p;
-
- /* We assume that there will never be a requirement
- to support alignments greater than MAX_MEM_FOR_RS_ALIGN_CODE bytes. */
- if (max > MAX_MEM_FOR_RS_ALIGN_CODE)
+ if (bytes != 0)
{
- char err_msg[128];
-
- sprintf (err_msg,
- _("alignments greater than %d bytes not supported in .text sections."),
- MAX_MEM_FOR_RS_ALIGN_CODE + 1);
- as_fatal ("%s", err_msg);
+ fragP->fr_var = noop_size;
+ memcpy (p, noop, noop_size);
}
-
- p = frag_var (rs_align_code,
- MAX_MEM_FOR_RS_ALIGN_CODE,
- 1,
- (relax_substateT) max,
- (symbolS *) NULL,
- (offsetT) n,
- (char *) NULL);
- *p = 0;
}
/* Perform target specific initialisation of a frag.
@@ -29849,10 +29801,6 @@ elf32_arm_target_format (void)
return (target_big_endian
? "elf32-bigarm-vxworks"
: "elf32-littlearm-vxworks");
-#elif defined (TE_NACL)
- return (target_big_endian
- ? "elf32-bigarm-nacl"
- : "elf32-littlearm-nacl");
#else
if (arm_fdpic)
{
@@ -30043,7 +29991,7 @@ arm_adjust_symtab (void)
}
/* Remove any overlapping mapping symbols generated by alignment frags. */
- bfd_map_over_sections (stdoutput, check_mapping_symbols, (char *) 0);
+ bfd_map_over_sections (stdoutput, check_mapping_symbols, NULL);
/* Now do generic ELF adjustments. */
elf_adjust_symtab ();
#endif
@@ -31855,7 +31803,7 @@ arm_parse_arch (const char *str)
return true;
}
- as_bad (_("unknown architecture `%s'\n"), str);
+ as_bad (_("unknown architecture `%s'"), str);
return false;
}
@@ -31871,7 +31819,7 @@ arm_parse_fpu (const char * str)
return true;
}
- as_bad (_("unknown floating point format `%s'\n"), str);
+ as_bad (_("unknown floating point format `%s'"), str);
return false;
}
@@ -31887,7 +31835,7 @@ arm_parse_float_abi (const char * str)
return true;
}
- as_bad (_("unknown floating point abi `%s'\n"), str);
+ as_bad (_("unknown floating point abi `%s'"), str);
return false;
}
@@ -31903,7 +31851,7 @@ arm_parse_eabi (const char * str)
meabi_flags = opt->value;
return true;
}
- as_bad (_("unknown EABI `%s'\n"), str);
+ as_bad (_("unknown EABI `%s'"), str);
return false;
}
#endif
@@ -32415,7 +32363,7 @@ aeabi_set_public_attributes (void)
if (arch == -1)
arch = get_aeabi_cpu_arch_from_fset (&flags_arch, &flags_ext, &profile, 0);
if (arch == -1)
- as_bad (_("no architecture contains all the instructions used\n"));
+ as_bad (_("no architecture contains all the instructions used"));
/* Tag_CPU_name. */
if (selected_cpu_name[0])
@@ -32675,7 +32623,7 @@ s_arm_arch (int ignored ATTRIBUTE_UNUSED)
return;
}
- as_bad (_("unknown architecture `%s'\n"), name);
+ as_bad (_("unknown architecture `%s'"), name);
*input_line_pointer = saved_char;
ignore_rest_of_line ();
}
@@ -32711,7 +32659,7 @@ s_arm_object_arch (int ignored ATTRIBUTE_UNUSED)
return;
}
- as_bad (_("unknown architecture `%s'\n"), name);
+ as_bad (_("unknown architecture `%s'"), name);
*input_line_pointer = saved_char;
ignore_rest_of_line ();
}
@@ -32790,8 +32738,12 @@ s_arm_arch_extension (int ignored ATTRIBUTE_UNUSED)
if (i == nb_allowed_archs)
{
- as_bad (_("architectural extension `%s' is not allowed for the "
- "current base architecture"), name);
+ if (adding_value)
+ as_bad (_("architectural extension `%s' is not allowed for the "
+ "current base architecture"), name);
+ else
+ as_tsktsk (_("disabling feature `%s' has no effect on the "
+ "current base architecture"), name);
break;
}
@@ -32813,7 +32765,7 @@ s_arm_arch_extension (int ignored ATTRIBUTE_UNUSED)
}
if (opt->name == NULL)
- as_bad (_("unknown architecture extension `%s'\n"), name);
+ as_bad (_("unknown architecture extension `%s'"), name);
*input_line_pointer = saved_char;
}
@@ -32854,7 +32806,7 @@ s_arm_fpu (int ignored ATTRIBUTE_UNUSED)
return;
}
- as_bad (_("unknown floating point format `%s'\n"), name);
+ as_bad (_("unknown floating point format `%s'"), name);
*input_line_pointer = saved_char;
ignore_rest_of_line ();
}
diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h
index 24e2197..4148a6f 100644
--- a/gas/config/tc-arm.h
+++ b/gas/config/tc-arm.h
@@ -20,6 +20,7 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#ifndef TC_ARM
#define TC_ARM 1
#ifndef TARGET_BYTES_BIG_ENDIAN
@@ -203,9 +204,6 @@ void arm_copy_symbol_attributes (symbolS *, symbolS *);
#define TC_CONS_FIX_NEW cons_fix_new_arm
-#define MAX_MEM_ALIGNMENT_BYTES 6
-#define MAX_MEM_FOR_RS_ALIGN_CODE ((1 << MAX_MEM_ALIGNMENT_BYTES) - 1)
-
/* For frags in code sections we need to record whether they contain
ARM code or THUMB code. This is that if they have to be aligned,
they can contain the correct type of no-op instruction. */
@@ -231,6 +229,7 @@ arm_min (int am_p1, int am_p2)
#define TC_FRAG_INIT(fragp, max_bytes) arm_init_frag (fragp, max_bytes)
#define TC_ALIGN_ZERO_IS_DEFAULT 1
#define HANDLE_ALIGN(sec, fragp) arm_handle_align (fragp)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 4)
/* PR gas/19276: COFF/PE segment alignment is already handled in coff_frob_section(). */
#ifndef TE_PE
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) \
@@ -238,13 +237,6 @@ arm_min (int am_p1, int am_p2)
? arm_min (2, get_recorded_alignment (SEG)) : 0)
#endif
-#define md_do_align(N, FILL, LEN, MAX, LABEL) \
- if (FILL == NULL && (N) != 0 && ! need_pass_2 && subseg_text_p (now_seg)) \
- { \
- arm_frag_align_code (N, MAX); \
- goto LABEL; \
- }
-
#define DWARF2_LINE_MIN_INSN_LENGTH 2
/* The lr register is r14. */
@@ -339,7 +331,6 @@ struct arm_segment_info_type
#define MD_PCREL_FROM_SECTION(F,S) md_pcrel_from_section(F,S)
-extern void arm_frag_align_code (int, int);
extern void arm_validate_fix (struct fix *);
extern const char * elf32_arm_target_format (void);
extern void arm_elf_change_section (void);
@@ -387,3 +378,5 @@ extern bool arm_tc_equal_in_insn (int, char *);
#define TC_LARGEST_EXPONENT_IS_NORMAL(PRECISION) \
arm_is_largest_exponent_ok ((PRECISION))
int arm_is_largest_exponent_ok (int precision);
+
+#endif /* TC_ARM */
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index a7678e2..671df82 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -841,12 +841,10 @@ md_begin (void)
for (i = 0; i < ARRAY_SIZE (avr_no_sreg); ++i)
{
gas_assert (str_hash_find (avr_hash, avr_no_sreg[i]));
- str_hash_insert (avr_no_sreg_hash, avr_no_sreg[i],
- (void *) 4 /* dummy */, 0);
+ str_hash_insert_int (avr_no_sreg_hash, avr_no_sreg[i], 0 /* dummy */, 0);
}
- avr_gccisr_opcode = (struct avr_opcodes_s*) str_hash_find (avr_hash,
- "__gcc_isr");
+ avr_gccisr_opcode = str_hash_find (avr_hash, "__gcc_isr");
gas_assert (avr_gccisr_opcode);
bfd_set_arch_mach (stdoutput, TARGET_ARCH, avr_mcu->mach);
@@ -1425,10 +1423,10 @@ avr_operands (struct avr_opcodes_s *opcode, char **line)
&& AVR_SKIP_P (frag_now->tc_frag_data.prev_opcode))
as_warn (_("skipping two-word instruction"));
- bfd_putl32 ((bfd_vma) bin, frag);
+ bfd_putl32 (bin, frag);
}
else
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
frag_now->tc_frag_data.prev_opcode = bin;
*line = str;
@@ -1442,7 +1440,7 @@ valueT
md_section_align (asection *seg, valueT addr)
{
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & (-1UL << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
/* If you define this macro, it should return the offset between the
@@ -1454,7 +1452,7 @@ md_section_align (asection *seg, valueT addr)
long
md_pcrel_from_section (fixS *fixp, segT sec)
{
- if (fixp->fx_addsy != (symbolS *) NULL
+ if (fixp->fx_addsy != NULL
&& (!S_IS_DEFINED (fixp->fx_addsy)
|| (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
return 0;
@@ -1521,7 +1519,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
unsigned long insn;
long value = *valP;
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
else if (fixP->fx_pcrel)
@@ -1569,7 +1567,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
fixP->fx_subsy = NULL;
}
/* We don't actually support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
/* For the DIFF relocs, write the value into the object file while still
@@ -1590,10 +1588,10 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
*where = value;
break;
case BFD_RELOC_AVR_DIFF16:
- bfd_putl16 ((bfd_vma) value, where);
+ bfd_putl16 (value, where);
break;
case BFD_RELOC_AVR_DIFF32:
- bfd_putl32 ((bfd_vma) value, where);
+ bfd_putl32 (value, where);
break;
case BFD_RELOC_AVR_CALL:
break;
@@ -1621,7 +1619,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("operand out of range: %ld"), value);
value = (value << 3) & 0x3f8;
- bfd_putl16 ((bfd_vma) (value | insn), where);
+ bfd_putl16 (value | insn, where);
break;
case BFD_RELOC_AVR_13_PCREL:
@@ -1642,15 +1640,15 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
}
value &= 0xfff;
- bfd_putl16 ((bfd_vma) (value | insn), where);
+ bfd_putl16 (value | insn, where);
break;
case BFD_RELOC_32:
- bfd_putl32 ((bfd_vma) value, where);
+ bfd_putl32 (value, where);
break;
case BFD_RELOC_16:
- bfd_putl16 ((bfd_vma) value, where);
+ bfd_putl16 (value, where);
break;
case BFD_RELOC_8:
@@ -1661,14 +1659,14 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
break;
case BFD_RELOC_AVR_16_PM:
- bfd_putl16 ((bfd_vma) (value >> 1), where);
+ bfd_putl16 (value >> 1, where);
break;
case BFD_RELOC_AVR_LDI:
if (value > 255)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("operand out of range: %ld"), value);
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (value), where);
break;
case BFD_RELOC_AVR_LDS_STS_16:
@@ -1677,78 +1675,78 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
_("operand out of range: 0x%lx"),
(unsigned long)value);
insn |= ((value & 0xF) | ((value & 0x30) << 5) | ((value & 0x40) << 2));
- bfd_putl16 ((bfd_vma) insn, where);
+ bfd_putl16 (insn, where);
break;
case BFD_RELOC_AVR_6:
if ((value > 63) || (value < 0))
as_bad_where (fixP->fx_file, fixP->fx_line,
_("operand out of range: %ld"), value);
- bfd_putl16 ((bfd_vma) insn | ((value & 7) | ((value & (3 << 3)) << 7)
- | ((value & (1 << 5)) << 8)), where);
+ bfd_putl16 (insn | ((value & 7) | ((value & (3 << 3)) << 7)
+ | ((value & (1 << 5)) << 8)), where);
break;
case BFD_RELOC_AVR_6_ADIW:
if ((value > 63) || (value < 0))
as_bad_where (fixP->fx_file, fixP->fx_line,
_("operand out of range: %ld"), value);
- bfd_putl16 ((bfd_vma) insn | (value & 0xf) | ((value & 0x30) << 2), where);
+ bfd_putl16 (insn | (value & 0xf) | ((value & 0x30) << 2), where);
break;
case BFD_RELOC_AVR_LO8_LDI:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (value), where);
break;
case BFD_RELOC_AVR_HI8_LDI:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 8), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (value >> 8), where);
break;
case BFD_RELOC_AVR_MS8_LDI:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 24), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (value >> 24), where);
break;
case BFD_RELOC_AVR_HH8_LDI:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 16), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (value >> 16), where);
break;
case BFD_RELOC_AVR_LO8_LDI_NEG:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (-value), where);
break;
case BFD_RELOC_AVR_HI8_LDI_NEG:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 8), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 8), where);
break;
case BFD_RELOC_AVR_MS8_LDI_NEG:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 24), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 24), where);
break;
case BFD_RELOC_AVR_HH8_LDI_NEG:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 16), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 16), where);
break;
case BFD_RELOC_AVR_LO8_LDI_PM:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 1), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (value >> 1), where);
break;
case BFD_RELOC_AVR_HI8_LDI_PM:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 9), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (value >> 9), where);
break;
case BFD_RELOC_AVR_HH8_LDI_PM:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 17), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (value >> 17), where);
break;
case BFD_RELOC_AVR_LO8_LDI_PM_NEG:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 1), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 1), where);
break;
case BFD_RELOC_AVR_HI8_LDI_PM_NEG:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 9), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 9), where);
break;
case BFD_RELOC_AVR_HH8_LDI_PM_NEG:
- bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 17), where);
+ bfd_putl16 (insn | LDI_IMMEDIATE (-value >> 17), where);
break;
case BFD_RELOC_AVR_CALL:
@@ -1761,8 +1759,8 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
_("odd address operand: %ld"), value);
value >>= 1;
x |= ((value & 0x10000) | ((value << 3) & 0x1f00000)) >> 16;
- bfd_putl16 ((bfd_vma) x, where);
- bfd_putl16 ((bfd_vma) (value & 0xffff), where + 2);
+ bfd_putl16 (x, where);
+ bfd_putl16 (value & 0xffff, where + 2);
}
break;
@@ -1787,14 +1785,14 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
if (value > 63)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("operand out of range: %ld"), value);
- bfd_putl16 ((bfd_vma) insn | ((value & 0x30) << 5) | (value & 0x0f), where);
+ bfd_putl16 (insn | ((value & 0x30) << 5) | (value & 0x0f), where);
break;
case BFD_RELOC_AVR_PORT5:
if (value > 31)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("operand out of range: %ld"), value);
- bfd_putl16 ((bfd_vma) insn | ((value & 0x1f) << 3), where);
+ bfd_putl16 (insn | ((value & 0x1f) << 3), where);
break;
}
}
@@ -1858,7 +1856,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED,
reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("reloc %d not supported by object file format"),
@@ -1885,7 +1883,7 @@ md_assemble (char *str)
if (!op[0])
as_bad (_("can't find opcode "));
- opcode = (struct avr_opcodes_s *) str_hash_find (avr_hash, op);
+ opcode = str_hash_find (avr_hash, op);
if (opcode && !avr_opt.all_opcodes)
{
@@ -2192,8 +2190,7 @@ avr_output_property_record (char * const frag_base, char *frag_ptr,
fix->fx_line = 0;
frag_ptr += 4;
- md_number_to_chars (frag_ptr, (bfd_byte) record->type, 1);
- frag_ptr += 1;
+ *frag_ptr++ = record->type & 0xff;
/* Write out the rest of the data. */
switch (record->type)
@@ -2464,7 +2461,7 @@ avr_update_gccisr (struct avr_opcodes_s *opcode, int reg1, int reg2)
/* SREG: Look up instructions that don't clobber SREG. */
if (!avr_isr.need_sreg
- && !str_hash_find (avr_no_sreg_hash, opcode->name))
+ && str_hash_find_int (avr_no_sreg_hash, opcode->name) < 0)
{
avr_isr.need_sreg = 1;
}
@@ -2507,8 +2504,7 @@ avr_emit_insn (const char *insn, int reg, char **pwhere)
{
const int sreg = 0x3f;
unsigned bin = 0;
- const struct avr_opcodes_s *op
- = (struct avr_opcodes_s*) str_hash_find (avr_hash, insn);
+ const struct avr_opcodes_s *op = str_hash_find (avr_hash, insn);
/* We only have to deal with: IN, OUT, PUSH, POP, CLR, LDI 0, MOV R1.
All of these deal with at least one Reg and are 1-word instructions. */
@@ -2549,7 +2545,7 @@ avr_emit_insn (const char *insn, int reg, char **pwhere)
|| 0 == strcmp ("mov", op->name)
|| 0 == strcmp ("ldi", op->name));
- bfd_putl16 ((bfd_vma) bin, *pwhere);
+ bfd_putl16 (bin, *pwhere);
(*pwhere) += 2 * op->insn_size;
}
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c
index 5b1db29..0a635f4 100644
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -52,7 +52,7 @@ FILE *errorf;
#endif
static flagword bfin_flags = DEFAULT_FLAGS | DEFAULT_FDPIC;
-static const char *bfin_pic_flag = DEFAULT_FDPIC ? "-mfdpic" : (const char *)0;
+static const char *bfin_pic_flag = DEFAULT_FDPIC ? "-mfdpic" : NULL;
/* Blackfin specific function to handle FD-PIC pointer initializations. */
@@ -614,7 +614,7 @@ md_operand (expressionS * expressionP)
symbolS *
md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
{
- return (symbolS *) 0;
+ return NULL;
}
int
@@ -806,7 +806,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
reloc->addend = fixp->fx_offset;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
/* xgettext:c-format. */
@@ -824,7 +824,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
long
md_pcrel_from_section (fixS *fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (!S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
{
@@ -937,7 +937,7 @@ Expr_Node_Create (Expr_Node_Type type,
{
- Expr_Node *node = (Expr_Node *) allocate (sizeof (Expr_Node));
+ Expr_Node *node = allocate (sizeof (Expr_Node));
node->type = type;
node->value = value;
node->Left_Child = Left_Child;
@@ -1857,8 +1857,8 @@ bfin_gen_loop (Expr_Node *exp, REG_T reg, int rop, REG_T preg)
symbolS *sym;
loopsym = exp->value.s_value;
- lbeginsym = (char *) xmalloc (strlen (loopsym) + strlen ("__BEGIN") + 5);
- lendsym = (char *) xmalloc (strlen (loopsym) + strlen ("__END") + 5);
+ lbeginsym = xmalloc (strlen (loopsym) + strlen ("__BEGIN") + 5);
+ lendsym = xmalloc (strlen (loopsym) + strlen ("__END") + 5);
lbeginsym[0] = 0;
lendsym[0] = 0;
@@ -1902,7 +1902,7 @@ bfin_loop_beginend (Expr_Node *exp, int begin)
const char *suffix = begin ? "__BEGIN" : "__END";
loopsym = exp->value.s_value;
- label_name = (char *) xmalloc (strlen (loopsym) + strlen (suffix) + 5);
+ label_name = xmalloc (strlen (loopsym) + strlen (suffix) + 5);
label_name[0] = 0;
diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c
index 84eab3f..fd77c6f 100644
--- a/gas/config/tc-bpf.c
+++ b/gas/config/tc-bpf.c
@@ -315,7 +315,7 @@ immediate_overflow (int64_t value, unsigned bits)
long
md_pcrel_from_section (fixS *fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| (S_GET_SEGMENT (fixP->fx_addsy) != sec)
|| S_IS_EXTERNAL (fixP->fx_addsy)
@@ -362,7 +362,7 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, fixS *fixP)
reloc->howto = bfd_reloc_type_lookup (stdoutput, r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("relocation is not supported"));
@@ -516,17 +516,6 @@ encode_int32 (int32_t value, char *buffer)
}
}
-/* Write a BPF instruction to BUF. */
-
-static void
-write_insn_bytes (bfd_byte *buf, char *bytes)
-{
- int i;
-
- for (i = 0; i < 8; ++i)
- md_number_to_chars ((char *) buf + i, (valueT) bytes[i], 1);
-}
-
/* *FRAGP has been relaxed to its final size, and now needs to have
the bytes inside it modified to conform to the new size.
@@ -625,13 +614,14 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
{
/* 16-bit disp is known and not in range. Turn the JA
into a JAL with a 32-bit displacement. */
- char bytes[8] = {0};
-
- bytes[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff;
- bytes[1] = (word >> 48) & 0xff;
- bytes[2] = 0; /* disp16 high */
- bytes[3] = 0; /* disp16 lo */
- write_insn_bytes (buf, bytes);
+ buf[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff;
+ buf[1] = (word >> 48) & 0xff;
+ buf[2] = 0; /* disp16 high */
+ buf[3] = 0; /* disp16 lo */
+ buf[4] = 0;
+ buf[5] = 0;
+ buf[6] = 0;
+ buf[7] = 0;
/* Install fixup for the JAL. */
reloc_howto_type *reloc_howto
@@ -713,8 +703,6 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
/* 16-bit disp is known and not in range. Turn the JXX
into a sequence JXX +1; JA +1; JAL d32. */
- char bytes[8];
-
/* First, set the 16-bit offset in the current
instruction to 1. */
@@ -726,24 +714,25 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
/* Then, write the JA + 1 */
- bytes[0] = 0x05; /* JA */
- bytes[1] = 0x0;
- encode_int16 (1, bytes + 2);
- bytes[4] = 0x0;
- bytes[5] = 0x0;
- bytes[6] = 0x0;
- bytes[7] = 0x0;
- write_insn_bytes (buf, bytes);
+ buf[0] = 0x05; /* JA */
+ buf[1] = 0x0;
+ encode_int16 (1, (char *) buf + 2);
+ buf[4] = 0x0;
+ buf[5] = 0x0;
+ buf[6] = 0x0;
+ buf[7] = 0x0;
buf += 8;
/* Finally, write the JAL to the target. */
- bytes[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff;
- bytes[1] = 0;
- bytes[2] = 0;
- bytes[3] = 0;
- encode_int32 ((int32_t) 0, bytes + 4);
- write_insn_bytes (buf, bytes);
+ buf[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff;
+ buf[1] = 0;
+ buf[2] = 0;
+ buf[3] = 0;
+ buf[4] = 0;
+ buf[5] = 0;
+ buf[6] = 0;
+ buf[7] = 0;
/* Install fixup for the JAL. */
reloc_howto_type *reloc_howto
@@ -848,7 +837,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
break;
}
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
if (fixP->fx_done)
@@ -870,14 +859,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
md_number_to_chars (where, *valP, 8);
break;
case BFD_RELOC_BPF_DISP16:
- md_number_to_chars (where + 2, (uint16_t) *valP, 2);
+ md_number_to_chars (where + 2, *valP, 2);
break;
case BFD_RELOC_BPF_DISP32:
case BFD_RELOC_BPF_DISPCALL32:
- md_number_to_chars (where + 4, (uint32_t) *valP, 4);
+ md_number_to_chars (where + 4, *valP, 4);
break;
case BFD_RELOC_16_PCREL:
- md_number_to_chars (where + 2, (uint32_t) *valP, 2);
+ md_number_to_chars (where + 2, *valP, 2);
break;
default:
as_bad_where (fixP->fx_file, fixP->fx_line,
@@ -1195,13 +1184,11 @@ add_fixed_insn (struct bpf_insn *insn)
{
char *this_frag = frag_more (insn->size);
char bytes[16];
- int i;
/* First encode the known parts of the instruction, including
opcodes and constant immediates, and write them to the frag. */
encode_insn (insn, bytes, 0 /* relax */);
- for (i = 0; i < insn->size; ++i)
- md_number_to_chars (this_frag + i, (valueT) bytes[i], 1);
+ memcpy (this_frag, bytes, insn->size);
/* Now install the instruction fixups. */
install_insn_fixups (insn, frag_now,
@@ -1214,7 +1201,6 @@ static void
add_relaxed_insn (struct bpf_insn *insn, expressionS *exp)
{
char bytes[16];
- int i;
char *this_frag;
unsigned worst_case = relaxed_branch_length (NULL, NULL, 0);
unsigned best_case = insn->size;
@@ -1231,8 +1217,7 @@ add_relaxed_insn (struct bpf_insn *insn, expressionS *exp)
/* First encode the known parts of the instruction, including
opcodes and constant immediates, and write them to the frag. */
encode_insn (insn, bytes, 1 /* relax */);
- for (i = 0; i < insn->size; ++i)
- md_number_to_chars (this_frag + i, (valueT) bytes[i], 1);
+ memcpy (this_frag, bytes, insn->size);
/* Note that instruction fixups will be applied once the frag is
relaxed, in md_convert_frag. */
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index 751a861..f2d1108 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -119,7 +119,6 @@ const size_t md_longopts_size = sizeof (md_longopts);
static void
l_cons (int nbytes)
{
- int c;
expressionS exp;
#ifdef md_flush_pending_output
@@ -141,7 +140,6 @@ l_cons (int nbytes)
md_cons_align (nbytes);
#endif
- c = 0;
do
{
unsigned int bits_available = BITS_PER_CHAR * nbytes;
@@ -235,8 +233,7 @@ l_cons (int nbytes)
if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c'))
code_label = 1;
- emit_expr (&exp, (unsigned int) nbytes);
- ++c;
+ emit_expr (&exp, nbytes);
if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c'))
{
input_line_pointer +=3;
@@ -329,7 +326,7 @@ get_register (char *reg_name)
{
const reg_entry *rreg;
- rreg = (const reg_entry *) str_hash_find (reg_hash, reg_name);
+ rreg = str_hash_find (reg_hash, reg_name);
if (rreg != NULL)
return rreg->value.reg_val;
@@ -350,10 +347,10 @@ get_register_pair (char *reg_name)
tmp_rp[0] = '(';
strcat (tmp_rp, reg_name);
strcat (tmp_rp,")");
- rreg = (const reg_entry *) str_hash_find (regp_hash, tmp_rp);
+ rreg = str_hash_find (regp_hash, tmp_rp);
}
else
- rreg = (const reg_entry *) str_hash_find (regp_hash, reg_name);
+ rreg = str_hash_find (regp_hash, reg_name);
if (rreg != NULL)
return rreg->value.reg_val;
@@ -368,7 +365,7 @@ get_index_register (char *reg_name)
{
const reg_entry *rreg;
- rreg = (const reg_entry *) str_hash_find (reg_hash, reg_name);
+ rreg = str_hash_find (reg_hash, reg_name);
if ((rreg != NULL)
&& ((rreg->value.reg_val == 12) || (rreg->value.reg_val == 13)))
@@ -383,7 +380,7 @@ get_index_register_pair (char *reg_name)
{
const reg_entry *rreg;
- rreg = (const reg_entry *) str_hash_find (regp_hash, reg_name);
+ rreg = str_hash_find (regp_hash, reg_name);
if (rreg != NULL)
{
@@ -404,7 +401,7 @@ get_pregister (char *preg_name)
{
const reg_entry *prreg;
- prreg = (const reg_entry *) str_hash_find (preg_hash, preg_name);
+ prreg = str_hash_find (preg_hash, preg_name);
if (prreg != NULL)
return prreg->value.preg_val;
@@ -419,7 +416,7 @@ get_pregisterp (char *preg_name)
{
const reg_entry *prreg;
- prreg = (const reg_entry *) str_hash_find (pregp_hash, preg_name);
+ prreg = str_hash_find (pregp_hash, preg_name);
if (prreg != NULL)
return prreg->value.preg_val;
@@ -636,15 +633,15 @@ md_estimate_size_before_relax (fragS *fragp, asection *seg)
}
void
-md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, fragS *fragP)
+md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ fragS *fragP)
{
/* 'opcode' points to the start of the instruction, whether
we need to change the instruction's fixed encoding. */
char *opcode = &fragP->fr_literal[0] + fragP->fr_fix;
bfd_reloc_code_real_type reloc;
- subseg_change (sec, 0);
-
switch (fragP->fr_subtype)
{
case 0:
@@ -760,7 +757,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
switch (fixP->fx_r_type)
{
case BFD_RELOC_CR16_NUM8:
- bfd_put_8 (stdoutput, (unsigned char) val, buf);
+ bfd_put_8 (stdoutput, val, buf);
break;
case BFD_RELOC_CR16_NUM16:
bfd_put_16 (stdoutput, val, buf);
@@ -2456,7 +2453,7 @@ print_insn (ins *insn)
/* Write the instruction encoding to frag. */
for (i = 0; i < insn_size; i++)
{
- md_number_to_chars (this_frag, (valueT) words[i], 2);
+ md_number_to_chars (this_frag, words[i], 2);
this_frag += 2;
}
}
@@ -2469,7 +2466,7 @@ cr16_assemble (const char *op, char *param)
ins cr16_ins;
/* Find the instruction. */
- instruction = (const inst *) str_hash_find (cr16_inst_hash, op);
+ instruction = str_hash_find (cr16_inst_hash, op);
if (instruction == NULL)
{
as_bad (_("Unknown opcode: `%s'"), op);
@@ -2514,7 +2511,7 @@ md_assemble (char *op)
strcpy (param1, get_b_cc (op));
strcat (param1,",");
strcat (param1, param);
- param = (char *) &param1;
+ param = param1;
cr16_assemble ("b", param);
return;
}
@@ -2539,7 +2536,7 @@ md_assemble (char *op)
{
strcpy (param1, param);
/* Find the instruction. */
- instruction = (const inst *) str_hash_find (cr16_inst_hash, op);
+ instruction = str_hash_find (cr16_inst_hash, op);
parse_operands (&cr16_ins, param1);
if (((&cr16_ins)->arg[0].type == arg_ic)
&& ((&cr16_ins)->arg[0].constant >= 0))
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index 2204869..ed91d06 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -877,7 +877,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED,
case ENCODE_RELAX (STATE_COND_BRANCH, STATE_DWORD):
gen_cond_branch_32 (fragP->fr_opcode, var_partp, fragP,
- fragP->fr_symbol, (symbolS *) NULL,
+ fragP->fr_symbol, NULL,
fragP->fr_offset);
/* Ten bytes added: a branch, nop and a jump. */
var_part_size = 2 + 2 + 4 + 2;
@@ -885,7 +885,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED,
case ENCODE_RELAX (STATE_COND_BRANCH_PIC, STATE_DWORD):
gen_cond_branch_32 (fragP->fr_opcode, var_partp, fragP,
- fragP->fr_symbol, (symbolS *) NULL,
+ fragP->fr_symbol, NULL,
fragP->fr_offset);
/* Twelve bytes added: a branch, nop and a pic-branch-32. */
var_part_size = 2 + 2 + 4 + 2 + 2;
@@ -893,7 +893,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED,
case ENCODE_RELAX (STATE_COND_BRANCH_V32, STATE_DWORD):
gen_cond_branch_32 (fragP->fr_opcode, var_partp, fragP,
- fragP->fr_symbol, (symbolS *) NULL,
+ fragP->fr_symbol, NULL,
fragP->fr_offset);
/* Twelve bytes added: a branch, nop and another branch and nop. */
var_part_size = 2 + 2 + 2 + 4 + 2;
@@ -1274,7 +1274,7 @@ md_assemble (char *str)
opcodep = cris_insn_first_word_frag ();
/* Output the prefix opcode. */
- md_number_to_chars (opcodep, (long) prefix.opcode, 2);
+ md_number_to_chars (opcodep, prefix.opcode, 2);
/* Having a specified reloc only happens for DIP and for BDAP with
PIC or TLS operands, but it is ok to drop through here for the other
@@ -1324,7 +1324,7 @@ md_assemble (char *str)
opcodep = frag_more (2);
/* Output the instruction opcode. */
- md_number_to_chars (opcodep, (long) (output_instruction.opcode), 2);
+ md_number_to_chars (opcodep, output_instruction.opcode, 2);
/* Output the symbol-dependent instruction stuff. */
if (output_instruction.insn_type == CRIS_INSN_BRANCH)
@@ -1392,8 +1392,7 @@ md_assemble (char *str)
? 12 : 10);
gen_cond_branch_32 (opcodep, cond_jump, frag_now,
- output_instruction.expr.X_add_symbol,
- (symbolS *) NULL,
+ output_instruction.expr.X_add_symbol, NULL,
output_instruction.expr.X_add_number);
}
}
@@ -1552,7 +1551,7 @@ cris_process_instruction (char *insn_text, struct cris_instruction *out_insnp,
}
/* Find the instruction. */
- instruction = (struct cris_opcode *) str_hash_find (op_hash, insn_text);
+ instruction = str_hash_find (op_hash, insn_text);
if (instruction == NULL)
{
as_bad (_("Unknown opcode: `%s'"), insn_text);
@@ -4039,16 +4038,15 @@ void
md_apply_fix (fixS *fixP, valueT *valP, segT seg)
{
/* This assignment truncates upper bits if valueT is 64 bits (as with
- --enable-64-bit-bfd), which is fine here, though we cast to avoid
- any compiler warnings. */
- long val = (long) *valP;
+ --enable-64-bit-bfd), which is fine here. */
+ long val = *valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
if (fixP->fx_addsy == 0 && !fixP->fx_pcrel)
fixP->fx_done = 1;
/* We can't actually support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
/* This operand-type is scaled. */
diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c
index f62424b..e519214 100644
--- a/gas/config/tc-crx.c
+++ b/gas/config/tc-crx.c
@@ -184,7 +184,7 @@ get_register (char *reg_name)
{
const reg_entry *rreg;
- rreg = (const reg_entry *) str_hash_find (reg_hash, reg_name);
+ rreg = str_hash_find (reg_hash, reg_name);
if (rreg != NULL)
return rreg->value.reg_val;
@@ -199,7 +199,7 @@ get_copregister (char *copreg_name)
{
const reg_entry *coreg;
- coreg = (const reg_entry *) str_hash_find (copreg_hash, copreg_name);
+ coreg = str_hash_find (copreg_hash, copreg_name);
if (coreg != NULL)
return coreg->value.copreg_val;
@@ -325,7 +325,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS * fixP)
gas_assert ((int) fixP->fx_r_type > 0);
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("internal error: reloc %d (`%s') not supported by object file format"),
@@ -368,15 +368,15 @@ md_estimate_size_before_relax (fragS *fragp, asection *seg)
}
void
-md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, fragS *fragP)
+md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ fragS *fragP)
{
/* 'opcode' points to the start of the instruction, whether
we need to change the instruction's fixed encoding. */
char *opcode = &fragP->fr_literal[0] + fragP->fr_fix;
bfd_reloc_code_real_type reloc;
- subseg_change (sec, 0);
-
switch (fragP->fr_subtype)
{
case 0:
@@ -456,7 +456,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
switch (fixP->fx_r_type)
{
case BFD_RELOC_CRX_NUM8:
- bfd_put_8 (stdoutput, (unsigned char) val, buf);
+ bfd_put_8 (stdoutput, val, buf);
break;
case BFD_RELOC_CRX_NUM16:
bfd_put_16 (stdoutput, val, buf);
@@ -569,8 +569,8 @@ process_label_constant (char *str, ins * crx_ins)
str);
crx_ins->exp.X_op = O_constant;
crx_ins->exp.X_add_number = 0;
- crx_ins->exp.X_add_symbol = (symbolS *) 0;
- crx_ins->exp.X_op_symbol = (symbolS *) 0;
+ crx_ins->exp.X_add_symbol = NULL;
+ crx_ins->exp.X_op_symbol = NULL;
/* Fall through. */
case O_constant:
@@ -1907,7 +1907,7 @@ print_insn (ins *insn)
/* Write the instruction encoding to frag. */
for (i = 0; i < insn_size; i++)
{
- md_number_to_chars (this_frag, (valueT) words[i], 2);
+ md_number_to_chars (this_frag, words[i], 2);
this_frag += 2;
}
}
@@ -1933,7 +1933,7 @@ md_assemble (char *op)
*param++ = '\0';
/* Find the instruction. */
- instruction = (const inst *) str_hash_find (crx_inst_hash, op);
+ instruction = str_hash_find (crx_inst_hash, op);
if (instruction == NULL)
{
as_bad (_("Unknown opcode: `%s'"), op);
diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c
index 81f1b75..dc8ee74 100644
--- a/gas/config/tc-csky.c
+++ b/gas/config/tc-csky.c
@@ -632,102 +632,120 @@ struct csky_cpu_info
#define CSKY_FEATURES_DEF_NULL() \
- {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {{0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_e(isa_e) \
{FEATURE_DSP_EXT(isa_e), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_t(isa_t) \
{FEATURE_TRUST(isa_t), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_f(isa_f) \
{FEATURE_FLOAT(isa_f), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_v(isa_v) \
{FEATURE_VDSP(isa_v), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_ef(isa_e, isa_f) \
{FEATURE_DSP_EXT(isa_e), \
FEATURE_FLOAT(isa_f), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_jt(isa_j, isa_t) \
{FEATURE_JAVA(isa_j), \
FEATURE_TRUST(isa_t), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_efht(isa_e, isa_f, isa_h, isa_t) \
{FEATURE_DSP_EXT(isa_e), \
FEATURE_FLOAT(isa_f), \
FEATURE_SHIELD(isa_h), \
FEATURE_TRUST(isa_t), \
- {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_efv(isa_e, isa_f, isa_v) \
{FEATURE_DSP_EXT(isa_e), \
FEATURE_FLOAT(isa_f), \
FEATURE_VDSP(isa_v), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_eft(isa_e, isa_f, isa_t) \
{FEATURE_DSP_EXT(isa_e), \
FEATURE_FLOAT(isa_f), \
FEATURE_TRUST(isa_t), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_d(isa_d) \
- {FEATURE_DSP(isa_d), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {FEATURE_DSP(isa_d), \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_df(isa_d, isa_f) \
- {FEATURE_DSP(isa_d), \
- FEATURE_FLOAT(isa_f), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {FEATURE_DSP(isa_d), \
+ FEATURE_FLOAT(isa_f), \
+ {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_ft(isa_f, isa_t) \
{FEATURE_FLOAT(isa_f), \
FEATURE_TRUST(isa_t), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_tv(isa_t, isa_v) \
{FEATURE_TRUST(isa_t), \
FEATURE_VDSP(isa_v), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_fv(isa_f, isa_v) \
{FEATURE_FLOAT(isa_f), \
FEATURE_VDSP(isa_v), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
-
+ {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_dft(isa_d, isa_f, isa_t) \
{FEATURE_DSP(isa_d), \
FEATURE_FLOAT(isa_f), \
FEATURE_TRUST(isa_t), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_dfv(isa_d, isa_f, isa_v) \
{FEATURE_DSP(isa_d), \
FEATURE_FLOAT(isa_f), \
FEATURE_VDSP(isa_v), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_ftv(isa_f, isa_t, isa_v) \
{FEATURE_FLOAT(isa_f), \
FEATURE_TRUST(isa_t), \
FEATURE_VDSP(isa_v), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_FEATURES_DEF_eftv(isa_e, isa_f, isa_t, isa_v) \
{FEATURE_DSP_EXT(isa_e), \
FEATURE_FLOAT(isa_f), \
FEATURE_TRUST(isa_t), \
FEATURE_VDSP(isa_v), \
- {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_CPU_REVERISON_r0p0(isa) \
@@ -740,13 +758,15 @@ struct csky_cpu_info
{3, 0, isa}
#define CSKY_CPU_REVERISON_RESERVED() \
-{{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {{0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
#define CSKY_CPU_REVERISON_R3(isa1, isa2, isa3) \
{CSKY_CPU_REVERISON_r1p0(isa1), \
CSKY_CPU_REVERISON_r2p0(isa2), \
CSKY_CPU_REVERISON_r3p0(isa3), \
- {0}, {0}, {0}, {0}, {0}, {0}, {0}}
+ {0,0,0}, {0,0,0}, \
+ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}}
/* CSKY cpus table. */
const struct csky_cpu_info csky_cpus[] =
@@ -936,7 +956,11 @@ const struct csky_cpu_info csky_cpus[] =
/* Start of private CPUs. */
/* End of private CPUs. */
- {NULL},
+ {NULL,
+ 0,
+ 0,
+ CSKY_FEATURES_DEF_NULL(),
+ CSKY_CPU_REVERISON_RESERVED()}
};
int md_short_jump_size = 2;
@@ -1926,11 +1950,11 @@ mapping_state (map_state state)
{
struct frag * const frag_first = seg_info (now_seg)->frchainP->frch_root;
if (frag_now != frag_first || frag_now_fix () > 0)
- make_mapping_symbol (MAP_DATA, (valueT) 0, frag_first);
+ make_mapping_symbol (MAP_DATA, 0, frag_first);
}
seg_info (now_seg)->tc_segment_info_data.current_state = state;
- make_mapping_symbol (state, (valueT) frag_now_fix (), frag_now);
+ make_mapping_symbol (state, frag_now_fix (), frag_now);
}
/* Dump the literal pool. */
@@ -3386,10 +3410,8 @@ parse_opcode (char *str)
csky_insn.number = csky_count_operands (opcode_end);
/* Find hash by name in csky_macros_hash and csky_opcodes_hash. */
- csky_insn.macro = (struct csky_macro_info *) str_hash_find (csky_macros_hash,
- macro_name);
- csky_insn.opcode = (struct csky_opcode *) str_hash_find (csky_opcodes_hash,
- name);
+ csky_insn.macro = str_hash_find (csky_macros_hash, macro_name);
+ csky_insn.opcode = str_hash_find (csky_opcodes_hash, name);
if (csky_insn.macro == NULL && csky_insn.opcode == NULL)
return false;
@@ -3614,8 +3636,7 @@ get_operand_value (struct csky_opcode_info *op,
if (val <= 6)
{
const char *name = "movi";
- csky_insn.opcode = (struct csky_opcode *)
- str_hash_find (csky_opcodes_hash, name);
+ csky_insn.opcode = str_hash_find (csky_opcodes_hash, name);
csky_insn.val[csky_insn.idx - 1] = 1 << val;
}
return true;
@@ -3648,8 +3669,7 @@ get_operand_value (struct csky_opcode_info *op,
if (log <= 6)
{
const char *name = "movi";
- csky_insn.opcode = (struct csky_opcode *)
- str_hash_find (csky_opcodes_hash, name);
+ csky_insn.opcode = str_hash_find (csky_opcodes_hash, name);
as_warn (_("translating mgeni to movi"));
}
else
@@ -3686,8 +3706,7 @@ get_operand_value (struct csky_opcode_info *op,
if (mask_val > 0 && mask_val < 8)
{
const char *op_movi = "movi";
- csky_insn.opcode = (struct csky_opcode *)
- str_hash_find (csky_opcodes_hash, op_movi);
+ csky_insn.opcode = str_hash_find (csky_opcodes_hash, op_movi);
if (csky_insn.opcode == NULL)
return false;
csky_insn.val[csky_insn.idx - 1] = (1 << mask_val) - 1;
@@ -3747,8 +3766,7 @@ get_operand_value (struct csky_opcode_info *op,
if (mask_val > 0 && mask_val < 16)
{
const char *op_movi = "movi";
- csky_insn.opcode = (struct csky_opcode *)
- str_hash_find (csky_opcodes_hash, op_movi);
+ csky_insn.opcode = str_hash_find (csky_opcodes_hash, op_movi);
if (csky_insn.opcode == NULL)
return false;
csky_insn.val[csky_insn.idx - 1] = (1 << (mask_val + 1)) - 1;
@@ -5251,7 +5269,7 @@ md_pcrel_from_section (fixS * fixP, segT seg)
{
/* If the symbol is undefined or defined in another section
we leave the add number alone for the linker to fix it later. */
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != seg))
return fixP->fx_size;
@@ -5302,7 +5320,7 @@ csky_cons_fix_new (fragS *frag,
reloc = BFD_RELOC_32;
break;
}
- fixP = fix_new_exp (frag, off, (int) len, exp, 0, reloc);
+ fixP = fix_new_exp (frag, off, len, exp, 0, reloc);
if (BFD_RELOC_CKCORE_TLS_IE32 == insn_reloc
|| BFD_RELOC_CKCORE_TLS_GD32 == insn_reloc
|| BFD_RELOC_CKCORE_TLS_LDM32 == insn_reloc)
@@ -5578,25 +5596,25 @@ md_apply_fix (fixS *fixP,
case BFD_RELOC_CKCORE_PCREL_IMM8BY4:
case BFD_RELOC_CKCORE_PCREL_IMM10BY4:
case BFD_RELOC_CKCORE_PCREL_IMM16BY4:
- max = (offsetT) howto->dst_mask;
+ max = howto->dst_mask;
min = 0;
break;
/* lrw16. */
case BFD_RELOC_CKCORE_PCREL_IMM7BY4:
if (do_extend_lrw)
- max = (offsetT)((1 << (howto->bitsize + 1)) - 2);
+ max = ((valueT) 1 << (howto->bitsize + 1)) - 2;
else
- max = (offsetT)((1 << howto->bitsize) - 1);
+ max = ((valueT) 1 << howto->bitsize) - 1;
min = 0;
break;
/* flrws, flrwd: the offset bits are divided in two parts. */
case BFD_RELOC_CKCORE_PCREL_FLRW_IMM8BY4:
- max = (offsetT)((1 << howto->bitsize) - 1);
+ max = ((valueT) 1 << howto->bitsize) - 1;
min = 0;
break;
/* Offset is signed. */
default:
- max = (offsetT)(howto->dst_mask >> 1);
+ max = howto->dst_mask >> 1;
min = - max - 1;
issigned = 1;
}
@@ -5612,7 +5630,7 @@ md_apply_fix (fixS *fixP,
if (do_extend_lrw && (opcode & 0xfc00) == CSKYV2_INST_LRW16)
val &= 0xff;
else
- val &= issigned ? (offsetT)(howto->dst_mask) : max;
+ val &= issigned ? (offsetT) howto->dst_mask : max;
if (fixP->fx_r_type == BFD_RELOC_CKCORE_PCREL_BLOOP_IMM4BY4)
val = (val & 0xf) << 12;
@@ -6475,8 +6493,7 @@ v1_work_jbsr (void)
{
/* Using jsri instruction. */
const char *name = "jsri";
- csky_insn.opcode = (struct csky_opcode *)
- str_hash_find (csky_opcodes_hash, name);
+ csky_insn.opcode = str_hash_find (csky_opcodes_hash, name);
csky_insn.opcode_idx = 0;
csky_insn.isize = 2;
@@ -6823,8 +6840,7 @@ bool
v2_work_rotlc (void)
{
const char *name = "addc";
- csky_insn.opcode
- = (struct csky_opcode *) str_hash_find (csky_opcodes_hash, name);
+ csky_insn.opcode = str_hash_find (csky_opcodes_hash, name);
csky_insn.opcode_idx = 0;
if (csky_insn.isize == 2)
{
@@ -6861,8 +6877,7 @@ v2_work_bgeni (void)
name = "movih";
val >>= 16;
}
- csky_insn.opcode
- = (struct csky_opcode *) str_hash_find (csky_opcodes_hash, name);
+ csky_insn.opcode = str_hash_find (csky_opcodes_hash, name);
csky_insn.opcode_idx = 0;
csky_insn.val[1] = val;
@@ -6879,8 +6894,7 @@ bool
v2_work_not (void)
{
const char *name = "nor";
- csky_insn.opcode
- = (struct csky_opcode *) str_hash_find (csky_opcodes_hash, name);
+ csky_insn.opcode = str_hash_find (csky_opcodes_hash, name);
csky_insn.opcode_idx = 0;
if (csky_insn.number == 1)
{
@@ -7675,7 +7689,7 @@ csky_cons (int nbytes)
howto->name, nbytes);
else
{
- register char *p = frag_more ((int) nbytes);
+ register char *p = frag_more (nbytes);
int offset = nbytes - size;
fix_new_exp (frag_now,
@@ -7684,7 +7698,7 @@ csky_cons (int nbytes)
}
}
else
- emit_expr (&exp, (unsigned int) nbytes);
+ emit_expr (&exp, nbytes);
if (now_seg == text_section)
poolspan += nbytes;
}
@@ -7847,8 +7861,7 @@ static void
csky_stack_size (int arg ATTRIBUTE_UNUSED)
{
expressionS exp;
- stack_size_entry *sse
- = (stack_size_entry *) xcalloc (1, sizeof (stack_size_entry));
+ stack_size_entry *sse = xcalloc (1, sizeof (stack_size_entry));
expression (&exp);
if (exp.X_op == O_symbol)
diff --git a/gas/config/tc-csky.h b/gas/config/tc-csky.h
index 7e32347..d391084 100644
--- a/gas/config/tc-csky.h
+++ b/gas/config/tc-csky.h
@@ -106,4 +106,4 @@ extern long csky_relax_frag (segT, fragS *, long);
const char * elf32_csky_target_format (void);
#endif
-#endif
+#endif /* TC_CSKY */
diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c
index dd0292a..98d5e8b 100644
--- a/gas/config/tc-d10v.c
+++ b/gas/config/tc-d10v.c
@@ -275,7 +275,7 @@ void
md_begin (void)
{
const char *prev_name = "";
- struct d10v_opcode *opcode;
+ const struct d10v_opcode *opcode;
d10v_hash = str_htab_create ();
/* Insert unique names into hash table. The D10v instruction set
@@ -283,11 +283,11 @@ md_begin (void)
on the operands. This hash table then provides a quick index to
the first opcode with a particular name in the opcode table. */
- for (opcode = (struct d10v_opcode *) d10v_opcodes; opcode->name; opcode++)
+ for (opcode = d10v_opcodes; opcode->name; opcode++)
{
if (strcmp (prev_name, opcode->name))
{
- prev_name = (char *) opcode->name;
+ prev_name = opcode->name;
str_hash_insert (d10v_hash, opcode->name, opcode, 0);
}
}
@@ -325,7 +325,7 @@ postfix (char *p)
}
static bfd_reloc_code_real_type
-get_reloc (struct d10v_operand *op)
+get_reloc (const struct d10v_operand *op)
{
int bits = op->bits;
@@ -564,7 +564,7 @@ build_insn (struct d10v_opcode *opcode,
else
{
fixups->fix[fixups->fc].reloc =
- get_reloc ((struct d10v_operand *) &d10v_operands[opcode->operands[i]]);
+ get_reloc (&d10v_operands[opcode->operands[i]]);
/* Check that an immediate was passed to ops that expect one. */
if ((flags & OPERAND_NUM)
@@ -1428,7 +1428,7 @@ do_assemble (char *str, struct d10v_opcode **opcode)
return -1;
/* Find the first opcode with the proper name. */
- *opcode = (struct d10v_opcode *) str_hash_find (d10v_hash, name);
+ *opcode = str_hash_find (d10v_hash, name);
if (*opcode == NULL)
return -1;
@@ -1454,7 +1454,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("reloc %d not supported by object file format"),
@@ -1481,7 +1481,7 @@ md_estimate_size_before_relax (fragS *fragp ATTRIBUTE_UNUSED,
long
md_pcrel_from_section (fixS *fixp, segT sec)
{
- if (fixp->fx_addsy != (symbolS *) NULL
+ if (fixp->fx_addsy != NULL
&& (!S_IS_DEFINED (fixp->fx_addsy)
|| (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
return 0;
@@ -1497,11 +1497,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
int op_type;
int left = 0;
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
/* We don't actually support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
op_type = fixP->fx_r_type;
@@ -1521,13 +1521,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
}
else
fixP->fx_r_type =
- get_reloc ((struct d10v_operand *) &d10v_operands[op_type]);
+ get_reloc (&d10v_operands[op_type]);
}
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again. */
where = fixP->fx_frag->fr_literal + fixP->fx_where;
- insn = bfd_getb32 ((unsigned char *) where);
+ insn = bfd_getb32 (where);
switch (fixP->fx_r_type)
{
@@ -1551,13 +1551,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
/* Instruction addresses are always right-shifted by 2. */
value >>= AT_WORD_RIGHT_SHIFT;
if (fixP->fx_size == 2)
- bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb16 (value, where);
else
{
struct d10v_opcode *rep, *repi;
- rep = (struct d10v_opcode *) str_hash_find (d10v_hash, "rep");
- repi = (struct d10v_opcode *) str_hash_find (d10v_hash, "repi");
+ rep = str_hash_find (d10v_hash, "rep");
+ repi = str_hash_find (d10v_hash, "repi");
if ((insn & FM11) == FM11
&& ((repi != NULL
&& (insn & repi->mask) == (unsigned) repi->opcode)
@@ -1569,14 +1569,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
fixP->fx_line);
insn =
d10v_insert_operand (insn, op_type, (offsetT) value, left, fixP);
- bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
+ bfd_putb32 (insn, where);
}
break;
case BFD_RELOC_32:
- bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb32 (value, where);
break;
case BFD_RELOC_16:
- bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb16 (value, where);
break;
case BFD_RELOC_8:
*where = value;
diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c
index c3c58d1..bfa4adf 100644
--- a/gas/config/tc-d30v.c
+++ b/gas/config/tc-d30v.c
@@ -306,11 +306,11 @@ md_section_align (asection *seg, valueT addr)
void
md_begin (void)
{
- struct d30v_opcode *opcode;
+ const struct d30v_opcode *opcode;
d30v_hash = str_htab_create ();
/* Insert opcode names into a hash table. */
- for (opcode = (struct d30v_opcode *) d30v_opcode_table; opcode->name; opcode++)
+ for (opcode = d30v_opcode_table; opcode->name; opcode++)
str_hash_insert (d30v_hash, opcode->name, opcode, 0);
fixups = &FixUps[0];
@@ -484,8 +484,8 @@ build_insn (struct d30v_insn *opcode, expressionS *opers)
int i, bits, shift, flags;
unsigned long number, id = 0;
long long insn;
- struct d30v_opcode *op = opcode->op;
- struct d30v_format *form = opcode->form;
+ const struct d30v_opcode *op = opcode->op;
+ const struct d30v_format *form = opcode->form;
insn =
opcode->ecc << 28 | op->op1 << 25 | op->op2 << 20 | form->modifier << 18;
@@ -682,8 +682,8 @@ parallel_ok (struct d30v_insn *op1,
int i, j, shift, regno, bits, ecc;
unsigned long flags, mask, flags_set1, flags_set2, flags_used1, flags_used2;
unsigned long ins, mod_reg[2][3], used_reg[2][3], flag_reg[2];
- struct d30v_format *f;
- struct d30v_opcode *op;
+ const struct d30v_format *f;
+ const struct d30v_opcode *op;
/* Section 4.3: Both instructions must not be IU or MU only. */
if ((op1->op->unit == IU && op2->op->unit == IU)
@@ -1122,14 +1122,14 @@ write_2_short (struct d30v_insn *opcode1,
It must look at all formats for an opcode and use the operands
to choose the correct one. Return NULL on error. */
-static struct d30v_format *
-find_format (struct d30v_opcode *opcode,
+static const struct d30v_format *
+find_format (const struct d30v_opcode *opcode,
expressionS myops[],
int fsize,
int cmp_hack)
{
int match, opcode_index, i = 0, j, k;
- struct d30v_format *fm;
+ const struct d30v_format *fm;
if (opcode == NULL)
return NULL;
@@ -1145,7 +1145,7 @@ find_format (struct d30v_opcode *opcode,
if (fsize == FORCE_LONG && opcode_index < LONG)
continue;
- fm = (struct d30v_format *) &d30v_format_table[opcode_index];
+ fm = &d30v_format_table[opcode_index];
k = opcode_index;
while (fm->form == opcode_index)
{
@@ -1266,7 +1266,7 @@ find_format (struct d30v_opcode *opcode,
return fm;
}
- fm = (struct d30v_format *) &d30v_format_table[++k];
+ fm = &d30v_format_table[++k];
}
}
return NULL;
@@ -1339,7 +1339,7 @@ do_assemble (char *str,
if (startswith (name, "cmp"))
{
int p, i;
- char **d30v_str = (char **) d30v_cc_names;
+ const char **d30v_str = d30v_cc_names;
if (name[3] == 'u')
p = 4;
@@ -1387,7 +1387,7 @@ do_assemble (char *str,
}
/* Find the first opcode with the proper name. */
- opcode->op = (struct d30v_opcode *) str_hash_find (d30v_hash, name);
+ opcode->op = str_hash_find (d30v_hash, name);
if (opcode->op == NULL)
{
as_bad (_("unknown opcode: %s"), name);
@@ -1785,7 +1785,7 @@ md_estimate_size_before_relax (fragS *fragp ATTRIBUTE_UNUSED,
long
md_pcrel_from_section (fixS *fixp, segT sec)
{
- if (fixp->fx_addsy != (symbolS *) NULL
+ if (fixp->fx_addsy != NULL
&& (!S_IS_DEFINED (fixp->fx_addsy)
|| (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
return 0;
@@ -1888,7 +1888,7 @@ d30v_cons_align (int size)
++log_size;
if (d30v_current_align < log_size)
- d30v_align (log_size, (char *) NULL, NULL);
+ d30v_align (log_size, NULL, NULL);
else if (d30v_current_align > log_size)
d30v_current_align = log_size;
d30v_last_label = NULL;
@@ -1901,37 +1901,37 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
unsigned long insn, insn2;
long value = *valP;
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
/* We don't support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again. */
where = fixP->fx_frag->fr_literal + fixP->fx_where;
- insn = bfd_getb32 ((unsigned char *) where);
+ insn = bfd_getb32 (where);
switch (fixP->fx_r_type)
{
case BFD_RELOC_8:
- *(unsigned char *) where = value;
+ *where = value;
break;
case BFD_RELOC_16:
- bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb16 (value, where);
break;
case BFD_RELOC_64:
- bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
- bfd_putb32 (0, ((unsigned char *) where) + 4);
+ bfd_putb32 (value, where);
+ bfd_putb32 (0, where + 4);
break;
case BFD_RELOC_D30V_6:
check_size (value, 6, fixP->fx_file, fixP->fx_line);
insn |= value & 0x3F;
- bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
+ bfd_putb32 (insn, where);
break;
case BFD_RELOC_D30V_9_PCREL:
@@ -1944,13 +1944,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
}
check_size (value, 9, fixP->fx_file, fixP->fx_line);
insn |= ((value >> 3) & 0x3F) << 12;
- bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
+ bfd_putb32 (insn, where);
break;
case BFD_RELOC_D30V_15:
check_size (value, 15, fixP->fx_file, fixP->fx_line);
insn |= (value >> 3) & 0xFFF;
- bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
+ bfd_putb32 (insn, where);
break;
case BFD_RELOC_D30V_15_PCREL:
@@ -1963,13 +1963,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
}
check_size (value, 15, fixP->fx_file, fixP->fx_line);
insn |= (value >> 3) & 0xFFF;
- bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
+ bfd_putb32 (insn, where);
break;
case BFD_RELOC_D30V_21:
check_size (value, 21, fixP->fx_file, fixP->fx_line);
insn |= (value >> 3) & 0x3FFFF;
- bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
+ bfd_putb32 (insn, where);
break;
case BFD_RELOC_D30V_21_PCREL:
@@ -1982,29 +1982,29 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
}
check_size (value, 21, fixP->fx_file, fixP->fx_line);
insn |= (value >> 3) & 0x3FFFF;
- bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
+ bfd_putb32 (insn, where);
break;
case BFD_RELOC_D30V_32:
- insn2 = bfd_getb32 ((unsigned char *) where + 4);
+ insn2 = bfd_getb32 (where + 4);
insn |= (value >> 26) & 0x3F; /* Top 6 bits. */
insn2 |= ((value & 0x03FC0000) << 2); /* Next 8 bits. */
insn2 |= value & 0x0003FFFF; /* Bottom 18 bits. */
- bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
- bfd_putb32 ((bfd_vma) insn2, (unsigned char *) where + 4);
+ bfd_putb32 (insn, where);
+ bfd_putb32 (insn2, where + 4);
break;
case BFD_RELOC_D30V_32_PCREL:
- insn2 = bfd_getb32 ((unsigned char *) where + 4);
+ insn2 = bfd_getb32 (where + 4);
insn |= (value >> 26) & 0x3F; /* Top 6 bits. */
insn2 |= ((value & 0x03FC0000) << 2); /* Next 8 bits. */
insn2 |= value & 0x0003FFFF; /* Bottom 18 bits. */
- bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
- bfd_putb32 ((bfd_vma) insn2, (unsigned char *) where + 4);
+ bfd_putb32 (insn, where);
+ bfd_putb32 (insn2, where + 4);
break;
case BFD_RELOC_32:
- bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb32 (value, where);
break;
default:
diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c
index 8d830fe..69c8f49 100644
--- a/gas/config/tc-dlx.c
+++ b/gas/config/tc-dlx.c
@@ -187,7 +187,7 @@ is_ldst_registers (char *name)
/* The first character of the register name got to be either %, $, r of R. */
if ((ptr[0] == '%' || ptr[0] == '$' || ptr[0] == 'r' || ptr[0] == 'R')
- && ISDIGIT ((unsigned char) ptr[1]))
+ && ISDIGIT (ptr[1]))
return 1;
/* Now check the software register representation. */
@@ -539,7 +539,7 @@ static char *
fix_ld_st_operand (unsigned long opcode, char* str)
{
/* Check the opcode. */
- switch ((int) opcode)
+ switch (opcode)
{
case LBOP:
case LBUOP:
@@ -616,7 +616,7 @@ parse_operand (char *s, expressionS *operandp)
/* Check for the % and $ register representation */
if ((s[0] == '%' || s[0] == '$' || s[0] == 'r' || s[0] == 'R')
- && ISDIGIT ((unsigned char) s[1]))
+ && ISDIGIT (s[1]))
{
/* We have a numeric register expression. No biggy. */
s += 1;
@@ -683,7 +683,7 @@ machine_ip (char *str)
}
/* Hash the opcode, insn will have the string from opcode table. */
- if ((insn = (struct machine_opcode *) str_hash_find (op_hash, str)) == NULL)
+ if ((insn = str_hash_find (op_hash, str)) == NULL)
{
/* Handle the ret and return macro here. */
if ((strcmp (str, "ret") == 0) || (strcmp (str, "return") == 0))
@@ -1124,7 +1124,7 @@ md_operand (expressionS* expressionP)
{
/* Check for the #number representation */
if (input_line_pointer[0] == '#' &&
- ISDIGIT ((unsigned char) input_line_pointer[1]))
+ ISDIGIT (input_line_pointer[1]))
{
/* We have a numeric number expression. No biggy. */
input_line_pointer += 1; /* Skip # */
diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c
index c8947c8..be23d15 100644
--- a/gas/config/tc-epiphany.c
+++ b/gas/config/tc-epiphany.c
@@ -154,7 +154,7 @@ md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & -(1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
@@ -248,10 +248,10 @@ epiphany_PIC_related_p (symbolS *sym)
void
epiphany_apply_fix (fixS *fixP, valueT *valP, segT seg)
{
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
- if (((int) fixP->fx_r_type < (int) BFD_RELOC_UNUSED)
+ if ((fixP->fx_r_type < BFD_RELOC_UNUSED)
&& fixP->fx_done)
{
/* Install EPIPHANY-dependent relocations HERE because nobody else
@@ -314,7 +314,7 @@ static const unsigned char nop_pattern[] = { 0xa2, 0x01 };
void
epiphany_handle_align (fragS *fragp)
{
- int bytes, fix;
+ int bytes;
char *p;
if (fragp->fr_type != rs_align_code)
@@ -322,23 +322,19 @@ epiphany_handle_align (fragS *fragp)
bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
p = fragp->fr_literal + fragp->fr_fix;
- fix = 0;
if (bytes & 1)
{
- fix = 1;
*p++ = 0;
bytes--;
+ fragp->fr_fix++;
}
- if (bytes & 2)
+ if (bytes != 0)
{
+ fragp->fr_var = 2;
memcpy (p, nop_pattern, 2);
- p += 2;
- bytes -= 2;
- fix += 2;
}
- fragp->fr_fix += fix;
}
/* Read a comma separated incrementing list of register names
@@ -946,7 +942,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
fixP->fx_r_type = fixP->fx_cgen.opinfo;
}
- md_number_to_chars (displacement, (valueT) addend, extension + 1);
+ md_number_to_chars (displacement, addend, extension + 1);
fragP->fr_fix += (extension & -2); /* 0,2 or 4 bytes added. */
}
@@ -960,7 +956,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
long
md_pcrel_from_section (fixS *fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (!S_IS_DEFINED (fixP->fx_addsy)
|| (S_GET_SEGMENT (fixP->fx_addsy) != sec)
|| S_IS_EXTERNAL (fixP->fx_addsy)
@@ -1029,10 +1025,10 @@ epiphany_fix_adjustable (fixS *fixP)
{
bfd_reloc_code_real_type reloc_type;
- if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
{
const CGEN_INSN *insn = fixP->fx_cgen.insn;
- int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+ int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
const CGEN_OPERAND *operand =
cgen_operand_lookup_by_num (gas_cgen_cpu_desc, opindex);
diff --git a/gas/config/tc-epiphany.h b/gas/config/tc-epiphany.h
index dde6733..78adcd6 100644
--- a/gas/config/tc-epiphany.h
+++ b/gas/config/tc-epiphany.h
@@ -74,6 +74,7 @@ extern int epiphany_cgen_parse_fix_exp (int, expressionS *);
#define HANDLE_ALIGN(s, f) epiphany_handle_align (f)
extern void epiphany_handle_align (fragS *);
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (1 + 2)
#define TARGET_FORMAT "elf32-epiphany"
diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c
index 2b135f4..e120ca5 100644
--- a/gas/config/tc-fr30.c
+++ b/gas/config/tc-fr30.c
@@ -156,7 +156,7 @@ md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & -(1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
symbolS *
@@ -272,7 +272,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
long
md_pcrel_from_section (fixS * fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
/* The symbol is undefined (or is defined but not in this section).
diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c
index 2c33c90..900fb4a 100644
--- a/gas/config/tc-frv.c
+++ b/gas/config/tc-frv.c
@@ -175,7 +175,7 @@ static flagword frv_flags = DEFAULT_FLAGS | DEFAULT_FDPIC;
static int frv_user_set_flags_p = 0;
static int frv_pic_p = 0;
-static const char *frv_pic_flag = DEFAULT_FDPIC ? "-mfdpic" : (const char *)0;
+static const char *frv_pic_flag = DEFAULT_FDPIC ? "-mfdpic" : NULL;
/* Print tomcat-specific debugging info. */
static int tomcat_debug = 0;
@@ -1226,7 +1226,7 @@ valueT
md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & -(1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
symbolS *
@@ -1311,7 +1311,7 @@ long
md_pcrel_from_section (fixS *fixP, segT sec)
{
if (TC_FORCE_RELOCATION (fixP)
- || (fixP->fx_addsy != (symbolS *) NULL
+ || (fixP->fx_addsy != NULL
&& S_GET_SEGMENT (fixP->fx_addsy) != sec))
{
/* If we can't adjust this relocation, or if it references a
@@ -1523,10 +1523,10 @@ frv_fix_adjustable (fixS *fixP)
{
bfd_reloc_code_real_type reloc_type;
- if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
{
const CGEN_INSN *insn = NULL;
- int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+ int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
reloc_type = md_cgen_lookup_reloc (insn, operand, fixP);
}
@@ -1705,7 +1705,7 @@ frv_frob_file_section (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED)
}
else
{
- opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
+ opindex = fixp->fx_r_type - BFD_RELOC_UNUSED;
operand = cgen_operand_lookup_by_num (cd, opindex);
reloc = md_cgen_lookup_reloc (insn, operand, fixp);
}
@@ -1790,7 +1790,7 @@ frv_frob_file_section (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED)
void
frv_frob_file (void)
{
- bfd_map_over_sections (stdoutput, frv_frob_file_section, (void *) 0);
+ bfd_map_over_sections (stdoutput, frv_frob_file_section, NULL);
}
void
diff --git a/gas/config/tc-frv.h b/gas/config/tc-frv.h
index 21e3bac..609ed6f 100644
--- a/gas/config/tc-frv.h
+++ b/gas/config/tc-frv.h
@@ -98,7 +98,7 @@ extern void frv_frob_file (void);
code actually happens to run, but this is probably too much effort
for little gain. This code is not meant to be run anyway, so just
emit nops. */
-#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 4)
#define HANDLE_ALIGN(SEC, FRAGP) do \
if ((FRAGP)->fr_type == rs_align_code) \
{ \
diff --git a/gas/config/tc-ft32.c b/gas/config/tc-ft32.c
index 50958d5..7e68e83 100644
--- a/gas/config/tc-ft32.c
+++ b/gas/config/tc-ft32.c
@@ -230,7 +230,7 @@ md_assemble (char *str)
if (nlen == 0)
as_bad (_("can't find opcode "));
- opcode = (ft32_opc_info_t *) str_hash_find (opcode_hash_control, op_start);
+ opcode = str_hash_find (opcode_hash_control, op_start);
*op_end = pend;
if (opcode == NULL)
@@ -530,12 +530,11 @@ static valueT
md_chars_to_number (char * buf, int n)
{
valueT result = 0;
- unsigned char * where = (unsigned char *) buf;
while (n--)
{
result <<= 8;
- result |= (where[n] & 255);
+ result |= (buf[n] & 255);
}
return result;
@@ -581,7 +580,7 @@ md_apply_fix (fixS *fixP ATTRIBUTE_UNUSED,
}
/* We don't actually support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
switch (fixP->fx_r_type)
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index eeee4c8..d7bb329 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -1937,8 +1937,7 @@ md_assemble (char *str)
while (*++slash)
*slash = TOLOWER (*slash);
- instruction = (const struct h8_instruction *)
- str_hash_find (opcode_hash_control, op_start);
+ instruction = str_hash_find (opcode_hash_control, op_start);
if (instruction == NULL)
{
@@ -2224,7 +2223,7 @@ valueT
md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & (-1U << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
void
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index c2a981e..744613f 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -1200,7 +1200,7 @@ fix_new_hppa (fragS *frag,
new_fix = fix_new_exp (frag, where, size, exp, pcrel, r_type);
else
new_fix = fix_new (frag, where, size, add_symbol, offset, pcrel, r_type);
- new_fix->tc_fix_data = (void *) hppa_fix;
+ new_fix->tc_fix_data = hppa_fix;
hppa_fix->fx_r_type = r_type;
hppa_fix->fx_r_field = r_field;
hppa_fix->fx_r_format = r_format;
@@ -1265,8 +1265,7 @@ cons_fix_new_hppa (fragS *frag, int where, int size, expressionS *exp,
hppa_field_selector = e_fsel;
}
- fix_new_hppa (frag, where, size,
- (symbolS *) NULL, (offsetT) 0, exp, 0, rel_type,
+ fix_new_hppa (frag, where, size, NULL, 0, exp, 0, rel_type,
hppa_field_selector, size * 8, 0, 0);
}
@@ -1351,7 +1350,7 @@ tc_gen_reloc (asection *section, fixS *fixp)
if (fixp->fx_addsy == 0)
return &no_relocs;
- hppa_fixp = (struct hppa_fix_struct *) fixp->tc_fix_data;
+ hppa_fixp = fixp->tc_fix_data;
gas_assert (hppa_fixp != 0);
gas_assert (section != 0);
@@ -1447,7 +1446,7 @@ tc_gen_reloc (asection *section, fixS *fixp)
(bfd_reloc_code_real_type) code);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
- gas_assert (reloc->howto && (unsigned int) code == reloc->howto->type);
+ gas_assert (reloc->howto && code == reloc->howto->type);
break;
}
#else /* OBJ_SOM */
@@ -1563,7 +1562,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
if (fragP->fr_type == rs_machine_dependent)
{
- switch ((int) fragP->fr_subtype)
+ switch (fragP->fr_subtype)
{
case 0:
fragP->fr_type = rs_fill;
@@ -1590,7 +1589,7 @@ valueT
md_section_align (asection *segment, valueT size)
{
int align = bfd_section_alignment (segment);
- int align2 = (1 << align) - 1;
+ valueT align2 = ((valueT) 1 << align) - 1;
return (size + align2) & ~align2;
}
@@ -1726,7 +1725,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
fixP->fx_done = 1;
/* There should be a HPPA specific fixup associated with the GAS fixup. */
- hppa_fixP = (struct hppa_fix_struct *) fixP->tc_fix_data;
+ hppa_fixP = fixP->tc_fix_data;
if (hppa_fixP == NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
@@ -3210,7 +3209,7 @@ pa_ip (char *str)
}
/* Look up the opcode in the hash table. */
- if ((insn = (struct pa_opcode *) str_hash_find (op_hash, str)) == NULL)
+ if ((insn = str_hash_find (op_hash, str)) == NULL)
{
as_bad (_("Unknown opcode: `%s'"), str);
return;
@@ -5762,7 +5761,7 @@ md_assemble (char *str)
where = frag_more (0);
u = UNWIND_LOW32 (&last_call_info->ci_unwind.descriptor);
fix_new_hppa (frag_now, where - frag_now->fr_literal, 0,
- NULL, (offsetT) 0, NULL,
+ NULL, 0, NULL,
0, R_HPPA_ENTRY, e_fsel, 0, 0, u);
}
#endif
@@ -5786,7 +5785,7 @@ md_assemble (char *str)
/* If necessary output more stuff. */
if (the_insn.reloc != R_HPPA_NONE)
fix_new_hppa (frag_now, (to - frag_now->fr_literal), 4, NULL,
- (offsetT) 0, &the_insn.exp, the_insn.pcrel,
+ 0, &the_insn.exp, the_insn.pcrel,
(int) the_insn.reloc, the_insn.field_selector,
the_insn.format, the_insn.arg_reloc, 0);
@@ -5856,7 +5855,7 @@ pa_brtab (int begin ATTRIBUTE_UNUSED)
char *where = frag_more (0);
fix_new_hppa (frag_now, where - frag_now->fr_literal, 0,
- NULL, (offsetT) 0, NULL,
+ NULL, 0, NULL,
0, begin ? R_HPPA_BEGIN_BRTAB : R_HPPA_END_BRTAB,
e_fsel, 0, 0, 0);
#endif
@@ -5880,7 +5879,7 @@ pa_try (int begin ATTRIBUTE_UNUSED)
the beginning and end of exception handling regions). */
fix_new_hppa (frag_now, where - frag_now->fr_literal, 0,
- NULL, (offsetT) 0, begin ? NULL : &exp,
+ NULL, 0, begin ? NULL : &exp,
0, begin ? R_HPPA_BEGIN_TRY : R_HPPA_END_TRY,
e_fsel, 0, 0, 0);
#endif
@@ -6019,10 +6018,8 @@ pa_build_unwind_subspace (struct call_info *call_info)
/* Relocation info. for start offset of the function. */
md_number_to_chars (p, 0, 4);
- fix_new_hppa (frag_now, p - frag_now->fr_literal, 4,
- symbolP, (offsetT) 0,
- (expressionS *) NULL, 0, reloc,
- e_fsel, 32, 0, 0);
+ fix_new_hppa (frag_now, p - frag_now->fr_literal, 4, symbolP, 0,
+ NULL, 0, reloc, e_fsel, 32, 0, 0);
/* Relocation info. for end offset of the function.
@@ -6033,9 +6030,8 @@ pa_build_unwind_subspace (struct call_info *call_info)
finished with its work. */
md_number_to_chars (p + 4, 0, 4);
fix_new_hppa (frag_now, p + 4 - frag_now->fr_literal, 4,
- call_info->end_symbol, (offsetT) 0,
- (expressionS *) NULL, 0, reloc,
- e_fsel, 32, 0, 0);
+ call_info->end_symbol, 0,
+ NULL, 0, reloc, e_fsel, 32, 0, 0);
/* Dump the descriptor. */
unwind = UNWIND_LOW32 (&call_info->ci_unwind.descriptor);
@@ -6335,8 +6331,7 @@ pa_entry (int unused ATTRIBUTE_UNUSED)
where = frag_more (0);
u = UNWIND_LOW32 (&last_call_info->ci_unwind.descriptor);
fix_new_hppa (frag_now, where - frag_now->fr_literal, 0,
- NULL, (offsetT) 0, NULL,
- 0, R_HPPA_ENTRY, e_fsel, 0, 0, u);
+ NULL, 0, NULL, 0, R_HPPA_ENTRY, e_fsel, 0, 0, u);
}
#endif
}
@@ -6494,8 +6489,7 @@ process_exit (void)
if we split the unwind bits up between the relocations which
denote the entry and exit points. */
fix_new_hppa (frag_now, where - frag_now->fr_literal, 0,
- NULL, (offsetT) 0,
- NULL, 0, R_HPPA_EXIT, e_fsel, 0, 0,
+ NULL, 0, NULL, 0, R_HPPA_EXIT, e_fsel, 0, 0,
UNWIND_HIGH32 (&last_call_info->ci_unwind.descriptor));
#endif
}
@@ -6621,7 +6615,7 @@ pa_type_args (symbolS *symbolP, int is_export)
than BFD understands. This is how we get this information
to the SOM BFD backend. */
#ifdef obj_set_symbol_type
- obj_set_symbol_type (bfdsym, (int) type);
+ obj_set_symbol_type (bfdsym, type);
#else
(void) type;
#endif
@@ -7011,8 +7005,8 @@ pa_procend (int unused ATTRIBUTE_UNUSED)
where = frag_more (0);
u = UNWIND_LOW32 (&last_call_info->ci_unwind.descriptor);
fix_new_hppa (frag_now, where - frag_now->fr_literal, 0,
- NULL, (offsetT) 0, NULL,
- 0, R_HPPA_ENTRY, e_fsel, 0, 0, u);
+ NULL, 0, NULL, 0, R_HPPA_ENTRY, e_fsel,
+ 0, 0, u);
}
#endif
}
@@ -7554,7 +7548,6 @@ pa_subspace (int create_new)
/* Now that all the flags are set, update an existing subspace,
or create a new one. */
if (ssd)
-
current_subspace = update_subspace (space, ss_name, loadable,
code_only, comdat, common,
dup_common, sort, zero, access_ctr,
@@ -7979,7 +7972,7 @@ pa_subsegment_to_subspace (asection *seg, subsegT subseg)
for (subspace_chain = space_chain->sd_subspaces;
subspace_chain;
subspace_chain = subspace_chain->ssd_next)
- if (subspace_chain->ssd_subseg == (int) subseg)
+ if (subspace_chain->ssd_subseg == subseg)
return subspace_chain;
}
}
@@ -8317,7 +8310,7 @@ hppa_fix_adjustable (fixS *fixp)
#endif
struct hppa_fix_struct *hppa_fix;
- hppa_fix = (struct hppa_fix_struct *) fixp->tc_fix_data;
+ hppa_fix = fixp->tc_fix_data;
#ifdef OBJ_ELF
/* LR/RR selectors are implicitly used for a number of different relocation
@@ -8436,14 +8429,14 @@ hppa_force_relocation (struct fix *fixp)
{
struct hppa_fix_struct *hppa_fixp;
- hppa_fixp = (struct hppa_fix_struct *) fixp->tc_fix_data;
+ hppa_fixp = fixp->tc_fix_data;
#ifdef OBJ_SOM
- if (fixp->fx_r_type == (int) R_HPPA_ENTRY
- || fixp->fx_r_type == (int) R_HPPA_EXIT
- || fixp->fx_r_type == (int) R_HPPA_BEGIN_BRTAB
- || fixp->fx_r_type == (int) R_HPPA_END_BRTAB
- || fixp->fx_r_type == (int) R_HPPA_BEGIN_TRY
- || fixp->fx_r_type == (int) R_HPPA_END_TRY
+ if (fixp->fx_r_type == R_HPPA_ENTRY
+ || fixp->fx_r_type == R_HPPA_EXIT
+ || fixp->fx_r_type == R_HPPA_BEGIN_BRTAB
+ || fixp->fx_r_type == R_HPPA_END_BRTAB
+ || fixp->fx_r_type == R_HPPA_BEGIN_TRY
+ || fixp->fx_r_type == R_HPPA_END_TRY
|| (fixp->fx_addsy != NULL && fixp->fx_subsy != NULL
&& (hppa_fixp->segment->flags & SEC_CODE) != 0))
return 1;
@@ -8545,7 +8538,7 @@ pa_vtable_entry (int ignore ATTRIBUTE_UNUSED)
hppa_fix->fx_r_format = 32;
hppa_fix->fx_arg_reloc = 0;
hppa_fix->segment = now_seg;
- new_fix->tc_fix_data = (void *) hppa_fix;
+ new_fix->tc_fix_data = hppa_fix;
new_fix->fx_r_type = (int) R_PARISC_GNU_VTENTRY;
}
}
@@ -8566,7 +8559,7 @@ pa_vtable_inherit (int ignore ATTRIBUTE_UNUSED)
hppa_fix->fx_r_format = 32;
hppa_fix->fx_arg_reloc = 0;
hppa_fix->segment = now_seg;
- new_fix->tc_fix_data = (void *) hppa_fix;
+ new_fix->tc_fix_data = hppa_fix;
new_fix->fx_r_type = (int) R_PARISC_GNU_VTINHERIT;
}
}
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 2c61353..8fb8a7e 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -678,9 +678,13 @@ static int use_big_obj = 0;
/* 1 if generating code for a shared library. */
static int shared = 0;
-unsigned int x86_sframe_cfa_sp_reg;
+const unsigned int x86_sframe_cfa_sp_reg = REG_SP;
/* The other CFA base register for SFrame stack trace info. */
-unsigned int x86_sframe_cfa_fp_reg;
+const unsigned int x86_sframe_cfa_fp_reg = REG_FP;
+/* The return address register for SFrame stack trace info. For AMD64, RA
+ tracking is not needed, but some directives like .cfi_undefined may use
+ RA to indicate the outermost frame. */
+const unsigned int x86_sframe_cfa_ra_reg = REG_RA;
static ginsnS *x86_ginsn_new (const symbolS *, enum ginsn_gen_mode);
#endif
@@ -1544,40 +1548,6 @@ static const unsigned char *const alt64_patt[] = {
alt64_9, alt64_10, alt64_11,alt64_12, alt64_13, alt64_14, alt64_15
};
-/* Genenerate COUNT bytes of NOPs to WHERE from PATT with the maximum
- size of a single NOP instruction MAX_SINGLE_NOP_SIZE. */
-
-static void
-i386_output_nops (char *where, const unsigned char *const *patt,
- int count, int max_single_nop_size)
-
-{
- /* Place the longer NOP first. */
- int last;
- int offset;
- const unsigned char *nops;
-
- if (max_single_nop_size < 1)
- {
- as_fatal (_("i386_output_nops called to generate nops of at most %d bytes!"),
- max_single_nop_size);
- return;
- }
-
- nops = patt[max_single_nop_size - 1];
- last = count % max_single_nop_size;
-
- count -= last;
- for (offset = 0; offset < count; offset += max_single_nop_size)
- memcpy (where + offset, nops, max_single_nop_size);
-
- if (last)
- {
- nops = patt[last - 1];
- memcpy (where + offset, nops, last);
- }
-}
-
static INLINE int
fits_in_imm7 (offsetT num)
{
@@ -1733,20 +1703,14 @@ i386_generate_nops (fragS *fragP, char *where, offsetT count, int limit)
if (limit == 0)
limit = max_single_nop_size;
- if (fragP->fr_type == rs_fill_nop)
+ if (limit > max_single_nop_size || limit < 1)
{
- /* Output NOPs for .nop directive. */
- if (limit > max_single_nop_size)
- {
- as_bad_where (fragP->fr_file, fragP->fr_line,
- _("invalid single nop size: %d "
- "(expect within [0, %d])"),
- limit, max_single_nop_size);
- return;
- }
+ as_bad_where (fragP->fr_file, fragP->fr_line,
+ _("invalid single nop size: %d "
+ "(expect within [0, %d])"),
+ limit, max_single_nop_size);
+ return;
}
- else if (fragP->fr_type != rs_machine_dependent)
- fragP->fr_var = count;
/* Emit a plain NOP first when the last thing we saw may not have been
a proper instruction (e.g. a stand-alone prefix or .byte). */
@@ -1797,8 +1761,34 @@ i386_generate_nops (fragS *fragP, char *where, offsetT count, int limit)
}
}
- /* Generate multiple NOPs. */
- i386_output_nops (where, patt, count, limit);
+ int non_repeat = count % limit;
+ if (non_repeat)
+ {
+ memcpy (where, patt[non_repeat - 1], non_repeat);
+ where += non_repeat;
+ count -= non_repeat;
+ }
+
+ if (fragP->fr_type != rs_machine_dependent)
+ {
+ /* Set up the frag so that everything we have emitted so far is
+ included in fr_fix. The repeating larger nop only needs to
+ be written once to the frag memory. */
+ fragP->fr_fix = where - fragP->fr_literal;
+ if (count != 0)
+ {
+ fragP->fr_var = limit;
+ count = limit;
+ }
+ }
+
+ const unsigned char *nops = patt[limit - 1];
+ while (count)
+ {
+ memcpy (where, nops, limit);
+ where += limit;
+ count -= limit;
+ }
}
static INLINE int
@@ -2497,8 +2487,8 @@ operand_type_check (i386_operand_type t, enum operand_type c)
return 0;
}
-/* Return 1 if there is no conflict in 8bit/16bit/32bit/64bit/80bit size
- between operand GIVEN and opeand WANTED for instruction template T. */
+/* Return 1 if there is no conflict in 8bit/16bit/32bit/64bit size
+ between operand GIVEN and operand WANTED for instruction template T. */
static INLINE int
match_operand_size (const insn_template *t, unsigned int wanted,
@@ -2518,14 +2508,22 @@ match_operand_size (const insn_template *t, unsigned int wanted,
|| (intel_syntax
&& flag_code != CODE_64BIT
&& (t->operand_types[wanted].bitfield.class == Reg
- || t->operand_types[wanted].bitfield.class == Accum
- || t->opcode_modifier.isstring))))
- || (i.types[given].bitfield.tbyte
- && !t->operand_types[wanted].bitfield.tbyte));
+ || t->opcode_modifier.isstring)))));
+}
+
+/* Return 1 if there is no conflict in 80bit size
+ between operand GIVEN and operand WANTED for instruction template T. */
+
+static INLINE int
+match_fp_size (const insn_template *t, unsigned int wanted,
+ unsigned int given)
+{
+ return !i.types[given].bitfield.tbyte
+ || t->operand_types[wanted].bitfield.tbyte;
}
/* Return 1 if there is no conflict in SIMD register between operand
- GIVEN and opeand WANTED for instruction template T. */
+ GIVEN and operand WANTED for instruction template T. */
static INLINE int
match_simd_size (const insn_template *t, unsigned int wanted,
@@ -2542,13 +2540,15 @@ match_simd_size (const insn_template *t, unsigned int wanted,
}
/* Return 1 if there is no conflict in any size between operand GIVEN
- and opeand WANTED for instruction template T. */
+ and operand WANTED for instruction template T. */
static INLINE int
match_mem_size (const insn_template *t, unsigned int wanted,
unsigned int given)
{
return (match_operand_size (t, wanted, given)
+ && (!i.types[given].bitfield.tbyte
+ || t->operand_types[wanted].bitfield.tbyte)
&& !((i.types[given].bitfield.unspecified
&& !i.broadcast.type
&& !i.broadcast.bytes
@@ -2589,49 +2589,61 @@ operand_size_match (const insn_template *t)
&& t->opcode_modifier.jump != JUMP_ABSOLUTE)
return match;
- /* Check memory and accumulator operand size. */
- for (j = 0; j < i.operands; j++)
- {
- /* Instruction templates with only sign-extended 8-bit immediate
- operand also have a second template with full-operand-size
- immediate operand under a different opcode. Don't match the
- first template if sign-extended 8-bit immediate operand should
- be excluded. */
- if (pp.no_imm8s
- && !t->operand_types[j].bitfield.imm8
- && t->operand_types[j].bitfield.imm8s)
- {
- match = 0;
- break;
- }
-
- if (i.types[j].bitfield.class != Reg
- && i.types[j].bitfield.class != RegSIMD
- && t->opcode_modifier.operandconstraint == ANY_SIZE)
- continue;
+ for (j = 0; j < i.imm_operands; j++)
+ /* Instruction templates with only sign-extended 8-bit immediate
+ operand also have a second template with full-operand-size
+ immediate operand under a different opcode. Don't match the
+ first template if sign-extended 8-bit immediate operand should
+ be excluded. */
+ if (pp.no_imm8s
+ && !t->operand_types[j].bitfield.imm8
+ && t->operand_types[j].bitfield.imm8s)
+ {
+ gas_assert (!t->opcode_modifier.d);
+ return 0;
+ }
- if (t->operand_types[j].bitfield.class == Reg
+ /* Check memory and accumulator operand size. */
+ for (; j < i.operands; j++)
+ {
+ if (i.types[j].bitfield.class == Reg
+ && (t->operand_types[j].bitfield.class == Reg
+ || (t->operand_types[j].bitfield.instance == Accum
+ && (t->operand_types[j].bitfield.byte
+ || t->operand_types[j].bitfield.word
+ || t->operand_types[j].bitfield.dword
+ || t->operand_types[j].bitfield.qword)))
&& !match_operand_size (t, j, j))
{
match = 0;
break;
}
- if (t->operand_types[j].bitfield.class == RegSIMD
- && !match_simd_size (t, j, j))
+ if (i.types[j].bitfield.class == RegFP
+ && (t->operand_types[j].bitfield.class == RegFP
+ || (t->operand_types[j].bitfield.instance == Accum
+ && t->operand_types[j].bitfield.tbyte))
+ && !match_fp_size (t, j, j))
{
match = 0;
break;
}
- if (t->operand_types[j].bitfield.instance == Accum
- && (!match_operand_size (t, j, j) || !match_simd_size (t, j, j)))
+ if (i.types[j].bitfield.class == RegSIMD
+ && (t->operand_types[j].bitfield.class == RegSIMD
+ || (t->operand_types[j].bitfield.instance == Accum
+ /* Note: %ymm0, %zmm0, and %tmm0 aren't marked Accum. */
+ && t->operand_types[j].bitfield.xmmword))
+ && !match_simd_size (t, j, j))
{
match = 0;
break;
}
- if ((i.flags[j] & Operand_Mem) && !match_mem_size (t, j, j))
+ if ((i.flags[j] & Operand_Mem)
+ && operand_type_check (t->operand_types[j], anymem)
+ && t->opcode_modifier.operandconstraint != ANY_SIZE
+ && !match_mem_size (t, j, j))
{
match = 0;
break;
@@ -2644,7 +2656,7 @@ operand_size_match (const insn_template *t)
/* Check reverse. */
gas_assert (i.operands >= 2);
- for (j = 0; j < i.operands; j++)
+ for (j = i.imm_operands; j < i.operands; j++)
{
unsigned int given = i.operands - j - 1;
@@ -2655,20 +2667,34 @@ operand_size_match (const insn_template *t)
|| is_cpu (t, CpuAPX_F))
given = j < 2 ? 1 - j : j;
- if (t->operand_types[j].bitfield.class == Reg
+ if (i.types[given].bitfield.class == Reg
+ && (t->operand_types[j].bitfield.class == Reg
+ || (t->operand_types[j].bitfield.instance == Accum
+ && (t->operand_types[j].bitfield.byte
+ || t->operand_types[j].bitfield.word
+ || t->operand_types[j].bitfield.dword
+ || t->operand_types[j].bitfield.qword
+ || t->operand_types[j].bitfield.tbyte)))
&& !match_operand_size (t, j, given))
return match;
- if (t->operand_types[j].bitfield.class == RegSIMD
- && !match_simd_size (t, j, given))
+ if (i.types[given].bitfield.class == RegFP
+ && (t->operand_types[j].bitfield.class == RegFP
+ || (t->operand_types[j].bitfield.instance == Accum
+ && t->operand_types[j].bitfield.tbyte))
+ && !match_fp_size (t, j, given))
return match;
- if (t->operand_types[j].bitfield.instance == Accum
- && (!match_operand_size (t, j, given)
- || !match_simd_size (t, j, given)))
+ /* No need to check for Accum here: There are no such templates with D
+ set. */
+ if (i.types[given].bitfield.class == RegSIMD
+ && t->operand_types[j].bitfield.class == RegSIMD
+ && !match_simd_size (t, j, given))
return match;
- if ((i.flags[given] & Operand_Mem) && !match_mem_size (t, j, given))
+ if ((i.flags[given] & Operand_Mem)
+ && operand_type_check (t->operand_types[j], anymem)
+ && !match_mem_size (t, j, given))
return match;
}
@@ -2695,6 +2721,23 @@ operand_type_match (i386_operand_type overlap,
if (operand_type_all_zero (&temp))
goto mismatch;
+ /* When a (register) instance is expected, operand size needs checking
+ to disambiguate. */
+ if (overlap.bitfield.instance != InstanceNone
+ && !overlap.bitfield.byte
+ && !overlap.bitfield.word
+ && !overlap.bitfield.dword
+ && !overlap.bitfield.qword
+ && !overlap.bitfield.tbyte
+ && !overlap.bitfield.xmmword
+ && !overlap.bitfield.ymmword
+ && !overlap.bitfield.zmmword
+ && !overlap.bitfield.tmmword)
+ {
+ gas_assert (overlap.bitfield.class == ClassNone);
+ goto mismatch;
+ }
+
if (given.bitfield.baseindex == overlap.bitfield.baseindex)
return 1;
@@ -2934,7 +2977,7 @@ offset_in_range (offsetT val, int size)
default: abort ();
}
- if ((val & ~mask) != 0 && (-val & ~mask) != 0)
+ if ((val & ~mask) != 0 && (-(addressT) val & ~mask) != 0)
as_warn (_("0x%" PRIx64 " shortened to 0x%" PRIx64),
(uint64_t) val, (uint64_t) (val & mask));
@@ -3577,14 +3620,14 @@ md_begin (void)
if (regtab->reg_type.bitfield.instance == Accum)
reg_eax = regtab;
}
- else if (regtab->reg_type.bitfield.tbyte)
- {
- /* There's no point inserting st(<N>) in the hash table, as
- parentheses aren't included in register_chars[] anyway. */
- if (regtab->reg_type.bitfield.instance != Accum)
- continue;
- reg_st0 = regtab;
- }
+ break;
+
+ case RegFP:
+ /* There's no point inserting st(<N>) in the hash table, as
+ parentheses aren't included in register_chars[] anyway. */
+ if (regtab->reg_type.bitfield.instance != Accum)
+ continue;
+ reg_st0 = regtab;
break;
case SReg:
@@ -3650,13 +3693,9 @@ md_begin (void)
#if defined (OBJ_COFF) && defined (TE_PE)
x86_dwarf2_return_column = 32;
#else
- x86_dwarf2_return_column = 16;
+ x86_dwarf2_return_column = REG_RA;
#endif
x86_cie_data_alignment = -8;
-#ifdef OBJ_ELF
- x86_sframe_cfa_sp_reg = REG_SP;
- x86_sframe_cfa_fp_reg = REG_FP;
-#endif
}
else
{
@@ -3719,6 +3758,7 @@ pi (const char *line, i386_insn *x)
pt (x->types[j]);
fprintf (stdout, "\n");
if (x->types[j].bitfield.class == Reg
+ || x->types[j].bitfield.class == RegFP
|| x->types[j].bitfield.class == RegMMX
|| x->types[j].bitfield.class == RegSIMD
|| x->types[j].bitfield.class == RegMask
@@ -3827,7 +3867,7 @@ const type_names[] =
{ { .bitfield = { .class = RegCR } }, "control reg" },
{ { .bitfield = { .class = RegTR } }, "test reg" },
{ { .bitfield = { .class = RegDR } }, "debug reg" },
- { { .bitfield = { .class = Reg, .tbyte = 1 } }, "FReg" },
+ { { .bitfield = { .class = RegFP, .tbyte = 1 } }, "FReg" },
{ { .bitfield = { .instance = Accum, .tbyte = 1 } }, "FAcc" },
{ { .bitfield = { .class = SReg } }, "SReg" },
{ { .bitfield = { .class = RegMMX } }, "rMMX" },
@@ -7090,12 +7130,14 @@ i386_assemble (char *line)
swap_operands ();
/* The order of the immediates should be reversed for 2-immediates EXTRQ
- and INSERTQ instructions. Also UWRMSR wants its immediate to be in the
- "canonical" place (first), despite it appearing last (in AT&T syntax, or
- because of the swapping above) in the incoming set of operands. */
+ and INSERTQ instructions. Also OUT, UWRMSR, and WRMSRNS want their
+ immediate to be in the "canonical" place (first), despite it appearing
+ last (in AT&T syntax, or because of the swapping above) in the incoming
+ set of operands. */
if ((i.imm_operands == 2
&& (t->mnem_off == MN_extrq || t->mnem_off == MN_insertq))
- || ((t->mnem_off == MN_uwrmsr || t->mnem_off == MN_wrmsrns)
+ || ((t->mnem_off == MN_out || t->mnem_off == MN_uwrmsr
+ || t->mnem_off == MN_wrmsrns)
&& i.imm_operands && i.operands > i.imm_operands))
swap_2_operands (0, 1);
@@ -7110,11 +7152,8 @@ i386_assemble (char *line)
|| t->mnem_off == MN_rdmsr
|| t->mnem_off == MN_wrmsrns)
{
- for (j = 0; j < i.operands; j++)
- {
- if (operand_type_check(i.types[j], imm))
- i.types[j] = smallest_imm_type (i.op[j].imms->X_add_number);
- }
+ for (j = 0; j < i.imm_operands; j++)
+ i.types[j] = smallest_imm_type (i.op[j].imms->X_add_number);
}
else
optimize_imm ();
@@ -7454,6 +7493,8 @@ i386_assemble (char *line)
/* Update operand types and check extended states. */
for (j = 0; j < i.operands; j++)
{
+ enum operand_class class = i.types[j].bitfield.class;
+
i.types[j] = operand_type_and (i.types[j], i.tm.operand_types[j]);
switch (i.tm.operand_types[j].bitfield.class)
{
@@ -7478,6 +7519,9 @@ i386_assemble (char *line)
else if (i.tm.operand_types[j].bitfield.xmmword)
i.xstate |= xstate_xmm;
break;
+ case ClassNone:
+ i.types[j].bitfield.class = class;
+ break;
}
}
@@ -8428,7 +8472,7 @@ optimize_disp (const insn_template *t)
&& (!t->opcode_modifier.jump
|| i.jumpabsolute || i.types[0].bitfield.baseindex))
{
- for (op = 0; op < i.operands; ++op)
+ for (op = i.imm_operands; op < i.operands; ++op)
{
const expressionS *exp = i.op[op].disps;
@@ -8769,7 +8813,7 @@ check_VecOperands (const insn_template *t)
unsigned int j;
type.bitfield.baseindex = 1;
- for (j = 0; j < i.operands; ++j)
+ for (j = i.imm_operands; j < i.operands; ++j)
{
if (j != op
&& !operand_type_register_match(i.types[j],
@@ -8785,7 +8829,7 @@ check_VecOperands (const insn_template *t)
else if (t->opcode_modifier.broadcast && i.mem_operands)
{
/* Find memory operand. */
- for (op = 0; op < i.operands; op++)
+ for (op = i.imm_operands; op < i.operands; op++)
if (i.flags[op] & Operand_Mem)
break;
gas_assert (op < i.operands);
@@ -8894,7 +8938,7 @@ check_VecOperands (const insn_template *t)
const i386_operand_type *type = NULL, *fallback = NULL;
i.memshift = 0;
- for (op = 0; op < i.operands; op++)
+ for (op = i.imm_operands; op < i.operands; op++)
if (i.flags[op] & Operand_Mem)
{
if (t->opcode_modifier.evex == EVEXLIG)
@@ -8936,7 +8980,7 @@ check_VecOperands (const insn_template *t)
i.memshift = -1;
}
- for (op = 0; op < i.operands; op++)
+ for (op = i.imm_operands; op < i.operands; op++)
if (operand_type_check (i.types[op], disp)
&& i.op[op].disps->X_op == O_constant)
{
@@ -9030,7 +9074,7 @@ check_EgprOperands (const insn_template *t)
if (!t->opcode_modifier.noegpr)
return false;
- for (unsigned int op = 0; op < i.operands; op++)
+ for (unsigned int op = i.imm_operands; op < i.operands; op++)
{
if (i.types[op].bitfield.class != Reg)
continue;
@@ -9092,7 +9136,7 @@ check_APX_operands (const insn_template *t)
static bool
check_Rex_required (void)
{
- for (unsigned int op = 0; op < i.operands; op++)
+ for (unsigned int op = i.imm_operands; op < i.operands; op++)
{
if (i.types[op].bitfield.class != Reg)
continue;
@@ -9364,7 +9408,10 @@ match_template (char mnem_suffix)
{
case 1:
if (!operand_type_match (overlap0, i.types[0]))
- continue;
+ {
+ specific_error = progress (i.error);
+ continue;
+ }
/* Allow the ModR/M encoding to be requested by using the {load} or
{store} pseudo prefix on an applicable insn. */
@@ -10402,7 +10449,7 @@ process_suffix (const insn_template *t)
else
need = flag_code == CODE_64BIT ? need_qword : need_word;
- for (op = 0; op < i.operands; op++)
+ for (op = i.imm_operands; op < i.operands; op++)
{
if (i.types[op].bitfield.class != Reg)
continue;
@@ -10734,7 +10781,7 @@ process_operands (void)
unnecessary segment overrides. */
const reg_entry *default_seg = NULL;
- for (unsigned int j = 0; j < i.operands; j++)
+ for (unsigned int j = i.imm_operands; j < i.operands; j++)
if (i.types[j].bitfield.instance != InstanceNone)
i.reg_operands--;
@@ -10797,8 +10844,7 @@ process_operands (void)
and 3 sources. */
for (j = i.operands; j > 0; j--)
copy_operand (j, j - 1);
- i.op[0].regs
- = (const reg_entry *) str_hash_find (reg_hash, "xmm0");
+ i.op[0].regs = str_hash_find (reg_hash, "xmm0");
i.types[0] = regxmm;
i.tm.operand_types[0] = regxmm;
@@ -11362,8 +11408,8 @@ build_modrm_byte (void)
i.op[op].disps = exp;
exp->X_op = O_constant;
exp->X_add_number = 0;
- exp->X_add_symbol = (symbolS *) 0;
- exp->X_op_symbol = (symbolS *) 0;
+ exp->X_add_symbol = NULL;
+ exp->X_op_symbol = NULL;
}
}
else
@@ -11968,7 +12014,7 @@ x86_sframe_cfa_ra_offset (void)
return (offsetT) -8;
}
-/* The abi/arch indentifier for SFrame. */
+/* The abi/arch identifier for SFrame. */
unsigned char
x86_sframe_get_abi_arch (void)
{
@@ -15065,9 +15111,8 @@ i386_index_check (const char *operand_string)
|| ((!i.mem_operands != !intel_syntax)
&& t->operand_types[1].bitfield.baseindex))
op = 1;
- expected_reg
- = (const reg_entry *) str_hash_find (reg_hash,
- di_si[addr_mode][op == es_op]);
+ expected_reg = str_hash_find (reg_hash,
+ di_si[addr_mode][op == es_op]);
}
else
{
@@ -16394,7 +16439,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED,
}
/* Now put displacement after opcode. */
md_number_to_chars ((char *) where_to_put_displacement,
- (valueT) (displacement_from_opcode_start - extension),
+ displacement_from_opcode_start - extension,
DISP_SIZE_FROM_RELAX_STATE (fragP->fr_subtype));
fragP->fr_fix += extension;
}
@@ -16780,16 +16825,16 @@ parse_real_register (const char *reg_string, char **end_op)
while ((*p++ = register_chars[(unsigned char) *s]) != '\0')
{
if (p >= reg_name_given + MAX_REG_NAME_SIZE)
- return (const reg_entry *) NULL;
+ return NULL;
s++;
}
if (is_part_of_name (*s))
- return (const reg_entry *) NULL;
+ return NULL;
*end_op = (char *) s;
- r = (const reg_entry *) str_hash_find (reg_hash, reg_name_given);
+ r = str_hash_find (reg_hash, reg_name_given);
/* Handle floating point regs, allowing spaces in the (i) part. */
if (r == reg_st0)
@@ -16798,7 +16843,7 @@ parse_real_register (const char *reg_string, char **end_op)
&& !cpu_arch_flags.bitfield.cpu287
&& !cpu_arch_flags.bitfield.cpu387
&& !allow_pseudo_reg)
- return (const reg_entry *) NULL;
+ return NULL;
if (is_whitespace (*s))
++s;
@@ -16821,7 +16866,7 @@ parse_real_register (const char *reg_string, char **end_op)
}
}
/* We have "%st(" then garbage. */
- return (const reg_entry *) NULL;
+ return NULL;
}
}
@@ -18081,7 +18126,7 @@ md_section_align (segT segment, valueT size)
work. */
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & (-((valueT) 1 << align)));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
#endif
@@ -18103,7 +18148,7 @@ s_bss (int ignore ATTRIBUTE_UNUSED)
int temp;
temp = get_absolute_expression ();
- subseg_set (bss_section, (subsegT) temp);
+ subseg_set (bss_section, temp);
demand_empty_rest_of_line ();
}
@@ -18283,7 +18328,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
_("symbol size computation overflow"));
fixp->fx_addsy = NULL;
fixp->fx_subsy = NULL;
- md_apply_fix (fixp, (valueT *) &value, NULL);
+ md_apply_fix (fixp, &value, NULL);
return NULL;
}
if (!fixp->fx_addsy || fixp->fx_subsy)
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index 3fb7920..641596d 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -230,9 +230,6 @@ if ((n) \
goto around; \
}
-#define MAX_MEM_FOR_RS_ALIGN_CODE \
- (alignment ? ((size_t) 1 << alignment) - 1 : (size_t) 1)
-
extern void i386_cons_align (int);
#define md_cons_align(nbytes) i386_cons_align (nbytes)
@@ -379,17 +376,43 @@ extern void i386_generate_nops (fragS *, char *, offsetT, int);
#define md_generate_nops(frag, where, amount, control) \
i386_generate_nops ((frag), (where), (amount), (control))
-#define HANDLE_ALIGN(sec, fragP) \
+#define HANDLE_ALIGN(sec, fragP) \
if (fragP->fr_type == rs_align_code) \
{ \
offsetT __count = (fragP->fr_next->fr_address \
- fragP->fr_address \
- fragP->fr_fix); \
- if (__count > 0 \
- && (unsigned int) __count <= fragP->tc_frag_data.max_bytes) \
- md_generate_nops (fragP, fragP->fr_literal + fragP->fr_fix, \
- __count, 0); \
+ if (__count > 0) \
+ { \
+ know (fragP->tc_frag_data.max_bytes >= (valueT) __count \
+ || (fragP->tc_frag_data.max_bytes \
+ >= MAX_MEM_FOR_RS_ALIGN_CODE (fragP->fr_offset, \
+ fragP->fr_subtype))); \
+ md_generate_nops (fragP, fragP->fr_literal + fragP->fr_fix, \
+ __count, 0); \
+ } \
}
+/* Possible plain nop, branch, twice largest nop less 1.
+ Yes, the branch might be one byte longer in CODE_16BIT but then the
+ largest nop is smaller. */
+#define MAX_MEM_FOR_RS_SPACE_NOP (1 + 5 + 2 * 15 - 1)
+
+static inline unsigned int
+max_mem_for_rs_align_code (unsigned int p2align, unsigned int max)
+{
+ unsigned int bytes = 1;
+ if (p2align != 0)
+ {
+ bytes = MAX_MEM_FOR_RS_SPACE_NOP;
+ if (bytes > (1ull << p2align) - 1)
+ bytes = (1ull << p2align) - 1;
+ if (max != 0 && bytes > max)
+ bytes = max;
+ }
+ return bytes;
+}
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) \
+ max_mem_for_rs_align_code (p2align, max)
/* We want .cfi_* pseudo-ops for generating unwind info. */
#define TARGET_USE_CFIPOP 1
@@ -413,6 +436,9 @@ extern void tc_x86_frame_initial_instructions (void);
#define REG_FP 6
/* DWARF register number of the stack-pointer register in 64-bit mode. */
#define REG_SP 7
+/* DWARF register number of the (pseudo) return address register in 64-bit
+ mode. This is the same as reg RIP in i386-reg.tbl. */
+#define REG_RA 16
#define md_elf_section_type(str,len) i386_elf_section_type (str, len)
extern int i386_elf_section_type (const char *, size_t);
@@ -455,13 +481,19 @@ extern bool x86_support_sframe_p (void);
#define support_sframe_p x86_support_sframe_p
/* The stack pointer DWARF register number for SFrame CFA tracking. */
-extern unsigned int x86_sframe_cfa_sp_reg;
+extern const unsigned int x86_sframe_cfa_sp_reg;
#define SFRAME_CFA_SP_REG x86_sframe_cfa_sp_reg
/* The frame pointer DWARF register number for SFrame CFA and FP tracking. */
-extern unsigned int x86_sframe_cfa_fp_reg;
+extern const unsigned int x86_sframe_cfa_fp_reg;
#define SFRAME_CFA_FP_REG x86_sframe_cfa_fp_reg
+/* The return address DWARF register number for SFrame purposes. Although for
+ AMD64, RA tracking is disabled, specific constructs, like for indicating
+ the _start function, may use it. */
+extern const unsigned int x86_sframe_cfa_ra_reg;
+#define SFRAME_CFA_RA_REG x86_sframe_cfa_ra_reg
+
/* Whether SFrame return address tracking is needed. */
extern bool x86_sframe_ra_tracking_p (void);
#define sframe_ra_tracking_p x86_sframe_ra_tracking_p
@@ -471,7 +503,7 @@ extern bool x86_sframe_ra_tracking_p (void);
extern offsetT x86_sframe_cfa_ra_offset (void);
#define sframe_cfa_ra_offset x86_sframe_cfa_ra_offset
-/* The abi/arch indentifier for SFrame. */
+/* The abi/arch identifier for SFrame. */
extern unsigned char x86_sframe_get_abi_arch (void);
#define sframe_get_abi_arch x86_sframe_get_abi_arch
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index b508232..88f9563 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -741,7 +741,7 @@ typedef struct unw_rec_list {
struct unw_rec_list *next;
} unw_rec_list;
-#define SLOT_NUM_NOT_SET (unsigned)-1
+#define SLOT_NUM_NOT_SET -1UL
/* Linked list of saved prologue counts. A very poor
implementation of a map from label numbers to prologue counts. */
@@ -1045,9 +1045,9 @@ obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED)
const char *sec_name;
char *sym_name;
char c;
- offsetT size;
- offsetT cur_size;
- offsetT temp;
+ valueT size;
+ valueT cur_size;
+ valueT temp;
symbolS *symbolP;
segT current_seg = now_seg;
subsegT current_subseg = now_subseg;
@@ -1109,7 +1109,7 @@ obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED)
temp = get_absolute_expression ();
size = temp;
- size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
+ size &= ((valueT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
if (temp != size)
{
as_warn (_("size (%ld) out of range, ignored"), (long) temp);
@@ -1150,11 +1150,9 @@ obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED)
record_alignment (now_seg, log_align);
cur_size = bfd_section_size (now_seg);
- if ((int) size > cur_size)
+ if (size > cur_size)
{
- char *pfrag
- = frag_var (rs_fill, 1, 1, (relax_substateT)0, NULL,
- (valueT)size - (valueT)cur_size, NULL);
+ char *pfrag = frag_var (rs_fill, 1, 1, 0, NULL, size - cur_size, NULL);
*pfrag = 0;
bfd_set_section_size (now_seg, size);
}
@@ -3574,7 +3572,7 @@ start_unwind_section (const segT text_seg, int sec_index)
suffix += sizeof (".gnu.linkonce.t.") - 1;
}
- sec_name = concat (prefix, suffix, NULL);
+ sec_name = concat (prefix, suffix, (const char *) NULL);
/* Handle COMDAT group. */
if ((text_seg->flags & SEC_LINK_ONCE) != 0
@@ -3593,7 +3591,8 @@ start_unwind_section (const segT text_seg, int sec_index)
}
/* We have to construct a fake section directive. */
- section = concat (sec_name, ",\"aG\",@progbits,", group_name, ",comdat", NULL);
+ section = concat (sec_name, ",\"aG\",@progbits,", group_name,
+ ",comdat", (const char *) NULL);
set_section (section);
free (section);
}
@@ -3657,7 +3656,7 @@ generate_unwind_image (const segT text_seg)
unwind.info = expr_build_dot ();
frag_var (rs_machine_dependent, size, size, 0, 0,
- (offsetT) (long) unwind.personality_routine,
+ (intptr_t) unwind.personality_routine,
(char *) list);
/* Add the personality address to the image. */
@@ -4476,13 +4475,14 @@ dot_endp (int dummy ATTRIBUTE_UNUSED)
S_SET_SIZE (sym, frag_now_fix () - S_GET_VALUE (sym));
else
{
- symbol_get_obj (sym)->size = XNEW (expressionS);
- symbol_get_obj (sym)->size->X_op = O_subtract;
- symbol_get_obj (sym)->size->X_add_symbol
+ OBJ_SYMFIELD_TYPE *obj = symbol_get_obj (sym);
+ obj->size = notes_alloc (sizeof (*obj->size));
+ obj->size->X_op = O_subtract;
+ obj->size->X_add_symbol
= symbol_new (FAKE_LABEL_NAME, now_seg,
frag_now, frag_now_fix ());
- symbol_get_obj (sym)->size->X_op_symbol = sym;
- symbol_get_obj (sym)->size->X_add_number = 0;
+ obj->size->X_op_symbol = sym;
+ obj->size->X_add_number = 0;
}
}
}
@@ -5095,7 +5095,7 @@ dot_pred_rel (int type)
if (count == 0)
mask = ~(valueT) 0;
clear_qp_mutex (mask);
- clear_qp_implies (mask, (valueT) 0);
+ clear_qp_implies (mask, 0);
break;
case 'i':
if (count != 2 || p1 == -1 || p2 == -1)
@@ -10645,7 +10645,7 @@ md_assemble (char *str)
ch = get_symbol_name (&temp);
mnemonic = temp;
- pdesc = (struct pseudo_opcode *) str_hash_find (md.pseudo_hash, mnemonic);
+ pdesc = str_hash_find (md.pseudo_hash, mnemonic);
if (pdesc)
{
(void) restore_line_pointer (ch);
@@ -11663,8 +11663,7 @@ ia64_float_to_chars_bigendian (char *lit, LITTLENUM_TYPE *words,
{
while (prec--)
{
- number_to_chars_bigendian (lit, (long) (*words++),
- sizeof (LITTLENUM_TYPE));
+ number_to_chars_bigendian (lit, *words++, sizeof (LITTLENUM_TYPE));
lit += sizeof (LITTLENUM_TYPE);
}
}
@@ -11675,7 +11674,7 @@ ia64_float_to_chars_littleendian (char *lit, LITTLENUM_TYPE *words,
{
while (prec--)
{
- number_to_chars_littleendian (lit, (long) (words[prec]),
+ number_to_chars_littleendian (lit, words[prec],
sizeof (LITTLENUM_TYPE));
lit += sizeof (LITTLENUM_TYPE);
}
@@ -11778,7 +11777,7 @@ dot_alias (int section)
/* Check if alias has been used before. */
- h = (struct alias *) str_hash_find (ahash, alias);
+ h = str_hash_find (ahash, alias);
if (h)
{
if (strcmp (h->name, name))
@@ -11789,7 +11788,7 @@ dot_alias (int section)
}
/* Check if name already has an alias. */
- a = (const char *) str_hash_find (nhash, name);
+ a = str_hash_find (nhash, name);
if (a)
{
if (strcmp (a, alias))
diff --git a/gas/config/tc-ia64.h b/gas/config/tc-ia64.h
index 0f9810d..62d288d 100644
--- a/gas/config/tc-ia64.h
+++ b/gas/config/tc-ia64.h
@@ -176,7 +176,7 @@ void ia64_vms_note (void);
as_bad_where ((FRAGP)->fr_file, (FRAGP)->fr_line, \
_("instruction address is not a multiple of 16"));
-#define MAX_MEM_FOR_RS_ALIGN_CODE (15 + 16)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (15 + 16)
#define WORKING_DOT_WORD /* don't do broken word processing for now */
diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c
index 1957235..76ff841 100644
--- a/gas/config/tc-iq2000.c
+++ b/gas/config/tc-iq2000.c
@@ -198,29 +198,29 @@ static const char * li_expn = "\n\
static iq2000_macro_defs_s iq2000_macro_defs[] =
{
- {"abs", (const char **) & abs_expn, (const char **) & abs_args},
- {"la", (const char **) & la_expn, (const char **) & la_args},
- {"bge", (const char **) & bge_expn, (const char **) & bxx_args},
- {"bgeu", (const char **) & bgeu_expn, (const char **) & bxx_args},
- {"bgt", (const char **) & bgt_expn, (const char **) & bxx_args},
- {"bgtu", (const char **) & bgtu_expn, (const char **) & bxx_args},
- {"ble", (const char **) & ble_expn, (const char **) & bxx_args},
- {"bleu", (const char **) & bleu_expn, (const char **) & bxx_args},
- {"blt", (const char **) & blt_expn, (const char **) & bxx_args},
- {"bltu", (const char **) & bltu_expn, (const char **) & bxx_args},
- {"sge", (const char **) & sge_expn, (const char **) & sxx_args},
- {"sgeu", (const char **) & sgeu_expn, (const char **) & sxx_args},
- {"sle", (const char **) & sle_expn, (const char **) & sxx_args},
- {"sleu", (const char **) & sleu_expn, (const char **) & sxx_args},
- {"sgt", (const char **) & sgt_expn, (const char **) & sxx_args},
- {"sgtu", (const char **) & sgtu_expn, (const char **) & sxx_args},
- {"seq", (const char **) & seq_expn, (const char **) & sxx_args},
- {"sne", (const char **) & sne_expn, (const char **) & sxx_args},
- {"neg", (const char **) & neg_expn, (const char **) & neg_args},
- {"negu", (const char **) & negu_expn, (const char **) & neg_args},
- {"li", (const char **) & li_expn, (const char **) & li_args},
- {"ori32", (const char **) & ori32_expn, (const char **) & ai32_args},
- {"andi32",(const char **) & andi32_expn,(const char **) & ai32_args},
+ {"abs", &abs_expn, abs_args},
+ {"la", &la_expn, la_args},
+ {"bge", &bge_expn, bxx_args},
+ {"bgeu", &bgeu_expn, bxx_args},
+ {"bgt", &bgt_expn, bxx_args},
+ {"bgtu", &bgtu_expn, bxx_args},
+ {"ble", &ble_expn, bxx_args},
+ {"bleu", &bleu_expn, bxx_args},
+ {"blt", &blt_expn, bxx_args},
+ {"bltu", &bltu_expn, bxx_args},
+ {"sge", &sge_expn, sxx_args},
+ {"sgeu", &sgeu_expn, sxx_args},
+ {"sle", &sle_expn, sxx_args},
+ {"sleu", &sleu_expn, sxx_args},
+ {"sgt", &sgt_expn, sxx_args},
+ {"sgtu", &sgtu_expn, sxx_args},
+ {"seq", &seq_expn, sxx_args},
+ {"sne", &sne_expn, sxx_args},
+ {"neg", &neg_expn, neg_args},
+ {"negu", &negu_expn, neg_args},
+ {"li", &li_expn, li_args},
+ {"ori32", &ori32_expn, ai32_args},
+ {"andi32", &andi32_expn, ai32_args},
};
static void
@@ -425,7 +425,7 @@ valueT
md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & -(1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
symbolS *
@@ -482,7 +482,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
long
md_pcrel_from_section (fixS * fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
{
@@ -728,10 +728,10 @@ iq2000_fix_adjustable (fixS * fixP)
{
bfd_reloc_code_real_type reloc_type;
- if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
{
const CGEN_INSN *insn = NULL;
- int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+ int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
reloc_type = md_cgen_lookup_reloc (insn, operand, fixP);
@@ -790,7 +790,7 @@ get_symbol (void)
symbolS *p;
c = get_symbol_name (&name);
- p = (symbolS *) symbol_find_or_make (name);
+ p = symbol_find_or_make (name);
(void) restore_line_pointer (c);
return p;
}
diff --git a/gas/config/tc-kvx.c b/gas/config/tc-kvx.c
index 942b1ab..b4ca25c 100644
--- a/gas/config/tc-kvx.c
+++ b/gas/config/tc-kvx.c
@@ -509,7 +509,7 @@ insert_operand (struct kvxinsn *insn, struct kvx_operand *opdef,
{
char *ilp_save = input_line_pointer;
input_line_pointer = tok->tok;
- expressionS exp = { 0 };
+ expressionS exp;
expression (&exp);
input_line_pointer = ilp_save;
@@ -700,7 +700,7 @@ assemble_insn (const struct kvxopc * opcode, struct token_list *tok, struct kvxi
insn->immx1 = NOIMMX;
struct token_list *tok_ = tok;
- struct kvx_operand **format = (struct kvx_operand **) opcode->format;
+ struct kvx_operand *const *format = opcode->format;
while (tok_)
{
@@ -1021,7 +1021,7 @@ kvx_print_insn (struct kvxopc * op ATTRIBUTE_UNUSED)
/* This is a hack which works because the Bundling is the same for all cores
for now. */
- switch ((int) op->bundling)
+ switch (op->bundling)
{
case Bundling_kv3_v1_ALL:
insn_type = "ALL ";
@@ -1109,7 +1109,7 @@ kvx_reorder_bundle (struct kvxinsn *bundle_insn[], int bundle_insncnt)
tag = -1, exu = -1;
/* This is a hack. It works because all the Bundling are the same for all
cores for now. */
- switch ((int) find_bundling (kvxinsn))
+ switch (find_bundling (kvxinsn))
{
case Bundling_kv3_v1_ALL:
if (bundle_insncnt > 1)
@@ -1441,8 +1441,8 @@ kvx_set_cpu (void)
static int
kvxop_compar (const void *a, const void *b)
{
- const struct kvxopc *opa = (const struct kvxopc *) a;
- const struct kvxopc *opb = (const struct kvxopc *) b;
+ const struct kvxopc *opa = a;
+ const struct kvxopc *opb = b;
int res = strcmp (opa->as_op, opb->as_op);
if (res)
@@ -1644,7 +1644,7 @@ md_apply_fix (fixS * fixP, valueT * valueP, segT segmentP ATTRIBUTE_UNUSED)
valueT image;
arelent *rel;
- rel = (arelent *) xmalloc (sizeof (arelent));
+ rel = xmalloc (sizeof (arelent));
rel->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
if (rel->howto == NULL)
@@ -2355,16 +2355,11 @@ kvx_endp (int start ATTRIBUTE_UNUSED)
if (exp.X_op == O_constant)
{
S_SET_SIZE (last_proc_sym, exp.X_add_number);
- if (symbol_get_obj (last_proc_sym)->size)
- {
- xfree (symbol_get_obj (last_proc_sym)->size);
- symbol_get_obj (last_proc_sym)->size = NULL;
- }
+ symbol_get_obj (last_proc_sym)->size = NULL;
}
else
{
- symbol_get_obj (last_proc_sym)->size =
- (expressionS *) xmalloc (sizeof (expressionS));
+ symbol_get_obj (last_proc_sym)->size = notes_alloc (sizeof (exp));
*symbol_get_obj (last_proc_sym)->size = exp;
}
@@ -2518,20 +2513,18 @@ kvx_force_reloc_sub_same (fixS * fixP, segT sec)
return 1;
}
-/* Implement HANDLE_ALIGN. */
+/* Pads code section with bundle of nops when possible, 0 if not. */
-static void
-kvx_make_nops (char *buf, bfd_vma bytes)
+void
+kvx_handle_align (fragS *fragP)
{
- bfd_vma i = 0;
- unsigned int j;
+ if (fragP->fr_type != rs_align_code)
+ return;
static unsigned int nop_single = 0;
-
if (!nop_single)
{
- const struct kvxopc *opcode =
- (struct kvxopc *) str_hash_find (env.opcode_hash, "nop");
+ const struct kvxopc *opcode = str_hash_find (env.opcode_hash, "nop");
if (opcode == NULL)
as_fatal
@@ -2540,52 +2533,49 @@ kvx_make_nops (char *buf, bfd_vma bytes)
nop_single = opcode->codewords[0].opcode;
}
- /* KVX instructions are always 4-bytes aligned. If we are at a position */
- /* that is not 4 bytes aligned, it means this is not part of an instruction, */
- /* so it is safe to use a zero byte for padding. */
+ bfd_signed_vma bytes = (fragP->fr_next->fr_address
+ - fragP->fr_address - fragP->fr_fix);
+ if (bytes <= 0)
+ return;
- for (j = bytes % 4; j > 0; j--)
- buf[i++] = 0;
+ char *p = fragP->fr_literal + fragP->fr_fix;
- for (j = 0; j < (bytes - i); j += 4)
+ /* KVX instructions are always 4-bytes aligned. If we are at a
+ position that is not 4 bytes aligned, it means this is not part
+ of an instruction, so it is safe to use a zero byte for padding. */
+ int fix = bytes & 3;
+ if (fix != 0)
{
- unsigned nop = nop_single;
-
- // nop has bundle end only if #4 nop or last padding nop.
- // Sets the parallel bit when neither conditions are matched.
- // 4*4 = biggest nop bundle we can get
- // 12 = offset when writting the last nop possible in a 4 nops bundle
- // bytes-i-4 = offset for the last 4-words in the padding
- if (j % (4 * 4) != 12 && j != (bytes - i - 4))
- nop |= PARALLEL_BIT;
-
- memcpy (buf + i + j, &nop, sizeof (nop));
+ memset (p, 0, fix);
+ p += fix;
+ bytes -= fix;
}
-}
-/* Pads code section with bundle of nops when possible, 0 if not. */
-void
-kvx_handle_align (fragS *fragP)
-{
- switch (fragP->fr_type)
+ /* Output any nops that don't make a full bundle. */
+ while (bytes & 15)
{
- case rs_align_code:
- {
- bfd_signed_vma bytes = (fragP->fr_next->fr_address
- - fragP->fr_address - fragP->fr_fix);
- char *p = fragP->fr_literal + fragP->fr_fix;
-
- if (bytes <= 0)
- break;
-
- /* Insert zeros or nops to get 4 byte alignment. */
- kvx_make_nops (p, bytes);
- fragP->fr_fix += bytes;
- }
- break;
+ unsigned int nop = nop_single;
+ bytes -= 4;
+ if (bytes & 15)
+ nop |= PARALLEL_BIT;
+ memcpy (p, &nop, 4);
+ p += 4;
+ fix += 4;
+ }
+ fragP->fr_fix += fix;
- default:
- break;
+ /* Any more are repeated copies of this full bundle of nops. */
+ if (bytes)
+ {
+ unsigned int nop = nop_single | PARALLEL_BIT;
+ memcpy (p, &nop, 4);
+ p += 4;
+ memcpy (p, &nop, 4);
+ p += 4;
+ memcpy (p, &nop, 4);
+ p += 4;
+ memcpy (p, &nop_single, 4);
+ fragP->fr_var = 16;
}
}
/*
diff --git a/gas/config/tc-kvx.h b/gas/config/tc-kvx.h
index a4d0e2d..50c124f 100644
--- a/gas/config/tc-kvx.h
+++ b/gas/config/tc-kvx.h
@@ -297,6 +297,7 @@ extern void kvx_cons_fix_new (fragS *f, int where, int nbytes,
/* Enable special handling for the alignment directive. */
extern void kvx_handle_align (fragS *);
#define HANDLE_ALIGN(s, f) kvx_handle_align (f)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 12 + 16)
#ifdef OBJ_ELF
diff --git a/gas/config/tc-lm32.c b/gas/config/tc-lm32.c
index c101d71..2a4bbd3 100644
--- a/gas/config/tc-lm32.c
+++ b/gas/config/tc-lm32.c
@@ -80,7 +80,7 @@ const pseudo_typeS md_pseudo_table[] =
{ "hword", cons, 2 },
{ "word", cons, 4 },
{ "dword", cons, 8 },
- {(char *)0 , (void(*)(int))0, 0}
+ { NULL, NULL, 0 }
};
/* Target specific command line options. */
@@ -246,8 +246,7 @@ md_atof (int type, char *litP, int *sizeP)
{
for (i = 0; i < prec; i++)
{
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
}
@@ -255,8 +254,7 @@ md_atof (int type, char *litP, int *sizeP)
{
for (i = prec - 1; i >= 0; i--)
{
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
}
@@ -278,7 +276,7 @@ valueT
md_section_align (asection *seg, valueT addr)
{
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
/* This function assembles the instructions. It emits the frags/bytes to the
@@ -357,7 +355,7 @@ md_pcrel_from (fixS *fixP)
long
md_pcrel_from_section (fixS * fixP, segT sec)
{
- if ((fixP->fx_addsy != (symbolS *) NULL)
+ if ((fixP->fx_addsy != NULL)
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| (S_GET_SEGMENT (fixP->fx_addsy) != sec)))
{
@@ -368,7 +366,7 @@ md_pcrel_from_section (fixS * fixP, segT sec)
/*fprintf(stderr, "%s extern %d local %d\n", S_GET_NAME (fixP->fx_addsy), S_IS_EXTERN (fixP->fx_addsy), S_IS_LOCAL (fixP->fx_addsy));*/
/* FIXME: Weak problem? */
- if ((fixP->fx_addsy != (symbolS *) NULL)
+ if ((fixP->fx_addsy != NULL)
&& S_IS_EXTERNAL (fixP->fx_addsy))
{
/* If the symbol is external, let the linker handle it. */
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index 7841144..7b53b6f 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -180,7 +180,6 @@ md_parse_option (int c, const char *arg)
int ret = 1;
char lp64[256] = "";
char ilp32[256] = "";
- unsigned char *suf = (unsigned char *)arg;
lp64['s'] = lp64['S'] = EF_LOONGARCH_ABI_SOFT_FLOAT;
lp64['f'] = lp64['F'] = EF_LOONGARCH_ABI_SINGLE_FLOAT;
@@ -193,7 +192,7 @@ md_parse_option (int c, const char *arg)
switch (c)
{
case OPTION_ABI:
- if (strncasecmp (arg, "lp64", 4) == 0 && lp64[suf[4]] != 0)
+ if (strncasecmp (arg, "lp64", 4) == 0 && lp64[arg[4] & 0xff] != 0)
{
LARCH_opts.ase_ilp32 = 1;
LARCH_opts.ase_lp64 = 1;
@@ -201,11 +200,11 @@ md_parse_option (int c, const char *arg)
LARCH_opts.ase_lasx = 1;
LARCH_opts.ase_lvz = 1;
LARCH_opts.ase_lbt = 1;
- LARCH_opts.ase_abi = lp64[suf[4]];
+ LARCH_opts.ase_abi = lp64[arg[4] & 0xff];
}
- else if (strncasecmp (arg, "ilp32", 5) == 0 && ilp32[suf[5]] != 0)
+ else if (strncasecmp (arg, "ilp32", 5) == 0 && ilp32[arg[5] & 0xff] != 0)
{
- LARCH_opts.ase_abi = ilp32[suf[5]];
+ LARCH_opts.ase_abi = ilp32[arg[5] & 0xff];
LARCH_opts.ase_ilp32 = 1;
}
else
@@ -320,115 +319,98 @@ loongarch_after_parse_args ()
/* Init ilp32/lp64 registers names. */
if (!r_htab)
- r_htab = str_htab_create (), str_hash_insert (r_htab, "", 0, 0);
+ r_htab = str_htab_create ();
if (!r_deprecated_htab)
- r_deprecated_htab = str_htab_create (),
- str_hash_insert (r_deprecated_htab, "", 0, 0);
+ r_deprecated_htab = str_htab_create ();
/* Init cfi registers alias. */
if (!cfi_r_htab)
- cfi_r_htab = str_htab_create (), str_hash_insert (cfi_r_htab, "", 0, 0);
+ cfi_r_htab = str_htab_create ();
r_abi_names = loongarch_r_normal_name;
for (i = 0; i < ARRAY_SIZE (loongarch_r_normal_name); i++)
{
- str_hash_insert (r_htab, loongarch_r_normal_name[i],
- (void *) (i + 1), 0);
- str_hash_insert (cfi_r_htab, loongarch_r_normal_name[i],
- (void *) (i + 1), 0);
+ str_hash_insert_int (r_htab, loongarch_r_normal_name[i], i, 0);
+ str_hash_insert_int (cfi_r_htab, loongarch_r_normal_name[i], i, 0);
}
/* Init ilp32/lp64 registers alias. */
r_abi_names = loongarch_r_alias;
for (i = 0; i < ARRAY_SIZE (loongarch_r_alias); i++)
{
- str_hash_insert (r_htab, loongarch_r_alias[i],
- (void *) (i + 1), 0);
- str_hash_insert (cfi_r_htab, loongarch_r_alias[i],
- (void *) (i + 1), 0);
+ str_hash_insert_int (r_htab, loongarch_r_alias[i], i, 0);
+ str_hash_insert_int (cfi_r_htab, loongarch_r_alias[i], i, 0);
}
for (i = 0; i < ARRAY_SIZE (loongarch_r_alias_1); i++)
- str_hash_insert (r_htab, loongarch_r_alias_1[i], (void *) (i + 1), 0);
+ str_hash_insert_int (r_htab, loongarch_r_alias_1[i], i, 0);
for (i = 0; i < ARRAY_SIZE (loongarch_r_alias_deprecated); i++)
- str_hash_insert (r_deprecated_htab, loongarch_r_alias_deprecated[i],
- (void *) (i + 1), 0);
+ str_hash_insert_int (r_deprecated_htab, loongarch_r_alias_deprecated[i],
+ i, 0);
/* The .cfi directive supports register aliases without the "$" prefix. */
for (i = 0; i < ARRAY_SIZE (loongarch_r_cfi_name); i++)
{
- str_hash_insert (cfi_r_htab, loongarch_r_cfi_name[i],
- (void *)(i + 1), 0);
- str_hash_insert (cfi_r_htab, loongarch_r_cfi_name_alias[i],
- (void *)(i + 1), 0);
+ str_hash_insert_int (cfi_r_htab, loongarch_r_cfi_name[i], i, 0);
+ str_hash_insert_int (cfi_r_htab, loongarch_r_cfi_name_alias[i], i, 0);
}
if (!cr_htab)
- cr_htab = str_htab_create (), str_hash_insert (cr_htab, "", 0, 0);
+ cr_htab = str_htab_create ();
for (i = 0; i < ARRAY_SIZE (loongarch_cr_normal_name); i++)
- str_hash_insert (cr_htab, loongarch_cr_normal_name[i], (void *) (i + 1), 0);
+ str_hash_insert_int (cr_htab, loongarch_cr_normal_name[i], i, 0);
/* Init single/double float registers names. */
if (LARCH_opts.ase_sf || LARCH_opts.ase_df)
{
if (!f_htab)
- f_htab = str_htab_create (), str_hash_insert (f_htab, "", 0, 0);
+ f_htab = str_htab_create ();
if (!f_deprecated_htab)
- f_deprecated_htab = str_htab_create (),
- str_hash_insert (f_deprecated_htab, "", 0, 0);
+ f_deprecated_htab = str_htab_create ();
if (!cfi_f_htab)
- cfi_f_htab = str_htab_create (), str_hash_insert (cfi_f_htab, "", 0, 0);
+ cfi_f_htab = str_htab_create ();
f_abi_names = loongarch_f_normal_name;
for (i = 0; i < ARRAY_SIZE (loongarch_f_normal_name); i++)
{
- str_hash_insert (f_htab, loongarch_f_normal_name[i],
- (void *) (i + 1), 0);
- str_hash_insert (cfi_f_htab, loongarch_f_normal_name[i],
- (void *) (i + 1), 0);
+ str_hash_insert_int (f_htab, loongarch_f_normal_name[i], i, 0);
+ str_hash_insert_int (cfi_f_htab, loongarch_f_normal_name[i], i, 0);
}
/* Init float-ilp32/lp64 registers alias. */
f_abi_names = loongarch_f_alias;
for (i = 0; i < ARRAY_SIZE (loongarch_f_alias); i++)
{
- str_hash_insert (f_htab, loongarch_f_alias[i],
- (void *) (i + 1), 0);
- str_hash_insert (cfi_f_htab, loongarch_f_alias[i],
- (void *) (i + 1), 0);
+ str_hash_insert_int (f_htab, loongarch_f_alias[i], i, 0);
+ str_hash_insert_int (cfi_f_htab, loongarch_f_alias[i], i, 0);
}
for (i = 0; i < ARRAY_SIZE (loongarch_f_alias_deprecated); i++)
- str_hash_insert (f_deprecated_htab, loongarch_f_alias_deprecated[i],
- (void *) (i + 1), 0);
+ str_hash_insert_int (f_deprecated_htab, loongarch_f_alias_deprecated[i],
+ i, 0);
/* The .cfi directive supports register aliases without the "$" prefix. */
for (i = 0; i < ARRAY_SIZE (loongarch_f_cfi_name); i++)
{
- str_hash_insert (cfi_f_htab, loongarch_f_cfi_name[i],
- (void *)(i + 1), 0);
- str_hash_insert (cfi_f_htab, loongarch_f_cfi_name_alias[i],
- (void *)(i + 1), 0);
+ str_hash_insert_int (cfi_f_htab, loongarch_f_cfi_name[i], i, 0);
+ str_hash_insert_int (cfi_f_htab, loongarch_f_cfi_name_alias[i], i, 0);
}
if (!fc_htab)
- fc_htab = str_htab_create (), str_hash_insert (fc_htab, "", 0, 0);
+ fc_htab = str_htab_create ();
for (i = 0; i < ARRAY_SIZE (loongarch_fc_normal_name); i++)
- str_hash_insert (fc_htab, loongarch_fc_normal_name[i], (void *) (i + 1),
- 0);
+ str_hash_insert_int (fc_htab, loongarch_fc_normal_name[i], i, 0);
if (!fcn_htab)
- fcn_htab = str_htab_create (), str_hash_insert (fcn_htab, "", 0, 0);
+ fcn_htab = str_htab_create ();
for (i = 0; i < ARRAY_SIZE (loongarch_fc_numeric_name); i++)
- str_hash_insert (fcn_htab, loongarch_fc_numeric_name[i], (void *) (i + 1),
- 0);
+ str_hash_insert_int (fcn_htab, loongarch_fc_numeric_name[i], i, 0);
if (!c_htab)
- c_htab = str_htab_create (), str_hash_insert (c_htab, "", 0, 0);
+ c_htab = str_htab_create ();
for (i = 0; i < ARRAY_SIZE (loongarch_c_normal_name); i++)
- str_hash_insert (c_htab, loongarch_c_normal_name[i], (void *) (i + 1),
- 0);
+ str_hash_insert_int (c_htab, loongarch_c_normal_name[i], i, 0);
}
@@ -436,20 +418,18 @@ loongarch_after_parse_args ()
if (LARCH_opts.ase_lsx)
{
if (!v_htab)
- v_htab = str_htab_create (), str_hash_insert (v_htab, "", 0, 0);
+ v_htab = str_htab_create ();
for (i = 0; i < ARRAY_SIZE (loongarch_v_normal_name); i++)
- str_hash_insert (v_htab, loongarch_v_normal_name[i], (void *) (i + 1),
- 0);
+ str_hash_insert_int (v_htab, loongarch_v_normal_name[i], i, 0);
}
/* Init lasx registers names. */
if (LARCH_opts.ase_lasx)
{
if (!x_htab)
- x_htab = str_htab_create (), str_hash_insert (x_htab, "", 0, 0);
+ x_htab = str_htab_create ();
for (i = 0; i < ARRAY_SIZE (loongarch_x_normal_name); i++)
- str_hash_insert (x_htab, loongarch_x_normal_name[i], (void *) (i + 1),
- 0);
+ str_hash_insert_int (x_htab, loongarch_x_normal_name[i], i, 0);
}
}
@@ -472,7 +452,7 @@ static hashval_t
align_sec_sym_hash (const void *entry)
{
const align_sec_sym *e = entry;
- return (hashval_t) (e->sec_id);
+ return e->sec_id;
}
static int
@@ -502,7 +482,7 @@ static symbolS *get_align_symbol (segT sec)
&entry, INSERT);
if (slot == NULL)
return NULL;
- *slot = (align_sec_sym *) xmalloc (sizeof (align_sec_sym));
+ *slot = xmalloc (sizeof (align_sec_sym));
if (*slot == NULL)
return NULL;
**slot = entry;
@@ -934,15 +914,15 @@ loongarch_args_parser_can_match_arg_helper (char esc_ch1, char esc_ch2,
}
break;
case 'r':
- imm = (intptr_t) str_hash_find (r_htab, arg);
- ip->match_now = 0 < imm;
- ret = imm - 1;
+ imm = str_hash_find_int (r_htab, arg);
+ ip->match_now = 0 <= imm;
+ ret = imm;
if (ip->match_now)
break;
/* Handle potential usage of deprecated register aliases. */
- imm = (intptr_t) str_hash_find (r_deprecated_htab, arg);
- ip->match_now = 0 < imm;
- ret = imm - 1;
+ imm = str_hash_find_int (r_deprecated_htab, arg);
+ ip->match_now = 0 <= imm;
+ ret = imm;
/* !ip->expand_from_macro: avoiding duplicate output warnings,
only the first macro output warning. */
if (ip->match_now && !ip->expand_from_macro)
@@ -953,23 +933,21 @@ loongarch_args_parser_can_match_arg_helper (char esc_ch1, char esc_ch2,
switch (esc_ch2)
{
case 'c':
- imm = (intptr_t) str_hash_find (fc_htab, arg);
- if (0 >= imm)
- {
- imm = (intptr_t) str_hash_find (fcn_htab, arg);
- }
+ imm = str_hash_find_int (fc_htab, arg);
+ if (0 > imm)
+ imm = str_hash_find_int (fcn_htab, arg);
break;
default:
- imm = (intptr_t) str_hash_find (f_htab, arg);
+ imm = str_hash_find_int (f_htab, arg);
}
- ip->match_now = 0 < imm;
- ret = imm - 1;
+ ip->match_now = 0 <= imm;
+ ret = imm;
if (ip->match_now && !ip->expand_from_macro)
break;
/* Handle potential usage of deprecated register aliases. */
- imm = (intptr_t) str_hash_find (f_deprecated_htab, arg);
- ip->match_now = 0 < imm;
- ret = imm - 1;
+ imm = str_hash_find_int (f_deprecated_htab, arg);
+ ip->match_now = 0 <= imm;
+ ret = imm;
if (ip->match_now)
as_warn (_("register alias %s is deprecated, use %s instead"),
arg, f_abi_names[ret]);
@@ -978,23 +956,23 @@ loongarch_args_parser_can_match_arg_helper (char esc_ch1, char esc_ch2,
switch (esc_ch2)
{
case 'r':
- imm = (intptr_t) str_hash_find (cr_htab, arg);
+ imm = str_hash_find_int (cr_htab, arg);
break;
default:
- imm = (intptr_t) str_hash_find (c_htab, arg);
+ imm = str_hash_find_int (c_htab, arg);
}
- ip->match_now = 0 < imm;
- ret = imm - 1;
+ ip->match_now = 0 <= imm;
+ ret = imm;
break;
case 'v':
- imm = (intptr_t) str_hash_find (v_htab, arg);
- ip->match_now = 0 < imm;
- ret = imm - 1;
+ imm = str_hash_find_int (v_htab, arg);
+ ip->match_now = 0 <= imm;
+ ret = imm;
break;
case 'x':
- imm = (intptr_t) str_hash_find (x_htab, arg);
- ip->match_now = 0 < imm;
- ret = imm - 1;
+ imm = str_hash_find_int (x_htab, arg);
+ ip->match_now = 0 <= imm;
+ ret = imm;
break;
case '\0':
ip->all_match = ip->match_now;
@@ -1077,8 +1055,7 @@ get_loongarch_opcode (struct loongarch_cl_insn *insn)
if ((!it->include || (it->include && *it->include))
&& (!it->exclude || (it->exclude && !(*it->exclude)))
&& !(it->pinfo & INSN_DIS_ALIAS))
- str_hash_insert (ase->name_hash_entry, it->name,
- (void *) it, 0);
+ str_hash_insert (ase->name_hash_entry, it->name, it, 0);
}
}
@@ -1420,7 +1397,8 @@ loongarch_assemble_INSNs (char *str, unsigned int expand_from_macro)
if (*str == '\0')
break;
- struct loongarch_cl_insn the_one = { 0 };
+ struct loongarch_cl_insn the_one;
+ memset (&the_one, 0, sizeof (the_one));
the_one.name = str;
the_one.expand_from_macro = expand_from_macro;
@@ -1521,6 +1499,29 @@ loongarch_force_relocation (struct fix *fixp)
return generic_force_reloc (fixp);
}
+/* If subsy of BFD_RELOC32/64 and PC in same segment, and without relax
+ or PC at start of subsy or with relax but sub_symbol_segment not in
+ SEC_CODE, we generate 32/64_PCREL. */
+bool
+loongarch_force_relocation_sub_local (fixS *fixp, segT sec ATTRIBUTE_UNUSED)
+{
+ return !(LARCH_opts.thin_add_sub
+ && (fixp->fx_r_type == BFD_RELOC_32
+ || fixp->fx_r_type == BFD_RELOC_64)
+ && (!LARCH_opts.relax
+ || (S_GET_VALUE (fixp->fx_subsy)
+ == fixp->fx_frag->fr_address + fixp->fx_where)
+ || (S_GET_SEGMENT (fixp->fx_subsy)->flags & SEC_CODE) == 0));
+}
+
+/* Postpone text-section label subtraction calculation until linking, since
+ linker relaxations might change the deltas. */
+bool
+loongarch_force_relocation_sub_same(fixS *fixp ATTRIBUTE_UNUSED, segT sec)
+{
+ return LARCH_opts.relax && (sec->flags & SEC_CODE) != 0;
+}
+
static void fix_reloc_insn (fixS *fixP, bfd_vma reloc_val, char *buf)
{
reloc_howto_type *howto;
@@ -1754,8 +1755,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
unsigned int subtype;
offsetT loc;
- subtype = bfd_get_8 (NULL, &((fragS *)
- (fixP->fx_frag->fr_opcode))->fr_literal[fixP->fx_where]);
+ fragS *opfrag = (fragS *) fixP->fx_frag->fr_opcode;
+ subtype = bfd_get_8 (NULL, opfrag->fr_literal + fixP->fx_where);
loc = fixP->fx_frag->fr_fix - (subtype & 7);
switch (subtype)
{
@@ -1791,7 +1792,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
if (subtype < 0x80 && (subtype & 0x40))
{
/* DW_CFA_advance_loc. */
- fixP->fx_frag = (fragS *) fixP->fx_frag->fr_opcode;
+ fixP->fx_frag = opfrag;
fixP->fx_next->fx_frag = fixP->fx_frag;
fixP->fx_r_type = BFD_RELOC_LARCH_ADD6;
fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB6;
@@ -1913,12 +1914,12 @@ tc_loongarch_regname_to_dw2regnum (char *regname)
int reg;
/* Look up in the general purpose register table. */
- if ((reg = (intptr_t) str_hash_find (cfi_r_htab, regname)) > 0)
- return reg - 1;
+ if ((reg = str_hash_find_int (cfi_r_htab, regname)) >= 0)
+ return reg;
/* Look up in the floating point register table. */
- if ((reg = (intptr_t) str_hash_find (cfi_f_htab, regname)) > 0)
- return reg + 31;
+ if ((reg = str_hash_find_int (cfi_f_htab, regname)) >= 0)
+ return reg + 32;
as_bad (_("unknown register `%s`"), regname);
return -1;
@@ -2282,12 +2283,12 @@ loongarch_relax_frag (asection *sec, fragS *fragp,
static void
loongarch_convert_frag_branch (fragS *fragp)
{
- bfd_byte *buf;
+ char *buf;
expressionS exp;
fixS *fixp;
insn_t insn;
- buf = (bfd_byte *)fragp->fr_literal + fragp->fr_fix;
+ buf = fragp->fr_literal + fragp->fr_fix;
exp.X_op = O_symbol;
exp.X_add_symbol = fragp->fr_symbol;
@@ -2317,17 +2318,17 @@ loongarch_convert_frag_branch (fragS *fragp)
/* Add the B instruction and jump to the original target. */
bfd_putl32 (LARCH_B, buf);
- fixp = fix_new_exp (fragp, buf - (bfd_byte *)fragp->fr_literal,
+ fixp = fix_new_exp (fragp, buf - fragp->fr_literal,
4, &exp, false, BFD_RELOC_LARCH_B26);
buf += 4;
break;
case RELAX_BRANCH_21:
- fixp = fix_new_exp (fragp, buf - (bfd_byte *)fragp->fr_literal,
+ fixp = fix_new_exp (fragp, buf - fragp->fr_literal,
4, &exp, false, BFD_RELOC_LARCH_B21);
buf += 4;
break;
case RELAX_BRANCH_16:
- fixp = fix_new_exp (fragp, buf - (bfd_byte *)fragp->fr_literal,
+ fixp = fix_new_exp (fragp, buf - fragp->fr_literal,
4, &exp, false, BFD_RELOC_LARCH_B16);
buf += 4;
break;
@@ -2339,8 +2340,7 @@ loongarch_convert_frag_branch (fragS *fragp)
fixp->fx_file = fragp->fr_file;
fixp->fx_line = fragp->fr_line;
- gas_assert (buf == (bfd_byte *)fragp->fr_literal
- + fragp->fr_fix + fragp->fr_var);
+ gas_assert (buf == fragp->fr_literal + fragp->fr_fix + fragp->fr_var);
fragp->fr_fix += fragp->fr_var;
}
@@ -2350,7 +2350,7 @@ loongarch_convert_frag_branch (fragS *fragp)
static void
loongarch_convert_frag_align (fragS *fragp, asection *sec)
{
- bfd_byte *buf = (bfd_byte *)fragp->fr_literal + fragp->fr_fix;
+ char *buf = fragp->fr_literal + fragp->fr_fix;
offsetT nop_bytes;
if (NULL == fragp->fr_symbol)
@@ -2369,7 +2369,7 @@ loongarch_convert_frag_align (fragS *fragp, asection *sec)
exp.X_add_symbol = fragp->fr_symbol;
exp.X_add_number = fragp->fr_offset;
- fixS *fixp = fix_new_exp (fragp, buf - (bfd_byte *)fragp->fr_literal,
+ fixS *fixp = fix_new_exp (fragp, buf - fragp->fr_literal,
nop_bytes, &exp, false, BFD_RELOC_LARCH_ALIGN);
fixp->fx_file = fragp->fr_file;
fixp->fx_line = fragp->fr_line;
@@ -2377,8 +2377,7 @@ loongarch_convert_frag_align (fragS *fragp, asection *sec)
buf += nop_bytes;
}
- gas_assert (buf == (bfd_byte *)fragp->fr_literal
- + fragp->fr_fix + fragp->fr_var);
+ gas_assert (buf == fragp->fr_literal + fragp->fr_fix + fragp->fr_var);
fragp->fr_fix += fragp->fr_var;
}
diff --git a/gas/config/tc-loongarch.h b/gas/config/tc-loongarch.h
index ebed8e0..38ecd03 100644
--- a/gas/config/tc-loongarch.h
+++ b/gas/config/tc-loongarch.h
@@ -21,8 +21,6 @@
#ifndef TC_LOONGARCH
#define TC_LOONGARCH
-#include "opcode/loongarch.h"
-
#define TARGET_BYTES_BIG_ENDIAN 0
#define TARGET_ARCH bfd_arch_loongarch
@@ -80,26 +78,19 @@ extern int loongarch_force_relocation (struct fix *);
/* If subsy of BFD_RELOC32/64 and PC in same segment, and without relax
or PC at start of subsy or with relax but sub_symbol_segment not in
SEC_CODE, we generate 32/64_PCREL. */
-#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \
- (!(LARCH_opts.thin_add_sub \
- && ((FIX)->fx_r_type == BFD_RELOC_32 \
- ||(FIX)->fx_r_type == BFD_RELOC_64) \
- && (!LARCH_opts.relax \
- || S_GET_VALUE (FIX->fx_subsy) \
- == FIX->fx_frag->fr_address + FIX->fx_where \
- || (LARCH_opts.relax \
- && ((S_GET_SEGMENT (FIX->fx_subsy)->flags & SEC_CODE) == 0)))))
+extern bool loongarch_force_relocation_sub_local (struct fix *, asection *);
+#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEC) \
+ loongarch_force_relocation_sub_local (FIX, SEC)
#define TC_VALIDATE_FIX_SUB(FIX, SEG) 1
#define DIFF_EXPR_OK 1
/* Postpone text-section label subtraction calculation until linking, since
linker relaxations might change the deltas. */
+extern bool loongarch_force_relocation_sub_same(struct fix *, asection *);
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
- (LARCH_opts.relax ? \
- (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC) \
- || ((SEC)->flags & SEC_CODE) != 0) \
- : (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC))) \
+ (loongarch_force_relocation_sub_same (FIX, SEC) \
+ || GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC))
#define TC_LINKRELAX_FIXUP(seg) ((seg->flags & SEC_CODE) \
|| (seg->flags & SEC_DEBUGGING))
@@ -141,7 +132,7 @@ extern void loongarch_pre_output_hook (void);
#define HANDLE_ALIGN(sec, fragp) loongarch_handle_align (fragp)
extern void loongarch_handle_align (struct frag *);
-#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 4)
#define elf_tc_final_processing loongarch_elf_final_processing
extern void loongarch_elf_final_processing (void);
diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c
index 2eddf16..ff91d47 100644
--- a/gas/config/tc-m32c.c
+++ b/gas/config/tc-m32c.c
@@ -380,7 +380,7 @@ valueT
md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & -(1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
symbolS *
@@ -845,7 +845,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
long
md_pcrel_from_section (fixS * fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
/* The symbol is undefined (or is defined but not in this section).
@@ -1136,9 +1136,9 @@ m32c_fix_adjustable (fixS * fixP)
/* We need the symbol name for the VTABLE entries. */
reloc = fixP->fx_r_type;
- if (reloc > (int)BFD_RELOC_UNUSED)
+ if (reloc > BFD_RELOC_UNUSED)
{
- reloc -= (int)BFD_RELOC_UNUSED;
+ reloc -= BFD_RELOC_UNUSED;
switch (reloc)
{
case M32C_OPERAND_DSP_32_S16:
diff --git a/gas/config/tc-m32c.h b/gas/config/tc-m32c.h
index bcdca98..c8e03ed 100644
--- a/gas/config/tc-m32c.h
+++ b/gas/config/tc-m32c.h
@@ -79,5 +79,3 @@ extern int m32c_is_colon_insn (char *, char *);
#define H_TICK_HEX 1
#define NOP_OPCODE (bfd_get_mach (stdoutput) == bfd_mach_m32c ? 0xde : 0x04)
-#define HANDLE_ALIGN(sec, fragP)
-#define MAX_MEM_FOR_RS_ALIGN_CODE 1
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index ba03818..2368c9a 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -35,7 +35,7 @@ typedef struct sym_link
symbolS *symbol;
} sym_linkS;
-static sym_linkS *debug_sym_link = (sym_linkS *) 0;
+static sym_linkS *debug_sym_link = NULL;
/* Structure to hold all of the different components describing
an individual instruction. */
@@ -609,13 +609,13 @@ expand_debug_syms (sym_linkS *syms, int align)
return;
(void) frag_align_code (align, 0);
- for (; syms != (sym_linkS *) 0; syms = next_syms)
+ for (; syms != NULL; syms = next_syms)
{
symbolS *symbolP = syms->symbol;
next_syms = syms->next;
input_line_pointer = (char *) ".\n";
pseudo_set (symbolP);
- free ((char *) syms);
+ free (syms);
}
input_line_pointer = save_input_line;
@@ -627,7 +627,7 @@ m32r_flush_pending_output (void)
if (debug_sym_link)
{
expand_debug_syms (debug_sym_link, 1);
- debug_sym_link = (sym_linkS *) 0;
+ debug_sym_link = NULL;
}
}
@@ -653,7 +653,7 @@ m32r_fill_insn (int done)
if (done && debug_sym_link)
{
expand_debug_syms (debug_sym_link, 1);
- debug_sym_link = (sym_linkS *) 0;
+ debug_sym_link = NULL;
}
return 1;
@@ -911,7 +911,7 @@ assemble_two_insns (char *str1, char *str2, int parallel_p)
fill_insn (0);
first.debug_sym_link = debug_sym_link;
- debug_sym_link = (sym_linkS *) 0;
+ debug_sym_link = NULL;
/* Parse the first instruction. */
if (! (first.insn = m32r_cgen_assemble_insn
@@ -1215,7 +1215,7 @@ md_assemble (char *str)
}
insn.debug_sym_link = debug_sym_link;
- debug_sym_link = (sym_linkS *) 0;
+ debug_sym_link = NULL;
insn.insn = m32r_cgen_assemble_insn
(gas_cgen_cpu_desc, str, &insn.fields, insn.buffer, & errmsg);
@@ -1451,7 +1451,7 @@ md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & -(1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
symbolS *
@@ -1572,8 +1572,7 @@ m32r_scomm (int ignore ATTRIBUTE_UNUSED)
symbol_set_frag (symbolP, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size,
- (char *) 0);
+ pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
*pfrag = 0;
S_SET_SIZE (symbolP, size);
S_SET_SEGMENT (symbolP, sbss_section);
@@ -1582,7 +1581,7 @@ m32r_scomm (int ignore ATTRIBUTE_UNUSED)
}
else
{
- S_SET_VALUE (symbolP, (valueT) size);
+ S_SET_VALUE (symbolP, size);
S_SET_ALIGN (symbolP, align2);
S_SET_EXTERNAL (symbolP);
S_SET_SEGMENT (symbolP, &scom_section);
@@ -1838,7 +1837,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
long
md_pcrel_from_section (fixS *fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec
|| S_IS_EXTERNAL (fixP->fx_addsy)
@@ -2129,10 +2128,10 @@ m32r_fix_adjustable (fixS *fixP)
{
bfd_reloc_code_real_type reloc_type;
- if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
{
const CGEN_INSN *insn = NULL;
- int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+ int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
const CGEN_OPERAND *operand =
cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
diff --git a/gas/config/tc-m32r.h b/gas/config/tc-m32r.h
index 6be96bb..47b7158 100644
--- a/gas/config/tc-m32r.h
+++ b/gas/config/tc-m32r.h
@@ -65,7 +65,7 @@ extern long m32r_relax_frag (segT, fragS *, long);
extern void m32r_handle_align (fragS *);
#define HANDLE_ALIGN(s, f) m32r_handle_align (f)
-#define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2 + 4)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (1 + 2 + 4)
/* Values passed to md_apply_fix don't include the symbol value. */
#define MD_APPLY_SYM_VALUE(FIX) 0
diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c
index d3e2f8b..a9ac9c7 100644
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -189,7 +189,6 @@ struct m9s12xg_opcode_def
/* Local functions. */
static register_id reg_name_search (char *);
static register_id register_name (void);
-static int cmp_opcode (struct m68hc11_opcode *, struct m68hc11_opcode *);
static char *print_opcode_format (struct m68hc11_opcode *, int);
static char *skip_whites (char *);
static int check_range (long, int);
@@ -584,12 +583,14 @@ valueT
md_section_align (asection *seg, valueT addr)
{
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
static int
-cmp_opcode (struct m68hc11_opcode *op1, struct m68hc11_opcode *op2)
+cmp_opcode (const void *p1, const void *p2)
{
+ const struct m68hc11_opcode *op1 = p1;
+ const struct m68hc11_opcode *op2 = p2;
return strcmp (op1->name, op2->name);
}
@@ -639,8 +640,7 @@ md_begin (void)
}
}
}
- qsort (opcodes, num_opcodes, sizeof (struct m68hc11_opcode),
- (int (*) (const void*, const void*)) cmp_opcode);
+ qsort (opcodes, num_opcodes, sizeof (struct m68hc11_opcode), cmp_opcode);
opc = XNEWVEC (struct m68hc11_opcode_def, num_opcodes);
m68hc11_opcode_defs = opc;
@@ -989,7 +989,7 @@ print_opcode_list (void)
printf ("\n");
printf ("%-5.5s ", opcodes->name);
- prev_name = (char *) opcodes->name;
+ prev_name = opcodes->name;
}
if (fmt[0])
printf (" [%s]", fmt);
@@ -1008,7 +1008,7 @@ print_insn_format (char *name)
struct m68hc11_opcode *opcode;
char buf[128];
- opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, name);
+ opc = str_hash_find (m68hc11_hash, name);
if (opc == NULL)
{
as_bad (_("Instruction `%s' is not recognized."), name);
@@ -1934,9 +1934,8 @@ build_jump_insn (struct m68hc11_opcode *opcode, operand operands[],
number_to_chars_bigendian (op, code, 1);
number_to_chars_bigendian (op + 1, 0, 1);
frag_variant (rs_machine_dependent, 1, 1,
- ENCODE_RELAX (STATE_PC_RELATIVE, STATE_UNDF),
- operands[0].exp.X_add_symbol, (offsetT) n,
- op);
+ ENCODE_RELAX (STATE_PC_RELATIVE, STATE_UNDF),
+ operands[0].exp.X_add_symbol, n, op);
}
else if (current_architecture & cpu6812)
{
@@ -1945,7 +1944,7 @@ build_jump_insn (struct m68hc11_opcode *opcode, operand operands[],
number_to_chars_bigendian (op + 1, 0, 1);
frag_var (rs_machine_dependent, 2, 2,
ENCODE_RELAX (STATE_CONDITIONAL_BRANCH_6812, STATE_UNDF),
- operands[0].exp.X_add_symbol, (offsetT) n, op);
+ operands[0].exp.X_add_symbol, n, op);
}
else
{
@@ -1954,7 +1953,7 @@ build_jump_insn (struct m68hc11_opcode *opcode, operand operands[],
number_to_chars_bigendian (op + 1, 0, 1);
frag_var (rs_machine_dependent, 3, 3,
ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_UNDF),
- operands[0].exp.X_add_symbol, (offsetT) n, op);
+ operands[0].exp.X_add_symbol, n, op);
}
}
}
@@ -2044,7 +2043,7 @@ build_dbranch_insn (struct m68hc11_opcode *opcode, operand operands[],
number_to_chars_bigendian (f + 1, 0, 1);
frag_var (rs_machine_dependent, 3, 3,
ENCODE_RELAX (STATE_XBCC_BRANCH, STATE_UNDF),
- operands[1].exp.X_add_symbol, (offsetT) n, f);
+ operands[1].exp.X_add_symbol, n, f);
}
}
}
@@ -2848,7 +2847,7 @@ md_assemble (char *str)
if (current_architecture == cpuxgate)
{
/* Find the opcode definition given its name. */
- opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, name);
+ opc = str_hash_find (m68hc11_hash, name);
if (opc == NULL)
{
as_bad (_("Opcode `%s' is not recognized."), name);
@@ -3469,7 +3468,7 @@ md_assemble (char *str)
}
/* Find the opcode definition given its name. */
- opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, name);
+ opc = str_hash_find (m68hc11_hash, name);
/* If it's not recognized, look for 'jbsr' and 'jbxx'. These are
pseudo insns for relative branch. For these branches, we always
@@ -3477,8 +3476,7 @@ md_assemble (char *str)
is given. */
if (opc == NULL && name[0] == 'j' && name[1] == 'b')
{
- opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash,
- &name[1]);
+ opc = str_hash_find (m68hc11_hash, &name[1]);
if (opc
&& (!(opc->format & M6811_OP_JUMP_REL)
|| (opc->format & M6811_OP_BITMASK)))
@@ -3509,8 +3507,7 @@ md_assemble (char *str)
{
name[nlen++] = TOLOWER (*op_end++);
name[nlen] = 0;
- opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash,
- name);
+ opc = str_hash_find (m68hc11_hash, name);
}
}
}
@@ -3838,7 +3835,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
reloc->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_16);
else
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("Relocation %d is not supported by object file format."),
@@ -4329,11 +4326,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
char *where;
long value = * valP;
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
/* We don't actually support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
/* Patch the instruction with the resolved operand. Elf relocation
@@ -4350,19 +4347,19 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
switch (fixP->fx_r_type)
{
case BFD_RELOC_32:
- bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb32 (value, where);
break;
case BFD_RELOC_24:
case BFD_RELOC_M68HC11_24:
- bfd_putb16 ((bfd_vma) (value & 0x0ffff), (unsigned char *) where);
- ((bfd_byte*) where)[2] = ((value >> 16) & 0x0ff);
+ bfd_putb16 (value & 0x0ffff, where);
+ where[2] = (value >> 16) & 0xff;
break;
case BFD_RELOC_16:
case BFD_RELOC_16_PCREL:
case BFD_RELOC_M68HC11_LO16:
- bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb16 (value, where);
if (value < -65537 || value > 65535)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value out of 16-bit range."));
@@ -4379,11 +4376,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_M68HC11_LO8:
case BFD_RELOC_8:
case BFD_RELOC_M68HC11_PAGE:
- ((bfd_byte *) where)[0] = (bfd_byte) value;
+ where[0] = value & 0xff;
break;
case BFD_RELOC_8_PCREL:
- ((bfd_byte *) where)[0] = (bfd_byte) value;
+ where[0] = value & 0xff;
if (value < -128 || value > 127)
as_bad_where (fixP->fx_file, fixP->fx_line,
@@ -4393,8 +4390,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
/* These next two are for XGATE. */
case BFD_RELOC_M68HC12_9_PCREL:
- ((bfd_byte *) where)[0] |= (bfd_byte) ((value >>9) & 0x01);
- ((bfd_byte *) where)[1] = (bfd_byte) ((value>>1) & 0xff);
+ where[0] |= (value >> 9) & 0x01;
+ where[1] = (value >> 1) & 0xff;
if (value < -512 || value > 511)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value %ld too large for 9-bit PC-relative branch."),
@@ -4402,8 +4399,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
break;
case BFD_RELOC_M68HC12_10_PCREL:
- ((bfd_byte *) where)[0] |= (bfd_byte) ((value >>9) & 0x03);
- ((bfd_byte *) where)[1] = (bfd_byte) ((value>>1) & 0xff);
+ where[0] |= (value >> 9) & 0x03;
+ where[1] = (value>> 1) & 0xff;
if (value < -1024 || value > 1023)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value %ld too large for 10-bit PC-relative branch."),
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index 0f36741..e5c8f5c 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -1357,7 +1357,7 @@ m68k_ip (char *instring)
c = *p;
*p = '\0';
- opcode = (const struct m68k_incant *) str_hash_find (op_hash, instring);
+ opcode = str_hash_find (op_hash, instring);
*p = c;
if (pdot != NULL)
@@ -4410,7 +4410,7 @@ md_assemble (char *str)
fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix;
}
(void) frag_var (rs_machine_dependent, FRAG_VAR_SIZE, 0,
- (relax_substateT) (the_ins.fragb[n].fragty),
+ the_ins.fragb[n].fragty,
the_ins.fragb[n].fadd, the_ins.fragb[n].foff, to_beg_P);
}
gas_assert (the_ins.nfrag >= 1);
@@ -4560,7 +4560,7 @@ md_begin (void)
{
const char *name = m68k_opcode_aliases[i].primary;
const char *alias = m68k_opcode_aliases[i].alias;
- void *val = (void *) str_hash_find (op_hash, name);
+ void *val = str_hash_find (op_hash, name);
if (!val)
as_fatal (_("Internal Error: Can't find %s in hash table"), name);
@@ -4598,7 +4598,7 @@ md_begin (void)
{
const char *name = mri_aliases[i].primary;
const char *alias = mri_aliases[i].alias;
- void *val = (void *) str_hash_find (op_hash, name);
+ void *val = str_hash_find (op_hash, name);
if (!val)
as_fatal (_("Internal Error: Can't find %s in hash table"), name);
@@ -6417,7 +6417,7 @@ parse_mri_control_expression (char *stop, int qual, const char *truelab,
flab = mri_control_label ();
build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
- rightstop, (const char *) NULL, flab, extent);
+ rightstop, NULL, flab, extent);
input_line_pointer += 3;
if (*input_line_pointer != '.'
@@ -6452,7 +6452,7 @@ parse_mri_control_expression (char *stop, int qual, const char *truelab,
tlab = mri_control_label ();
build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
- rightstop, tlab, (const char *) NULL, extent);
+ rightstop, tlab, NULL, extent);
input_line_pointer += 2;
if (*input_line_pointer != '.'
@@ -6554,7 +6554,7 @@ s_mri_if (int qual)
n = push_mri_control (mri_if);
- parse_mri_control_expression (s - 3, qual, (const char *) NULL,
+ parse_mri_control_expression (s - 3, qual, NULL,
n->next, s[1] == '.' ? s[2] : '\0');
if (s[1] == '.')
@@ -6754,7 +6754,6 @@ s_mri_for (int qual)
struct mri_control_info *n;
char *buf;
char *s;
- char ex[2];
/* The syntax is
FOR.q var = init { TO | DOWNTO } end [ BY by ] DO.e
@@ -6935,12 +6934,14 @@ s_mri_for (int qual)
mri_assemble (buf);
/* bcc bottom. */
- ex[0] = TOLOWER (extent);
- ex[1] = '\0';
- if (up)
- sprintf (buf, "blt%s %s", ex, n->bottom);
- else
- sprintf (buf, "bgt%s %s", ex, n->bottom);
+ s = buf;
+ *s++ = 'b';
+ *s++ = up ? 'l' : 'g';
+ *s++ = 't';
+ if (extent != '\0')
+ *s++ = TOLOWER (extent);
+ *s++ = ' ';
+ strcpy (s, n->bottom);
mri_assemble (buf);
/* Put together the add or sub instruction used by ENDF. */
@@ -7042,7 +7043,7 @@ s_mri_until (int qual)
for (s = input_line_pointer; ! is_end_of_stmt (*s); s++)
;
- parse_mri_control_expression (s, qual, (const char *) NULL,
+ parse_mri_control_expression (s, qual, NULL,
mri_control_stack->top, '\0');
colon (mri_control_stack->bottom);
@@ -7099,7 +7100,7 @@ s_mri_while (int qual)
colon (n->next);
- parse_mri_control_expression (s - 1, qual, (const char *) NULL, n->bottom,
+ parse_mri_control_expression (s - 1, qual, NULL, n->bottom,
s[1] == '.' ? s[2] : '\0');
input_line_pointer = s + 1;
@@ -7332,7 +7333,7 @@ m68k_set_extension (char const *name, int allow_m, int silent)
if (negated)
not_current_architecture |= (ext->control_regs
- ? *(unsigned *)ext->control_regs: ext->arch);
+ ? *ext->control_regs: ext->arch);
else
current_architecture |= ext->arch;
return 1;
@@ -7903,7 +7904,7 @@ m68k_elf_cons (int nbytes /* 4=.long */)
}
}
else
- emit_expr (&exp, (unsigned int) nbytes);
+ emit_expr (&exp, nbytes);
}
while (*input_line_pointer++ == ',');
diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c
index 38e6637..f20f0d3 100644
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -882,7 +882,7 @@ md_assemble (char * str)
return;
}
- opcode = (mcore_opcode_info *) str_hash_find (opcode_hash_control, name);
+ opcode = str_hash_find (opcode_hash_control, name);
if (opcode == NULL)
{
as_bad (_("unknown opcode \"%s\""), name);
@@ -2139,7 +2139,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
/* If the symbol is undefined or defined in another section
we leave the add number alone for the linker to fix it later.
Only account for the PC pre-bump (which is 2 bytes on the MCore). */
- if (fixp->fx_addsy != (symbolS *) NULL
+ if (fixp->fx_addsy != NULL
&& (! S_IS_DEFINED (fixp->fx_addsy)
|| (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c
index 5e53421..1469186 100644
--- a/gas/config/tc-mep.c
+++ b/gas/config/tc-mep.c
@@ -1381,7 +1381,7 @@ valueT
md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & -(1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
@@ -1807,7 +1807,7 @@ mep_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
long
md_pcrel_from_section (fixS *fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| S_IS_WEAK (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
@@ -2051,10 +2051,10 @@ mep_fix_adjustable (fixS *fixP)
{
bfd_reloc_code_real_type reloc_type;
- if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
{
const CGEN_INSN *insn = NULL;
- int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+ int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
const CGEN_OPERAND *operand
= cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
reloc_type = md_cgen_lookup_reloc (insn, operand, fixP);
diff --git a/gas/config/tc-metag.c b/gas/config/tc-metag.c
index 3a36d6a..968c88d 100644
--- a/gas/config/tc-metag.c
+++ b/gas/config/tc-metag.c
@@ -267,7 +267,7 @@ parse_gp_reg (const char *name)
entry.name = name;
- reg = (const metag_reg *) htab_find (reg_htab, &entry);
+ reg = htab_find (reg_htab, &entry);
return reg;
}
@@ -4112,7 +4112,7 @@ __parse_dsp_reg (const char *line, const metag_reg **reg, htab_t dsp_regtab)
name[len] = '\0';
entry.name = name;
- _reg = (const metag_reg *) htab_find (dsp_regtab, &entry);
+ _reg = htab_find (dsp_regtab, &entry);
if (!_reg)
return NULL;
@@ -4380,11 +4380,10 @@ parse_dsp_addr (const char *line, metag_addr *addr, unsigned int size,
l = parse_dsp_regs_list (l, regs, 1, &regs_read, true, true, load, false);
- if (l == NULL)
+ if (l == NULL || regs_read == 0)
return NULL;
- if (!is_addr_unit (regs[0]->unit) &&
- !is_dspram_reg (regs[0]))
+ if (!is_addr_unit (regs[0]->unit) && !is_dspram_reg (regs[0]))
{
as_bad (_("invalid register for memory access"));
return NULL;
@@ -4434,7 +4433,7 @@ parse_dsp_addr (const char *line, metag_addr *addr, unsigned int size,
l = parse_dsp_regs_list (l, regs, 1, &regs_read, true, true, load, false);
- if (l == NULL)
+ if (l == NULL || regs_read == 0)
return NULL;
if (regs[0]->unit != addr->base_reg->unit)
@@ -4522,7 +4521,7 @@ parse_dget_set (const char *line, metag_insn *insn,
false, false);
}
- if (l == NULL)
+ if (l == NULL || regs_read == 0)
return NULL;
/* The first register dictates the unit. */
@@ -6004,7 +6003,7 @@ parse_split_condition (const char *line, metag_insn *insn)
entry.name = buf;
- scond = (const split_condition *) htab_find (scond_htab, &entry);
+ scond = htab_find (scond_htab, &entry);
if (!scond)
return NULL;
@@ -6264,10 +6263,9 @@ find_insn_templates (const char *mnemonic)
insn_templates *slot;
entry.template = &template;
+ template.name = mnemonic;
- memcpy ((void *)&entry.template->name, &mnemonic, sizeof (char *));
-
- slot = (insn_templates *) htab_find (mnemonic_htab, &entry);
+ slot = htab_find (mnemonic_htab, &entry);
if (slot)
return slot;
@@ -6308,8 +6306,8 @@ hash_templates (const void *p)
static int
eq_templates (const void *a, const void *b)
{
- insn_templates *ta = (insn_templates *)a;
- insn_templates *tb = (insn_templates *)b;
+ const insn_templates *ta = a;
+ const insn_templates *tb = b;
return strcasecmp (ta->template->name, tb->template->name) == 0;
}
@@ -6325,7 +6323,7 @@ create_mnemonic_htab (void)
for (i = 0; i < num_templates; i++)
{
const insn_template *template = &metag_optab[i];
- insn_templates **slot = NULL;
+ void **slot;
insn_templates *new_entry;
new_entry = XNEW (insn_templates);
@@ -6333,8 +6331,7 @@ create_mnemonic_htab (void)
new_entry->template = template;
new_entry->next = NULL;
- slot = (insn_templates **) htab_find_slot (mnemonic_htab, new_entry,
- INSERT);
+ slot = htab_find_slot (mnemonic_htab, new_entry, INSERT);
if (*slot)
{
@@ -6356,7 +6353,7 @@ create_mnemonic_htab (void)
static hashval_t
hash_regs (const void *p)
{
- metag_reg *rp = (metag_reg *)p;
+ const metag_reg *rp = p;
char buf[MAX_REG_LEN];
strupper (buf, rp->name);
@@ -6368,8 +6365,8 @@ hash_regs (const void *p)
static int
eq_regs (const void *a, const void *b)
{
- metag_reg *ra = (metag_reg *)a;
- metag_reg *rb = (metag_reg *)b;
+ const metag_reg *ra = a;
+ const metag_reg *rb = b;
return strcasecmp (ra->name, rb->name) == 0;
}
@@ -6458,8 +6455,8 @@ hash_scond (const void *p)
static int
eq_scond (const void *a, const void *b)
{
- split_condition *ra = (split_condition *)a;
- split_condition *rb = (split_condition *)b;
+ const split_condition *ra = a;
+ const split_condition *rb = b;
return strcasecmp (ra->name, rb->name) == 0;
}
@@ -6739,8 +6736,7 @@ md_atof (int type, char * litP, int * sizeP)
for (i = 0; i < prec; i++)
{
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
@@ -6842,34 +6838,26 @@ void
metag_handle_align (fragS * fragP)
{
static unsigned char const noop[4] = { 0xfe, 0xff, 0xff, 0xa0 };
- int bytes, fix;
- char *p;
if (fragP->fr_type != rs_align_code)
return;
- bytes = fragP->fr_next->fr_address - fragP->fr_address - fragP->fr_fix;
- p = fragP->fr_literal + fragP->fr_fix;
- fix = 0;
-
- if (bytes & 3)
+ int bytes = fragP->fr_next->fr_address - fragP->fr_address - fragP->fr_fix;
+ char *p = fragP->fr_literal + fragP->fr_fix;
+ int fix = bytes & 3;
+ if (fix != 0)
{
- fix = bytes & 3;
memset (p, 0, fix);
p += fix;
bytes -= fix;
+ fragP->fr_fix += fix;
}
- while (bytes >= 4)
+ if (bytes != 0)
{
+ fragP->fr_var = 4;
memcpy (p, noop, 4);
- p += 4;
- bytes -= 4;
- fix += 4;
}
-
- fragP->fr_fix += fix;
- fragP->fr_var = 4;
}
static char *
@@ -7038,7 +7026,7 @@ void
md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
- int value = (int)*valP;
+ int value = *valP;
switch (fixP->fx_r_type)
{
diff --git a/gas/config/tc-metag.h b/gas/config/tc-metag.h
index 9d112c4..92cb0b4 100644
--- a/gas/config/tc-metag.h
+++ b/gas/config/tc-metag.h
@@ -52,6 +52,7 @@ extern int metag_force_relocation (struct fix *);
/* Call md_pcrel_from_section(), not md_pcrel_from(). */
#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 4)
#define HANDLE_ALIGN(sec, fragp) metag_handle_align (fragp)
extern void metag_handle_align (struct frag *);
diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
index 035a867..055d9ee 100644
--- a/gas/config/tc-microblaze.c
+++ b/gas/config/tc-microblaze.c
@@ -244,8 +244,7 @@ microblaze_s_lcomm (int xxx ATTRIBUTE_UNUSED)
if (S_GET_SEGMENT (symbolP) == current_seg)
symbol_get_frag (symbolP)->fr_symbol = 0;
symbol_set_frag (symbolP, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size,
- (char *) 0);
+ pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
*pfrag = 0;
S_SET_SIZE (symbolP, size);
S_SET_SEGMENT (symbolP, current_seg);
@@ -485,7 +484,7 @@ parse_reg (char * s, unsigned * reg)
}
else
as_bad (_("register expected, but saw '%.6s'"), s);
- if ((int) tmpreg >= MIN_PVR_REGNUM && tmpreg <= MAX_PVR_REGNUM)
+ if (tmpreg - MIN_PVR_REGNUM <= MAX_PVR_REGNUM - MIN_PVR_REGNUM)
*reg = REG_PVR + tmpreg;
else
{
@@ -514,7 +513,7 @@ parse_reg (char * s, unsigned * reg)
else
as_bad (_("register expected, but saw '%.6s'"), s);
- if ((int) tmpreg >= MIN_REGNUM && tmpreg <= MAX_REGNUM)
+ if (tmpreg - MIN_REGNUM <= MAX_REGNUM - MIN_REGNUM)
*reg = tmpreg;
else
{
@@ -551,7 +550,7 @@ parse_reg (char * s, unsigned * reg)
else
as_bad (_("register expected, but saw '%.6s'"), s);
- if ((int)tmpreg >= MIN_REGNUM && tmpreg <= MAX_REGNUM)
+ if (tmpreg - MIN_REGNUM <= MAX_REGNUM - MIN_REGNUM)
*reg = tmpreg;
else
{
@@ -914,7 +913,7 @@ md_assemble (char * str)
return;
}
- opcode = (struct op_code_struct *) str_hash_find (opcode_hash_control, name);
+ opcode = str_hash_find (opcode_hash_control, name);
if (opcode == NULL)
{
as_bad (_("unknown opcode \"%s\""), name);
@@ -1044,13 +1043,9 @@ md_assemble (char * str)
count = 32 - reg1;
if (streq (name, "lmi"))
- opcode
- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
- "lwi");
+ opcode = str_hash_find (opcode_hash_control, "lwi");
else
- opcode
- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
- "swi");
+ opcode = str_hash_find (opcode_hash_control, "swi");
if (opcode == NULL)
{
as_bad (_("unknown opcode \"%s\""), "lwi");
@@ -1082,9 +1077,7 @@ md_assemble (char * str)
if ((temp != 0) && (temp != 0xFFFF8000))
{
/* Needs an immediate inst. */
- opcode1
- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
- "imm");
+ opcode1 = str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
@@ -1618,9 +1611,7 @@ md_assemble (char * str)
if ((temp != 0) && (temp != 0xFFFF8000))
{
/* Needs an immediate inst. */
- opcode1
- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
- "imm");
+ opcode1 = str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
@@ -1686,9 +1677,7 @@ md_assemble (char * str)
if ((temp != 0) && (temp != 0xFFFF8000))
{
/* Needs an immediate inst. */
- opcode1
- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
- "imm");
+ opcode1 = str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
@@ -1761,9 +1750,7 @@ md_assemble (char * str)
if ((temp != 0) && (temp != 0xFFFF8000))
{
/* Needs an immediate inst. */
- opcode1
- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
- "imm");
+ opcode1 = str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
@@ -1885,17 +1872,15 @@ md_atof (int type, char * litP, int * sizeP)
{
for (i = prec - 1; i >= 0; i--)
{
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
+ md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
+ litP += sizeof (LITTLENUM_TYPE);
}
}
else
for (i = 0; i < prec; i++)
{
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
+ md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
+ litP += sizeof (LITTLENUM_TYPE);
}
return NULL;
@@ -2054,7 +2039,7 @@ md_apply_fix (fixS * fixP,
const char * file = fixP->fx_file ? fixP->fx_file : _("unknown");
const char * symname;
/* Note: use offsetT because it is signed, valueT is unsigned. */
- offsetT val = (offsetT) * valp;
+ offsetT val = *valp;
int i;
struct op_code_struct * opcode1;
unsigned long inst1;
@@ -2185,8 +2170,7 @@ md_apply_fix (fixS * fixP,
buf[i + INST_WORD_SIZE] = buf[i];
/* Generate the imm instruction. */
- opcode1
- = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
+ opcode1 = str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
@@ -2234,8 +2218,7 @@ md_apply_fix (fixS * fixP,
buf[i + INST_WORD_SIZE] = buf[i];
/* Generate the imm instruction. */
- opcode1
- = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
+ opcode1 = str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
@@ -2459,7 +2442,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
we leave the add number alone for the linker to fix it later.
Only account for the PC pre-bump (No PC-pre-bump on the Microblaze). */
- if (fixp->fx_addsy != (symbolS *) NULL
+ if (fixp->fx_addsy != NULL
&& (!S_IS_DEFINED (fixp->fx_addsy)
|| (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
return 0;
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index eeb34ef..7d0d855 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -1135,8 +1135,7 @@ static bool mips_ignore_branch_isa;
but it's not clear that it would actually improve performance. */
#define RELAX_BRANCH_ENCODE(at, pic, \
uncond, likely, link, toofar) \
- ((relax_substateT) \
- (0xc0000000 \
+ ((0xc0000000 \
| ((at) & 0x1f) \
| ((pic) ? 0x20 : 0) \
| ((toofar) ? 0x40 : 0) \
@@ -2407,9 +2406,9 @@ static unsigned long
read_insn (char *buf)
{
if (target_big_endian)
- return bfd_getb32 ((bfd_byte *) buf);
+ return bfd_getb32 (buf);
else
- return bfd_getl32 ((bfd_byte *) buf);
+ return bfd_getl32 (buf);
}
/* Write standard MIPS instruction INSN to BUF. Return a pointer to
@@ -2436,9 +2435,9 @@ read_compressed_insn (char *buf, unsigned int length)
{
insn <<= 16;
if (target_big_endian)
- insn |= bfd_getb16 ((char *) buf);
+ insn |= bfd_getb16 (buf);
else
- insn |= bfd_getl16 ((char *) buf);
+ insn |= bfd_getl16 (buf);
buf += 2;
}
return insn;
@@ -2617,7 +2616,7 @@ set_insn_error_ss (int argnum, const char *msg, const char *s1, const char *s2)
static void
report_insn_error (const char *str)
{
- const char *msg = concat (insn_error.msg, " `%s'", NULL);
+ const char *msg = concat (insn_error.msg, " `%s'", (const char *) NULL);
switch (insn_error.format)
{
@@ -3384,7 +3383,7 @@ mips_parse_arguments (char *s, char float_format)
SKIP_SPACE_TABS (s);
}
mips_add_token (&token, OT_END);
- return (struct mips_operand_token *) obstack_finish (&mips_operand_tokens);
+ return obstack_finish (&mips_operand_tokens);
}
/* Return TRUE if opcode MO is valid on the currently selected ISA, ASE
@@ -3881,7 +3880,7 @@ md_begin (void)
if (mips_abi != N64_ABI)
{
- sec = subseg_new (".reginfo", (subsegT) 0);
+ sec = subseg_new (".reginfo", 0);
bfd_set_section_flags (sec, flags);
bfd_set_section_alignment (sec, HAVE_NEWABI ? 3 : 2);
@@ -3892,7 +3891,7 @@ md_begin (void)
{
/* The 64-bit ABI uses a .MIPS.options section rather than
.reginfo section. */
- sec = subseg_new (".MIPS.options", (subsegT) 0);
+ sec = subseg_new (".MIPS.options", 0);
bfd_set_section_flags (sec, flags);
bfd_set_section_alignment (sec, 3);
@@ -3914,7 +3913,7 @@ md_begin (void)
}
}
- sec = subseg_new (".MIPS.abiflags", (subsegT) 0);
+ sec = subseg_new (".MIPS.abiflags", 0);
bfd_set_section_flags (sec,
SEC_READONLY | SEC_DATA | SEC_ALLOC | SEC_LOAD);
bfd_set_section_alignment (sec, 3);
@@ -3922,13 +3921,13 @@ md_begin (void)
if (ECOFF_DEBUGGING)
{
- sec = subseg_new (".mdebug", (subsegT) 0);
+ sec = subseg_new (".mdebug", 0);
bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY);
bfd_set_section_alignment (sec, 2);
}
else if (mips_flag_pdr)
{
- pdr_seg = subseg_new (".pdr", (subsegT) 0);
+ pdr_seg = subseg_new (".pdr", 0);
bfd_set_section_flags (pdr_seg,
SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
bfd_set_section_alignment (pdr_seg, 2);
@@ -4329,14 +4328,16 @@ got16_reloc_p (bfd_reloc_code_real_type reloc)
static inline bool
hi16_reloc_p (bfd_reloc_code_real_type reloc)
{
- return (reloc == BFD_RELOC_HI16_S || reloc == BFD_RELOC_MIPS16_HI16_S
+ return (reloc == BFD_RELOC_HI16_S || reloc == BFD_RELOC_HI16_S_PCREL
+ || reloc == BFD_RELOC_MIPS16_HI16_S
|| reloc == BFD_RELOC_MICROMIPS_HI16_S);
}
static inline bool
lo16_reloc_p (bfd_reloc_code_real_type reloc)
{
- return (reloc == BFD_RELOC_LO16 || reloc == BFD_RELOC_MIPS16_LO16
+ return (reloc == BFD_RELOC_LO16 || reloc == BFD_RELOC_LO16_PCREL
+ || reloc == BFD_RELOC_MIPS16_LO16
|| reloc == BFD_RELOC_MICROMIPS_LO16);
}
@@ -4403,8 +4404,9 @@ static inline bfd_reloc_code_real_type
matching_lo_reloc (bfd_reloc_code_real_type reloc)
{
return (mips16_reloc_p (reloc) ? BFD_RELOC_MIPS16_LO16
- : (micromips_reloc_p (reloc) ? BFD_RELOC_MICROMIPS_LO16
- : BFD_RELOC_LO16));
+ : micromips_reloc_p (reloc) ? BFD_RELOC_MICROMIPS_LO16
+ : reloc == BFD_RELOC_HI16_S_PCREL ? BFD_RELOC_LO16_PCREL
+ : BFD_RELOC_LO16);
}
/* Return true if the given fixup is followed by a matching R_MIPS_LO16
@@ -4416,7 +4418,12 @@ fixup_has_matching_lo_p (fixS *fixp)
return (fixp->fx_next != NULL
&& fixp->fx_next->fx_r_type == matching_lo_reloc (fixp->fx_r_type)
&& fixp->fx_addsy == fixp->fx_next->fx_addsy
- && fixp->fx_offset == fixp->fx_next->fx_offset);
+ && (fixp->fx_r_type == BFD_RELOC_HI16_S_PCREL
+ ? (fixp->fx_next->fx_offset - fixp->fx_offset
+ == ((fixp->fx_next->fx_frag->fr_address
+ + fixp->fx_next->fx_where)
+ - (fixp->fx_frag->fr_address + fixp->fx_where)))
+ : fixp->fx_offset == fixp->fx_next->fx_offset));
}
/* Move all labels in LABELS to the current insertion point. TEXT_P
@@ -6170,7 +6177,7 @@ match_float_constant (struct mips_arg_info *arg, expressionS *imm,
newname = ".lit8";
}
- new_seg = subseg_new (newname, (subsegT) 0);
+ new_seg = subseg_new (newname, 0);
bfd_set_section_flags (new_seg,
SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA);
frag_align (length == 4 ? 2 : 3, 0, 0);
@@ -7728,17 +7735,16 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
&& delayed_branch_p (ip))
{
relaxed_branch = true;
- add_relaxed_insn (ip, (relaxed_branch_length
- (NULL, NULL,
- uncond_branch_p (ip) ? -1
- : branch_likely_p (ip) ? 1
- : 0)), 4,
- RELAX_BRANCH_ENCODE
- (AT, mips_pic != NO_PIC,
- uncond_branch_p (ip),
- branch_likely_p (ip),
- pinfo & INSN_WRITE_GPR_31,
- 0),
+ add_relaxed_insn (ip,
+ relaxed_branch_length (NULL, NULL,
+ uncond_branch_p (ip) ? -1
+ : branch_likely_p (ip) ? 1
+ : 0),
+ 4,
+ RELAX_BRANCH_ENCODE (AT, mips_pic != NO_PIC,
+ uncond_branch_p (ip),
+ branch_likely_p (ip),
+ pinfo & INSN_WRITE_GPR_31, 0),
address_expr->X_add_symbol,
address_expr->X_add_number);
*reloc_type = BFD_RELOC_UNUSED;
@@ -7814,15 +7820,15 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
offset = 0;
}
add_relaxed_insn (ip, 12, 0,
- RELAX_MIPS16_ENCODE
- (*reloc_type - BFD_RELOC_UNUSED,
- mips_opts.ase & ASE_MIPS16E2,
- mips_pic != NO_PIC,
- HAVE_32BIT_SYMBOLS,
- mips_opts.warn_about_macros,
- require_unextended, require_extended,
- delayed_branch_p (&history[0]),
- history[0].mips16_absolute_jump_p),
+ RELAX_MIPS16_ENCODE (*reloc_type - BFD_RELOC_UNUSED,
+ mips_opts.ase & ASE_MIPS16E2,
+ mips_pic != NO_PIC,
+ HAVE_32BIT_SYMBOLS,
+ mips_opts.warn_about_macros,
+ require_unextended,
+ require_extended,
+ delayed_branch_p (&history[0]),
+ history[0].mips16_absolute_jump_p),
symbol, offset);
}
else if (mips_opts.mips16 && insn_length (ip) == 2)
@@ -8438,7 +8444,7 @@ match_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode,
case 'D':
case 'E':
if (!forced_insn_length)
- *offset_reloc = (int) BFD_RELOC_UNUSED + c;
+ *offset_reloc = BFD_RELOC_UNUSED + c;
else if (c == 'D')
*offset_reloc = BFD_RELOC_MICROMIPS_10_PCREL_S1;
else
@@ -8566,7 +8572,7 @@ match_mips16_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode,
}
}
else if (relax_char)
- *offset_reloc = (int) BFD_RELOC_UNUSED + relax_char;
+ *offset_reloc = BFD_RELOC_UNUSED + relax_char;
check_completed_insn (&arg);
return true;
@@ -8988,11 +8994,11 @@ macro_read_relocs (va_list *args, bfd_reloc_code_real_type *r)
next = va_arg (*args, int);
if (next >= 0)
- r[0] = (bfd_reloc_code_real_type) next;
+ r[0] = next;
else
{
for (i = 0; i < 3; i++)
- r[i] = (bfd_reloc_code_real_type) va_arg (*args, int);
+ r[i] = va_arg (*args, int);
/* This function is only used for 16-bit relocation fields.
To make the macro code simpler, treat an unrelocated value
in the same way as BFD_RELOC_LO16. */
@@ -9031,7 +9037,7 @@ macro_build (expressionS *ep, const char *name, const char *fmt, ...)
r[1] = BFD_RELOC_UNUSED;
r[2] = BFD_RELOC_UNUSED;
hash = mips_opts.micromips ? micromips_op_hash : op_hash;
- amo = (struct mips_opcode *) str_hash_find (hash, name);
+ amo = str_hash_find (hash, name);
gas_assert (amo);
gas_assert (strcmp (name, amo->name) == 0);
@@ -9189,7 +9195,7 @@ mips16_macro_build (expressionS *ep, const char *name, const char *fmt,
bfd_reloc_code_real_type r[3]
= {BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED};
- mo = (struct mips_opcode *) str_hash_find (mips16_op_hash, name);
+ mo = str_hash_find (mips16_op_hash, name);
gas_assert (mo);
gas_assert (strcmp (name, mo->name) == 0);
@@ -9240,7 +9246,7 @@ mips16_macro_build (expressionS *ep, const char *name, const char *fmt,
gas_assert (ep != NULL);
if (ep->X_op != O_constant)
- *r = (int) BFD_RELOC_UNUSED + c;
+ *r = BFD_RELOC_UNUSED + c;
else if (calculate_reloc (*r, ep->X_add_number, &value))
{
mips16_immed (NULL, 0, c, *r, value, 0, &insn.insn_opcode);
@@ -11120,7 +11126,7 @@ macro (struct mips_cl_insn *ip, char *str)
}
else if (!mips_big_got && !HAVE_NEWABI)
{
- int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT16;
+ int lw_reloc_type = BFD_RELOC_MIPS_GOT16;
/* If this is a reference to an external symbol, and there
is no constant, we want
@@ -11157,7 +11163,7 @@ macro (struct mips_cl_insn *ip, char *str)
if (mips_pic == SVR4_PIC
&& breg == 0
&& (call || tempreg == PIC_CALL_REG))
- lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16;
+ lw_reloc_type = BFD_RELOC_MIPS_CALL16;
relax_start (offset_expr.X_add_symbol);
macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg,
@@ -11319,9 +11325,9 @@ macro (struct mips_cl_insn *ip, char *str)
else if (mips_big_got && !HAVE_NEWABI)
{
int gpdelay;
- int lui_reloc_type = (int) BFD_RELOC_MIPS_GOT_HI16;
- int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT_LO16;
- int local_reloc_type = (int) BFD_RELOC_MIPS_GOT16;
+ int lui_reloc_type = BFD_RELOC_MIPS_GOT_HI16;
+ int lw_reloc_type = BFD_RELOC_MIPS_GOT_LO16;
+ int local_reloc_type = BFD_RELOC_MIPS_GOT16;
/* This is the large GOT case. If this is a reference to an
external symbol, and there is no constant, we want
@@ -11371,8 +11377,8 @@ macro (struct mips_cl_insn *ip, char *str)
if (expr1.X_add_number == 0 && breg == 0
&& (call || tempreg == PIC_CALL_REG))
{
- lui_reloc_type = (int) BFD_RELOC_MIPS_CALL_HI16;
- lw_reloc_type = (int) BFD_RELOC_MIPS_CALL_LO16;
+ lui_reloc_type = BFD_RELOC_MIPS_CALL_HI16;
+ lw_reloc_type = BFD_RELOC_MIPS_CALL_LO16;
}
macro_build (&offset_expr, "lui", LUI_FMT, tempreg, lui_reloc_type);
macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t",
@@ -11474,8 +11480,8 @@ macro (struct mips_cl_insn *ip, char *str)
}
else if (mips_big_got && HAVE_NEWABI)
{
- int lui_reloc_type = (int) BFD_RELOC_MIPS_GOT_HI16;
- int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT_LO16;
+ int lui_reloc_type = BFD_RELOC_MIPS_GOT_HI16;
+ int lw_reloc_type = BFD_RELOC_MIPS_GOT_LO16;
int add_breg_early = 0;
/* This is the large GOT case. If this is a reference to an
@@ -11517,8 +11523,8 @@ macro (struct mips_cl_insn *ip, char *str)
if (expr1.X_add_number == 0 && breg == 0
&& (call || tempreg == PIC_CALL_REG))
{
- lui_reloc_type = (int) BFD_RELOC_MIPS_CALL_HI16;
- lw_reloc_type = (int) BFD_RELOC_MIPS_CALL_LO16;
+ lui_reloc_type = BFD_RELOC_MIPS_CALL_HI16;
+ lw_reloc_type = BFD_RELOC_MIPS_CALL_LO16;
}
macro_build (&offset_expr, "lui", LUI_FMT, tempreg, lui_reloc_type);
macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t",
@@ -12532,7 +12538,7 @@ macro (struct mips_cl_insn *ip, char *str)
}
else if (!mips_big_got)
{
- int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT16;
+ int lw_reloc_type = BFD_RELOC_MIPS_GOT16;
/* If this is a reference to an external symbol, we want
lw $tempreg,<sym>($gp) (BFD_RELOC_MIPS_GOT16)
@@ -14266,7 +14272,7 @@ mips_lookup_insn (htab_t hash, const char *start,
name = xstrndup (start, length);
/* Look up the instruction as-is. */
- insn = (struct mips_opcode *) str_hash_find (hash, name);
+ insn = str_hash_find (hash, name);
if (insn)
goto end;
@@ -14278,7 +14284,7 @@ mips_lookup_insn (htab_t hash, const char *start,
if (*p == 0 && mask != 0)
{
*dot = 0;
- insn = (struct mips_opcode *) str_hash_find (hash, name);
+ insn = str_hash_find (hash, name);
*dot = '.';
if (insn && (insn->pinfo2 & INSN2_VU0_CHANNEL_SUFFIX) != 0)
{
@@ -14304,7 +14310,7 @@ mips_lookup_insn (htab_t hash, const char *start,
if (suffix)
{
memmove (name + opend - 2, name + opend, length - opend + 1);
- insn = (struct mips_opcode *) str_hash_find (hash, name);
+ insn = str_hash_find (hash, name);
if (insn)
{
forced_insn_length = suffix;
@@ -14418,7 +14424,7 @@ mips16_ip (char *str, struct mips_cl_insn *insn)
forced_insn_length = l;
*end = 0;
- first = (struct mips_opcode *) str_hash_find (mips16_op_hash, str);
+ first = str_hash_find (mips16_op_hash, str);
*end = c;
if (!first)
@@ -15415,6 +15421,13 @@ mips_frob_file_before_adjust (void)
if the user knows that adding 2 to "foo" will not induce a carry to
the high 16 bits.
+ A %pcrel_lo() expression matches a %pcrel_hi() expression if:
+
+ (a) it refers to the same symbol; and
+ (b) the offset applied in the %pcrel_lo() expression equals
+ the offset applied in the %pcrel_hi() expression plus the
+ distance from the location of %pcrel_hi() to %pcrel_lo().
+
When several %lo()s match a particular %got() or %hi(), we use the
following rules to distinguish them:
@@ -15486,9 +15499,14 @@ mips_frob_file (void)
if ((*pos)->fx_r_type == looking_for_rtype
&& symbol_same_p ((*pos)->fx_addsy, l->fixp->fx_addsy)
- && (*pos)->fx_offset >= l->fixp->fx_offset
+ && (l->fixp->fx_r_type == BFD_RELOC_HI16_S_PCREL
+ ? ((*pos)->fx_offset - l->fixp->fx_offset
+ == (((*pos)->fx_frag->fr_address + (*pos)->fx_where)
+ - (l->fixp->fx_frag->fr_address + l->fixp->fx_where)))
+ : (*pos)->fx_offset >= l->fixp->fx_offset)
&& (lo_pos == NULL
- || (*pos)->fx_offset < (*lo_pos)->fx_offset
+ || (l->fixp->fx_r_type != BFD_RELOC_HI16_S_PCREL
+ && (*pos)->fx_offset < (*lo_pos)->fx_offset)
|| (!matched_lo_p
&& (*pos)->fx_offset == (*lo_pos)->fx_offset)))
lo_pos = pos;
@@ -15499,15 +15517,20 @@ mips_frob_file (void)
/* If we found a match, remove the high-part relocation from its
current position and insert it before the low-part relocation.
- Make the offsets match so that fixup_has_matching_lo_p()
- will return true.
+
+ For absolute relocations make the offsets match so that
+ fixup_has_matching_lo_p() will return true. For PC-relative
+ relocations the distance between the offsets is retained
+ according to expectations in `fixup_has_matching_lo_p',
+ `_bfd_mips_elf_lo16_reloc' and `mips_elf_add_lo16_rel_addend'.
We don't warn about unmatched high-part relocations since some
versions of gcc have been known to emit dead "lui ...%hi(...)"
instructions. */
if (lo_pos != NULL)
{
- l->fixp->fx_offset = (*lo_pos)->fx_offset;
+ if (l->fixp->fx_r_type != BFD_RELOC_HI16_S_PCREL)
+ l->fixp->fx_offset = (*lo_pos)->fx_offset;
if (l->fixp->fx_next != *lo_pos)
{
*hi_pos = l->fixp->fx_next;
@@ -16228,7 +16251,7 @@ get_symbol (void)
symbolS *p;
c = get_symbol_name (&name);
- p = (symbolS *) symbol_find_or_make (name);
+ p = symbol_find_or_make (name);
(void) restore_line_pointer (c);
return p;
}
@@ -16338,13 +16361,12 @@ s_change_sec (int sec)
s_data (0);
break;
case 'b':
- subseg_set (bss_section, (subsegT) get_absolute_expression ());
+ subseg_set (bss_section, get_absolute_expression ());
demand_empty_rest_of_line ();
break;
case 'r':
- seg = subseg_new (RDATA_SECTION_NAME,
- (subsegT) get_absolute_expression ());
+ seg = subseg_new (RDATA_SECTION_NAME, get_absolute_expression ());
bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY
| SEC_RELOC | SEC_DATA));
if (!startswith (TARGET_OS, "elf"))
@@ -16353,7 +16375,7 @@ s_change_sec (int sec)
break;
case 's':
- seg = subseg_new (".sdata", (subsegT) get_absolute_expression ());
+ seg = subseg_new (".sdata", get_absolute_expression ());
bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_RELOC
| SEC_DATA | SEC_SMALL_DATA));
if (!startswith (TARGET_OS, "elf"))
@@ -16362,7 +16384,7 @@ s_change_sec (int sec)
break;
case 'B':
- seg = subseg_new (".sbss", (subsegT) get_absolute_expression ());
+ seg = subseg_new (".sbss", get_absolute_expression ());
bfd_set_section_flags (seg, SEC_ALLOC | SEC_SMALL_DATA);
if (!startswith (TARGET_OS, "elf"))
record_alignment (seg, 4);
@@ -17632,7 +17654,7 @@ md_section_align (asection *seg, valueT addr)
if (align > 4)
align = 4;
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
/* Utility routine, called from above as well. If called while the
@@ -17657,7 +17679,7 @@ nopic_need_relax (symbolS *sym, int before_relaxing)
not be referenced off the $gp, although it appears as though
they can. */
symname = S_GET_NAME (sym);
- if (symname != (const char *) NULL
+ if (symname != NULL
&& (strcmp (symname, "eprol") == 0
|| strcmp (symname, "etext") == 0
|| strcmp (symname, "_gp") == 0
@@ -19809,7 +19831,7 @@ s_mips_end (int x ATTRIBUTE_UNUSED)
if (p && cur_proc_ptr)
{
OBJ_SYMFIELD_TYPE *obj = symbol_get_obj (p);
- expressionS *exp = XNEW (expressionS);
+ expressionS *exp = notes_alloc (sizeof (*exp));
obj->size = exp;
exp->X_op = O_subtract;
@@ -19916,7 +19938,7 @@ s_mips_frame (int ignore ATTRIBUTE_UNUSED)
{
long val;
- if (cur_proc_ptr == (procS *) NULL)
+ if (cur_proc_ptr == NULL)
{
as_warn (_(".frame outside of .ent"));
demand_empty_rest_of_line ();
@@ -19957,7 +19979,7 @@ s_mips_mask (int reg_type)
{
long mask, off;
- if (cur_proc_ptr == (procS *) NULL)
+ if (cur_proc_ptr == NULL)
{
as_warn (_(".mask/.fmask outside of .ent"));
demand_empty_rest_of_line ();
diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h
index 38a0e39..dff86c6 100644
--- a/gas/config/tc-mips.h
+++ b/gas/config/tc-mips.h
@@ -61,7 +61,7 @@ extern char mips_nop_opcode (void);
extern void mips_handle_align (struct frag *);
#define HANDLE_ALIGN(sec, fragp) mips_handle_align (fragp)
-#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 4)
struct insn_label_list;
struct mips_segment_info {
diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c
index 76a0618..88b7bc4 100644
--- a/gas/config/tc-mmix.c
+++ b/gas/config/tc-mmix.c
@@ -504,7 +504,7 @@ get_operands (int max_operands, char *s, expressionS *exp)
/* Mark the end of the valid operands with an illegal expression. */
exp[numexp].X_op = O_illegal;
- return (numexp);
+ return numexp;
}
/* Get the value of a special register, or -1 if the name does not match
@@ -835,7 +835,7 @@ md_assemble (char *str)
*operands++ = '\0';
}
- instruction = (struct mmix_opcode *) str_hash_find (mmix_opcode_hash, str);
+ instruction = str_hash_find (mmix_opcode_hash, str);
if (instruction == NULL)
{
as_bad (_("unknown opcode: `%s'"), str);
@@ -1912,7 +1912,7 @@ mmix_assemble_return_nonzero (char *str)
/* Normal instruction handling downcases, so we must too. */
while (ISALNUM (*s2))
{
- if (ISUPPER ((unsigned char) *s2))
+ if (ISUPPER (*s2))
*s2 = TOLOWER (*s2);
s2++;
}
@@ -2426,12 +2426,11 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED,
void
md_apply_fix (fixS *fixP, valueT *valP, segT segment)
{
- char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
+ char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
/* Note: use offsetT because it is signed, valueT is unsigned. */
- offsetT val = (offsetT) * valP;
- segT symsec
- = (fixP->fx_addsy == NULL
- ? absolute_section : S_GET_SEGMENT (fixP->fx_addsy));
+ offsetT val = *valP;
+ segT symsec = (fixP->fx_addsy == NULL
+ ? absolute_section : S_GET_SEGMENT (fixP->fx_addsy));
/* If the fix is relative to a symbol which is not defined, or, (if
pcrel), not in the same segment as the fix, we cannot resolve it
@@ -2490,8 +2489,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment)
case BFD_RELOC_MMIX_PUSHJ_STUBBABLE:
/* If this fixup is out of range, punt to the linker to emit an
error. This should only happen with -no-expand. */
- if (val < -(((offsetT) 1 << 19)/2)
- || val >= ((offsetT) 1 << 19)/2 - 1
+ if (val < -((1 << 19) / 2)
+ || val >= (1 << 19) / 2 - 1
|| (val & 3) != 0)
{
if (warn_on_expansion)
@@ -2514,8 +2513,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment)
case BFD_RELOC_MMIX_JMP:
/* If this fixup is out of range, punt to the linker to emit an
error. This should only happen with -no-expand. */
- if (val < -(((offsetT) 1 << 27)/2)
- || val >= ((offsetT) 1 << 27)/2 - 1
+ if (val < -((1 << 27) / 2)
+ || val >= (1 << 27) / 2 - 1
|| (val & 3) != 0)
{
if (warn_on_expansion)
@@ -2774,7 +2773,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
&& (bfd_vma) val + 256 > lowest_data_loc
&& bfd_is_abs_section (addsec))
{
- val -= (offsetT) lowest_data_loc;
+ val -= lowest_data_loc;
addsy = section_symbol (data_section);
}
/* Likewise text section. */
@@ -2782,7 +2781,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
&& (bfd_vma) val + 256 > lowest_text_loc
&& bfd_is_abs_section (addsec))
{
- val -= (offsetT) lowest_text_loc;
+ val -= lowest_text_loc;
addsy = section_symbol (text_section);
}
}
@@ -3283,7 +3282,7 @@ mmix_force_relocation (fixS *fixP)
long
md_pcrel_from_section (fixS *fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
{
@@ -3438,9 +3437,8 @@ mmix_md_relax_frag (segT seg, fragS *fragP, long stretch)
if (fragP == seginfo->tc_segment_info_data.last_stubfrag)
seginfo->tc_segment_info_data.nstubs = 0;
- return
- (mmix_relax_table[fragP->fr_subtype].rlx_length
- - mmix_relax_table[prev_type].rlx_length);
+ return (mmix_relax_table[fragP->fr_subtype].rlx_length
+ - mmix_relax_table[prev_type].rlx_length);
}
case ENCODE_RELAX (STATE_PUSHJ, STATE_MAX):
@@ -3635,7 +3633,7 @@ mmix_md_finish (void)
if (! merge_gregs)
continue;
- osymval = (offsetT) S_GET_VALUE (symbolP);
+ osymval = S_GET_VALUE (symbolP);
osymfrag = symbol_get_frag (symbolP);
/* If the symbol isn't defined, we can't say that another symbol
@@ -3687,10 +3685,8 @@ mmix_md_finish (void)
static int
cmp_greg_symbol_fixes (const void *parg, const void *qarg)
{
- const struct mmix_symbol_greg_fixes *p
- = (const struct mmix_symbol_greg_fixes *) parg;
- const struct mmix_symbol_greg_fixes *q
- = (const struct mmix_symbol_greg_fixes *) qarg;
+ const struct mmix_symbol_greg_fixes *p = parg;
+ const struct mmix_symbol_greg_fixes *q = qarg;
return p->offs > q->offs ? 1 : p->offs < q->offs ? -1 : 0;
}
@@ -3728,7 +3724,7 @@ mmix_frob_file (void)
}
sym = fixP->fx_addsy;
- offs = (offsetT) fixP->fx_offset;
+ offs = fixP->fx_offset;
/* If the symbol is defined, then it must be resolved to a section
symbol at this time, or else we don't know how to handle it. */
@@ -3751,7 +3747,7 @@ mmix_frob_file (void)
&& (bfd_vma) offs + 256 > lowest_data_loc
&& bfd_is_abs_section (S_GET_SEGMENT (sym)))
{
- offs -= (offsetT) lowest_data_loc;
+ offs -= lowest_data_loc;
sym = section_symbol (data_section);
}
/* Likewise text section. */
@@ -3759,7 +3755,7 @@ mmix_frob_file (void)
&& (bfd_vma) offs + 256 > lowest_text_loc
&& bfd_is_abs_section (S_GET_SEGMENT (sym)))
{
- offs -= (offsetT) lowest_text_loc;
+ offs -= lowest_text_loc;
sym = section_symbol (text_section);
}
@@ -4087,7 +4083,7 @@ s_loc (int ignore ATTRIBUTE_UNUSED)
loc_asserts->frag = frag_now;
}
- p = frag_var (rs_org, 1, 1, (relax_substateT) 0, sym, off, (char *) 0);
+ p = frag_var (rs_org, 1, 1, 0, sym, off, NULL);
*p = 0;
}
@@ -4257,7 +4253,7 @@ mmix_cons (int nbytes)
exp.X_unsigned = 0;
exp.X_add_symbol = NULL;
exp.X_op_symbol = NULL;
- emit_expr (&exp, (unsigned int) nbytes);
+ emit_expr (&exp, nbytes);
}
else
do
@@ -4275,7 +4271,7 @@ mmix_cons (int nbytes)
exp.X_op = O_constant;
exp.X_add_number = c;
exp.X_unsigned = 1;
- emit_expr (&exp, (unsigned int) nbytes);
+ emit_expr (&exp, nbytes);
}
if (input_line_pointer[-1] != '\"')
@@ -4292,7 +4288,7 @@ mmix_cons (int nbytes)
default:
{
expression (&exp);
- emit_expr (&exp, (unsigned int) nbytes);
+ emit_expr (&exp, nbytes);
SKIP_WHITESPACE ();
}
break;
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index 657f591..fe54d21 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -328,7 +328,6 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
static unsigned long label_count = 0;
char buf[40];
- subseg_change (sec, 0);
if (fragP->fr_subtype == 0)
{
fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol,
@@ -676,7 +675,7 @@ valueT
md_section_align (asection *seg, valueT addr)
{
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return ((addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align));
}
void
@@ -697,7 +696,7 @@ md_begin (void)
{
if (strcmp (prev_name, op->name))
{
- prev_name = (char *) op->name;
+ prev_name = op->name;
str_hash_insert (mn10200_hash, op->name, op, 0);
}
op++;
@@ -734,7 +733,7 @@ check_operand (unsigned long insn ATTRIBUTE_UNUSED,
test = val;
- if (test < (offsetT) min || test > (offsetT) max)
+ if (test < min || test > max)
return 0;
else
return 1;
@@ -828,8 +827,7 @@ mn10200_insert_operand (unsigned long *insnp,
if (operand->bits < 24
&& (operand->flags & MN10200_OPERAND_NOCHECK) == 0)
{
- long min, max;
- offsetT test;
+ offsetT min, max;
if ((operand->flags & MN10200_OPERAND_SIGNED) != 0)
{
@@ -842,19 +840,17 @@ mn10200_insert_operand (unsigned long *insnp,
min = 0;
}
- test = val;
-
- if (test < (offsetT) min || test > (offsetT) max)
- as_warn_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line);
+ if (val < min || val > max)
+ as_warn_value_out_of_range (_("operand"), val, min, max, file, line);
}
if ((operand->flags & MN10200_OPERAND_EXTENDED) == 0)
{
- *insnp |= (((long) val & ((1 << operand->bits) - 1))
+ *insnp |= ((val & ((1 << operand->bits) - 1))
<< (operand->shift + shift));
if ((operand->flags & MN10200_OPERAND_REPEATED) != 0)
- *insnp |= (((long) val & ((1 << operand->bits) - 1))
+ *insnp |= ((val & ((1 << operand->bits) - 1))
<< (operand->shift + shift + 2));
}
else
@@ -884,7 +880,7 @@ md_assemble (char *str)
*s++ = '\0';
/* Find the first opcode with the proper name. */
- opcode = (struct mn10200_opcode *) str_hash_find (mn10200_hash, str);
+ opcode = str_hash_find (mn10200_hash, str);
if (opcode == NULL)
{
as_bad (_("Unrecognized opcode: `%s'"), str);
@@ -900,7 +896,6 @@ md_assemble (char *str)
for (;;)
{
const char *errmsg = NULL;
- int op_idx;
char *hold;
int extra_shift = 0;
@@ -910,9 +905,9 @@ md_assemble (char *str)
next_opindex = 0;
insn = opcode->opcode;
extension = 0;
- for (op_idx = 1, opindex_ptr = opcode->operands;
+ for (opindex_ptr = opcode->operands;
*opindex_ptr != 0;
- opindex_ptr++, op_idx++)
+ opindex_ptr++)
{
const struct mn10200_operand *operand;
expressionS ex;
@@ -1318,7 +1313,7 @@ md_assemble (char *str)
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset,
reloc_size, &fixups[i].exp, pcrel,
- ((bfd_reloc_code_real_type) reloc));
+ reloc);
/* PC-relative offsets are from the first byte of the
next instruction, not from the start of the current
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index 2167f40..db87d52 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -466,7 +466,6 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
static unsigned long label_count = 0;
char buf[40];
- subseg_change (sec, 0);
if (fragP->fr_subtype == 0)
{
fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol,
@@ -902,7 +901,7 @@ md_section_align (asection *seg, valueT addr)
{
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
void
@@ -923,7 +922,7 @@ md_begin (void)
{
if (strcmp (prev_name, op->name))
{
- prev_name = (char *) op->name;
+ prev_name = op->name;
str_hash_insert (mn10300_hash, op->name, op, 0);
}
op++;
@@ -1103,7 +1102,7 @@ check_operand (const struct mn10300_operand *operand,
test = val;
- if (test < (offsetT) min || test > (offsetT) max)
+ if (test < min || test > max)
return false;
}
return true;
@@ -1146,8 +1145,9 @@ mn10300_insert_operand (unsigned long *insnp,
test = val;
- if (test < (offsetT) min || test > (offsetT) max)
- as_warn_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line);
+ if (test < min || test > max)
+ as_warn_value_out_of_range (_("operand"), test, (offsetT) min,
+ (offsetT) max, file, line);
}
if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
@@ -1209,20 +1209,20 @@ mn10300_insert_operand (unsigned long *insnp,
}
else if ((operand->flags & MN10300_OPERAND_EXTENDED) == 0)
{
- *insnp |= (((long) val & ((1 << operand->bits) - 1))
+ *insnp |= ((val & ((1 << operand->bits) - 1))
<< (operand->shift + shift));
if ((operand->flags & MN10300_OPERAND_REPEATED) != 0)
- *insnp |= (((long) val & ((1 << operand->bits) - 1))
+ *insnp |= ((val & ((1 << operand->bits) - 1))
<< (operand->shift + shift + operand->bits));
}
else
{
- *extensionp |= (((long) val & ((1 << operand->bits) - 1))
+ *extensionp |= ((val & ((1 << operand->bits) - 1))
<< (operand->shift + shift));
if ((operand->flags & MN10300_OPERAND_REPEATED) != 0)
- *extensionp |= (((long) val & ((1 << operand->bits) - 1))
+ *extensionp |= ((val & ((1 << operand->bits) - 1))
<< (operand->shift + shift + operand->bits));
}
}
@@ -1247,7 +1247,7 @@ md_assemble (char *str)
*s++ = '\0';
/* Find the first opcode with the proper name. */
- opcode = (struct mn10300_opcode *) str_hash_find (mn10300_hash, str);
+ opcode = str_hash_find (mn10300_hash, str);
if (opcode == NULL)
{
as_bad (_("Unrecognized opcode: `%s'"), str);
@@ -2145,7 +2145,7 @@ md_assemble (char *str)
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset,
reloc_size / 8, &fixups[i].exp, pcrel,
- ((bfd_reloc_code_real_type) reloc));
+ reloc);
if (pcrel)
fixP->fx_offset += offset;
@@ -2312,7 +2312,7 @@ md_estimate_size_before_relax (fragS *fragp, asection *seg)
long
md_pcrel_from (fixS *fixp)
{
- if (fixp->fx_addsy != (symbolS *) NULL
+ if (fixp->fx_addsy != NULL
&& (!S_IS_DEFINED (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy)))
/* The symbol is undefined or weak. Let the linker figure it out. */
return 0;
@@ -2325,7 +2325,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg)
{
char * fixpos = fixP->fx_where + fixP->fx_frag->fr_literal;
int size = 0;
- int value = (int) * valP;
+ int value = *valP;
gas_assert (fixP->fx_r_type < BFD_RELOC_UNUSED);
diff --git a/gas/config/tc-moxie.c b/gas/config/tc-moxie.c
index fec6a6f..cb8adfb 100644
--- a/gas/config/tc-moxie.c
+++ b/gas/config/tc-moxie.c
@@ -178,7 +178,7 @@ md_assemble (char *str)
if (nlen == 0)
as_bad (_("can't find opcode "));
- opcode = (moxie_opc_info_t *) str_hash_find (opcode_hash_control, op_start);
+ opcode = str_hash_find (opcode_hash_control, op_start);
*op_end = pend;
if (opcode == NULL)
@@ -590,7 +590,7 @@ md_atof (int type, char *litP, int *sizeP)
for (i = prec - 1; i >= 0; i--)
{
- md_number_to_chars (litP, (valueT) words[i], 2);
+ md_number_to_chars (litP, words[i], 2);
litP += 2;
}
@@ -731,14 +731,13 @@ static valueT
md_chars_to_number (char * buf, int n)
{
valueT result = 0;
- unsigned char * where = (unsigned char *) buf;
if (target_big_endian)
{
while (n--)
{
result <<= 8;
- result |= (*where++ & 255);
+ result |= (*buf++ & 255);
}
}
else
@@ -746,7 +745,7 @@ md_chars_to_number (char * buf, int n)
while (n--)
{
result <<= 8;
- result |= (where[n] & 255);
+ result |= (buf[n] & 255);
}
}
diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c
index 7ce061b..0127a2a 100644
--- a/gas/config/tc-msp430.c
+++ b/gas/config/tc-msp430.c
@@ -2454,15 +2454,15 @@ try_encode_mova (bool imm_op,
if (op1->exp.X_op == O_constant)
{
bin |= ((op1->exp.X_add_number >> 16) & 0xf) << 8;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
bfd_putl16 (op1->exp.X_add_number & 0xffff, frag + 2);
}
else
{
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
fix_new_exp (frag_now, where, 4, &(op1->exp), false,
BFD_RELOC_MSP430X_ABS20_ADR_SRC);
- bfd_putl16 ((bfd_vma) ZEROS, frag + 2);
+ bfd_putl16 (ZEROS, frag + 2);
}
return 4;
@@ -2473,7 +2473,7 @@ try_encode_mova (bool imm_op,
bin |= 0x30 | (op1->reg << 8) | op2->reg;
frag = frag_more (4);
where = frag - frag_now->fr_literal;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
if (op1->exp.X_op == O_constant)
{
if (op1->exp.X_add_number > 0xffff
@@ -2487,7 +2487,7 @@ try_encode_mova (bool imm_op,
}
else
{
- bfd_putl16 ((bfd_vma) ZEROS, frag + 2);
+ bfd_putl16 (ZEROS, frag + 2);
fix_new_exp (frag_now, where + 2, 2, &(op1->exp), false,
op1->reg == 0 ?
BFD_RELOC_MSP430X_PCR16 :
@@ -2508,7 +2508,7 @@ try_encode_mova (bool imm_op,
bin |= 0xc0 | (op1->reg << 8) | op2->reg;
frag = frag_more (2);
where = frag - frag_now->fr_literal;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
return 2;
}
else if (op2->am == 1)
@@ -2522,13 +2522,13 @@ try_encode_mova (bool imm_op,
if (op2->exp.X_op == O_constant)
{
bin |= (op2->exp.X_add_number >> 16) & 0xf;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
bfd_putl16 (op2->exp.X_add_number & 0xffff, frag + 2);
}
else
{
- bfd_putl16 ((bfd_vma) bin, frag);
- bfd_putl16 ((bfd_vma) ZEROS, frag + 2);
+ bfd_putl16 (bin, frag);
+ bfd_putl16 (ZEROS, frag + 2);
fix_new_exp (frag_now, where, 4, &(op2->exp), false,
BFD_RELOC_MSP430X_ABS20_ADR_DST);
}
@@ -2539,7 +2539,7 @@ try_encode_mova (bool imm_op,
bin |= 0x70 | (op1->reg << 8) | op2->reg;
frag = frag_more (4);
where = frag - frag_now->fr_literal;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
if (op2->exp.X_op == O_constant)
{
if (op2->exp.X_add_number > 0xffff
@@ -2553,7 +2553,7 @@ try_encode_mova (bool imm_op,
}
else
{
- bfd_putl16 ((bfd_vma) ZEROS, frag + 2);
+ bfd_putl16 (ZEROS, frag + 2);
fix_new_exp (frag_now, where + 2, 2, &(op2->exp), false,
op2->reg == 0 ?
BFD_RELOC_MSP430X_PCR16 :
@@ -2593,13 +2593,13 @@ try_encode_mova (bool imm_op,
if (op1->exp.X_op == O_constant)
{
bin |= ((op1->exp.X_add_number >> 16) & 0xf) << 8;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
bfd_putl16 (op1->exp.X_add_number & 0xffff, frag + 2);
}
else
{
- bfd_putl16 ((bfd_vma) bin, frag);
- bfd_putl16 ((bfd_vma) ZEROS, frag + 2);
+ bfd_putl16 (bin, frag);
+ bfd_putl16 (ZEROS, frag + 2);
fix_new_exp (frag_now, where, 4, &(op1->exp), false,
BFD_RELOC_MSP430X_ABS20_ADR_SRC);
}
@@ -2634,7 +2634,7 @@ try_encode_mova (bool imm_op,
bin |= 0x10 | (op1->reg << 8) | op2->reg;
frag = frag_more (2);
where = frag - frag_now->fr_literal;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
return 2;
}
else if (op1->am == 2)
@@ -2664,7 +2664,7 @@ try_encode_mova (bool imm_op,
bin |= (op1->reg << 8) | op2->reg;
frag = frag_more (2);
where = frag - frag_now->fr_literal;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
return 2;
}
}
@@ -2715,7 +2715,7 @@ gen_nop (void)
{
char *frag;
frag = frag_more (2);
- bfd_putl16 ((bfd_vma) 0x4303 /* NOP */, frag);
+ bfd_putl16 (0x4303 /* NOP */, frag);
dwarf2_emit_insn (2);
}
@@ -3046,7 +3046,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
insn_length += 2;
frag = frag_more (2);
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
dwarf2_emit_insn (insn_length);
break;
@@ -3124,7 +3124,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
where += 2;
}
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
frag += 2;
where += 2;
@@ -3136,7 +3136,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
}
else
{
- bfd_putl16 ((bfd_vma) ZEROS, frag);
+ bfd_putl16 (ZEROS, frag);
if (!extended_op)
{
@@ -3241,7 +3241,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
}
bin |= (op2.reg | (op1.reg << 8) | (op1.am << 4) | (op2.am << 7));
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
frag += 2;
where += 2;
@@ -3253,7 +3253,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
}
else
{
- bfd_putl16 ((bfd_vma) ZEROS, frag);
+ bfd_putl16 (ZEROS, frag);
if (!extended_op)
{
@@ -3277,7 +3277,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
}
else
{
- bfd_putl16 ((bfd_vma) ZEROS, frag);
+ bfd_putl16 (ZEROS, frag);
if (!extended_op)
{
@@ -3313,7 +3313,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
op_length = 2 + 2 * op1.ol;
frag = frag_more (op_length);
where = frag - frag_now->fr_literal;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
if (op1.mode == OP_EXP)
{
@@ -3325,7 +3325,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
{
where += 2;
- bfd_putl16 ((bfd_vma) ZEROS, frag + 2);
+ bfd_putl16 (ZEROS, frag + 2);
if (op1.reg || op1.am == 3)
fix_new_exp (frag_now, where, 2,
@@ -3396,7 +3396,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
else if (op1.am == 3)
bin |= 0x70 | op1.reg;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
if (op1.mode == OP_EXP)
{
@@ -3406,7 +3406,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
break;
}
- bfd_putl16 ((bfd_vma) ZEROS, frag + 2);
+ bfd_putl16 (ZEROS, frag + 2);
if (! fix_emitted)
fix_new_exp (frag_now, where + 2, 2,
@@ -3481,7 +3481,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
bin |= (reg - n + 1);
}
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
dwarf2_emit_insn (op_length);
break;
}
@@ -3549,7 +3549,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
bin |= (n - 1) << 10;
bin |= reg;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
dwarf2_emit_insn (op_length);
break;
}
@@ -3634,9 +3634,9 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
fix_new_exp (frag_now, where, 4, &(op1.exp), false,
BFD_RELOC_MSP430X_ABS20_ADR_SRC);
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
if (op_length == 4)
- bfd_putl16 ((bfd_vma) (n & 0xffff), frag + 2);
+ bfd_putl16 (n & 0xffff, frag + 2);
dwarf2_emit_insn (op_length);
break;
}
@@ -3926,7 +3926,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
frag += 2;
}
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
where += 2;
frag += 2;
@@ -3938,7 +3938,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
}
else
{
- bfd_putl16 ((bfd_vma) ZEROS, frag);
+ bfd_putl16 (ZEROS, frag);
if (!extended_op)
{
@@ -3963,7 +3963,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
}
else
{
- bfd_putl16 ((bfd_vma) ZEROS, frag);
+ bfd_putl16 (ZEROS, frag);
if (!extended_op)
{
@@ -3992,7 +3992,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
/* reti instruction. */
insn_length += 2;
frag = frag_more (2);
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
dwarf2_emit_insn (insn_length);
break;
}
@@ -4079,7 +4079,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
}
bin |= op1.reg | (op1.am << 4);
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
frag += 2;
where += 2;
@@ -4091,7 +4091,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
}
else
{
- bfd_putl16 ((bfd_vma) ZEROS, frag);
+ bfd_putl16 (ZEROS, frag);
if (!extended_op)
{
@@ -4172,7 +4172,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
frag = frag_more (2); /* Instr size is 1 word. */
bin |= x & 0x3ff;
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
}
else if (exp.X_op == O_symbol && *l1 != '$')
{
@@ -4182,7 +4182,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
fix_new_exp (frag_now, where, 2,
&exp, true, BFD_RELOC_MSP430_10_PCREL);
- bfd_putl16 ((bfd_vma) bin, frag);
+ bfd_putl16 (bin, frag);
}
else if (*l1 == '$')
{
@@ -4239,7 +4239,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
insn_length += 8;
frag = frag_more (8);
dwarf2_emit_insn (0);
- bfd_putl16 ((bfd_vma) rc.sop, frag);
+ bfd_putl16 (rc.sop, frag);
frag = frag_variant (rs_machine_dependent, 8, 2,
/* Wild guess. */
ENCODE_RELAX (rc.lpos, STATE_BITS10),
@@ -4286,8 +4286,8 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
insn_length += 8;
frag = frag_more (8);
dwarf2_emit_insn (0);
- bfd_putl16 ((bfd_vma) hc.op0, frag);
- bfd_putl16 ((bfd_vma) hc.op1, frag+2);
+ bfd_putl16 (hc.op0, frag);
+ bfd_putl16 (hc.op1, frag + 2);
frag = frag_variant (rs_machine_dependent, 8, 2,
ENCODE_RELAX (STATE_EMUL_BRANCH, STATE_BITS10), /* Wild guess. */
@@ -4360,7 +4360,7 @@ md_assemble (char * str)
return;
}
- opcode = (struct msp430_opcode_s *) str_hash_find (msp430_hash, cmd);
+ opcode = str_hash_find (msp430_hash, cmd);
if (opcode == NULL)
{
@@ -4384,7 +4384,7 @@ md_section_align (asection * seg, valueT addr)
{
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
/* If you define this macro, it should return the offset between the
@@ -4396,7 +4396,7 @@ md_section_align (asection * seg, valueT addr)
long
md_pcrel_from_section (fixS * fixp, segT sec)
{
- if (fixp->fx_addsy != (symbolS *) NULL
+ if (fixp->fx_addsy != NULL
&& (!S_IS_DEFINED (fixp->fx_addsy)
|| (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
return 0;
@@ -4431,7 +4431,7 @@ md_apply_fix (fixS * fixp, valueT * valuep, segT seg)
unsigned long insn;
long value;
- if (fixp->fx_addsy == (symbolS *) NULL)
+ if (fixp->fx_addsy == NULL)
{
value = *valuep;
fixp->fx_done = 1;
@@ -4464,7 +4464,7 @@ md_apply_fix (fixS * fixp, valueT * valuep, segT seg)
{
value = fixp->fx_offset;
- if (fixp->fx_subsy != (symbolS *) NULL)
+ if (fixp->fx_subsy != NULL)
{
if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
{
@@ -4512,7 +4512,7 @@ md_apply_fix (fixS * fixp, valueT * valuep, segT seg)
_("operand out of range: %ld"), value);
value &= 0x3ff; /* get rid of extended sign */
- bfd_putl16 ((bfd_vma) (value | insn), where);
+ bfd_putl16 (value | insn, where);
break;
case BFD_RELOC_MSP430X_PCR16:
@@ -4535,66 +4535,66 @@ md_apply_fix (fixS * fixp, valueT * valuep, segT seg)
case BFD_RELOC_16:
case BFD_RELOC_MSP430_16_BYTE:
value &= 0xffff; /* Get rid of extended sign. */
- bfd_putl16 ((bfd_vma) value, where);
+ bfd_putl16 (value, where);
break;
case BFD_RELOC_MSP430_ABS_HI16:
value >>= 16;
value &= 0xffff; /* Get rid of extended sign. */
- bfd_putl16 ((bfd_vma) value, where);
+ bfd_putl16 (value, where);
break;
case BFD_RELOC_32:
- bfd_putl32 ((bfd_vma) value, where);
+ bfd_putl32 (value, where);
break;
case BFD_RELOC_MSP430_ABS8:
case BFD_RELOC_8:
- bfd_put_8 (NULL, (bfd_vma) value, where);
+ bfd_put_8 (NULL, value, where);
break;
case BFD_RELOC_MSP430X_ABS20_EXT_SRC:
case BFD_RELOC_MSP430X_PCR20_EXT_SRC:
- bfd_putl16 ((bfd_vma) (value & 0xffff), where + 4);
+ bfd_putl16 (value & 0xffff, where + 4);
value >>= 16;
- bfd_putl16 ((bfd_vma) (((value & 0xf) << 7) | insn), where);
+ bfd_putl16 (((value & 0xf) << 7) | insn, where);
break;
case BFD_RELOC_MSP430X_ABS20_ADR_SRC:
- bfd_putl16 ((bfd_vma) (value & 0xffff), where + 2);
+ bfd_putl16 (value & 0xffff, where + 2);
value >>= 16;
- bfd_putl16 ((bfd_vma) (((value & 0xf) << 8) | insn), where);
+ bfd_putl16 (((value & 0xf) << 8) | insn, where);
break;
case BFD_RELOC_MSP430X_ABS20_EXT_ODST:
- bfd_putl16 ((bfd_vma) (value & 0xffff), where + 6);
+ bfd_putl16 (value & 0xffff, where + 6);
value >>= 16;
- bfd_putl16 ((bfd_vma) ((value & 0xf) | insn), where);
+ bfd_putl16 ((value & 0xf) | insn, where);
break;
case BFD_RELOC_MSP430X_PCR20_CALL:
- bfd_putl16 ((bfd_vma) (value & 0xffff), where + 2);
+ bfd_putl16 (value & 0xffff, where + 2);
value >>= 16;
- bfd_putl16 ((bfd_vma) ((value & 0xf) | insn), where);
+ bfd_putl16 ((value & 0xf) | insn, where);
break;
case BFD_RELOC_MSP430X_ABS20_EXT_DST:
case BFD_RELOC_MSP430X_PCR20_EXT_DST:
- bfd_putl16 ((bfd_vma) (value & 0xffff), where + 4);
+ bfd_putl16 (value & 0xffff, where + 4);
value >>= 16;
- bfd_putl16 ((bfd_vma) ((value & 0xf) | insn), where);
+ bfd_putl16 ((value & 0xf) | insn, where);
break;
case BFD_RELOC_MSP430X_PCR20_EXT_ODST:
- bfd_putl16 ((bfd_vma) (value & 0xffff), where + 6);
+ bfd_putl16 (value & 0xffff, where + 6);
value >>= 16;
- bfd_putl16 ((bfd_vma) ((value & 0xf) | insn), where);
+ bfd_putl16 ((value & 0xf) | insn, where);
break;
case BFD_RELOC_MSP430X_ABS20_ADR_DST:
- bfd_putl16 ((bfd_vma) (value & 0xffff), where + 2);
+ bfd_putl16 (value & 0xffff, where + 2);
value >>= 16;
- bfd_putl16 ((bfd_vma) ((value & 0xf) | insn), where);
+ bfd_putl16 ((value & 0xf) | insn, where);
break;
default:
diff --git a/gas/config/tc-msp430.h b/gas/config/tc-msp430.h
index 47da4aa..fc39a59 100644
--- a/gas/config/tc-msp430.h
+++ b/gas/config/tc-msp430.h
@@ -20,6 +20,7 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#ifndef TC_MSP430
#define TC_MSP430
/* By convention, you should define this macro in the `.h' file. For
example, `tc-m68k.h' defines `TC_M68K'. You might have to use this
@@ -172,3 +173,5 @@ extern bool msp430_allow_local_subtract (expressionS *, expressionS *, segT);
#define TC_LINKRELAX_FIXUP(seg) ((seg->flags & SEC_CODE) || (seg->flags & SEC_DEBUGGING))
#define DWARF2_ADDR_SIZE(bfd) 4
+
+#endif /* TC_MSP430 */
diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c
index 0cfc82d..a795bdc 100644
--- a/gas/config/tc-mt.c
+++ b/gas/config/tc-mt.c
@@ -335,7 +335,7 @@ md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & -(1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
symbolS *
@@ -372,7 +372,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
long
md_pcrel_from_section (fixS *fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (!S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
/* The symbol is undefined (or is defined but not in this section).
@@ -461,10 +461,10 @@ mt_apply_fix (fixS *fixP, valueT *valueP, segT seg)
bool
mt_fix_adjustable (fixS * fixP)
{
- if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
{
const CGEN_INSN *insn = NULL;
- int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+ int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
const CGEN_OPERAND *operand;
operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index 2e0b8e5..d107555 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -3452,8 +3452,9 @@ nds32_lookup_pseudo_opcode (const char *str)
for (i = 0; i < maxlen; i++)
{
- if (is_whitespace (op[i] = str[i]))
+ if (is_end_of_stmt (str[i]) || is_whitespace (str[i]))
break;
+ op[i] = str[i];
}
op[i] = '\0';
@@ -3896,7 +3897,7 @@ nds32_adjust_label (int n)
/* Only frag by alignment when needed.
Otherwise, it will fail to optimize labels on 4-byte boundary. (bug8454)
See md_convert_frag () and RELAX_SET_RELAXABLE (frag) for details. */
- if (frag_now_fix () & ((1 << n) -1 ))
+ if (frag_now_fix () & (((addressT) 1 << n) - 1))
{
if (subseg_text_p (now_seg))
{
@@ -3921,7 +3922,7 @@ nds32_adjust_label (int n)
old_frag = symbol_get_frag (label);
old_value = S_GET_VALUE (label);
- new_value = (valueT) frag_now_fix ();
+ new_value = frag_now_fix ();
/* Multiple labels may be on the same address. And the last symbol
may not be a label at all, e.g., register name, external function names,
@@ -4015,7 +4016,7 @@ add_mapping_symbol (enum mstate state, unsigned int padding_byte,
/* start adding mapping symbol */
seg_info (now_seg)->tc_segment_info_data.mapstate = state;
- make_mapping_symbol (state, (valueT) frag_now_fix () + padding_byte,
+ make_mapping_symbol (state, frag_now_fix () + padding_byte,
frag_now, align);
}
@@ -4093,7 +4094,8 @@ nds32_relax_relocs (int relax)
{"", "",};
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -4208,8 +4210,6 @@ struct relax_hint_id *record_id_head = NULL;
/* Is the buffer large enough? */
#define MAX_BUFFER 12
-static char *nds_itoa (int n);
-
static char *
nds_itoa (int n)
{
@@ -4230,7 +4230,8 @@ nds32_relax_hint (int mode ATTRIBUTE_UNUSED)
struct relax_hint_id *record_id;
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -4363,7 +4364,8 @@ nds32_flag (int ignore ATTRIBUTE_UNUSED)
/* Skip whitespaces. */
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -4400,7 +4402,8 @@ ict_model (int ignore ATTRIBUTE_UNUSED)
/* Skip whitespaces. */
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -4633,16 +4636,15 @@ nds32_handle_align (fragS *fragp)
{
static const unsigned char nop16[] = { 0x92, 0x00 };
static const unsigned char nop32[] = { 0x40, 0x00, 0x00, 0x09 };
- int bytes;
- char *p;
if (fragp->fr_type != rs_align_code)
return;
- bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
- p = fragp->fr_literal + fragp->fr_fix;
+ int bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
+ char *p = fragp->fr_literal + fragp->fr_fix;
+ int fix = bytes & 1;
- if (bytes & 1)
+ if (fix != 0)
{
*p++ = 0;
bytes--;
@@ -4659,17 +4661,15 @@ nds32_handle_align (fragS *fragp)
memcpy (p, nop16, 2);
p += 2;
bytes -= 2;
+ fix += 2;
}
+ fragp->fr_fix += fix;
- while (bytes >= 4)
+ if (bytes != 0)
{
+ fragp->fr_var = 4;
memcpy (p, nop32, 4);
- p += 4;
- bytes -= 4;
}
-
- bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
- fragp->fr_fix += bytes;
}
/* md_flush_pending_output */
@@ -5212,7 +5212,7 @@ static struct nds32_relax_hint_table relax_ls_table[] =
elimination itself or not, we have to return the next instruction range. */
static int
-nds32_elf_sethi_range (struct nds32_relocs_pattern *pattern)
+nds32_elf_sethi_range (const struct nds32_relocs_pattern *pattern)
{
int range = 0;
while (pattern)
@@ -5661,12 +5661,12 @@ static struct nds32_hint_map hint_map [] =
/* Find the relaxation pattern according to instructions. */
static bool
-nds32_find_reloc_table (struct nds32_relocs_pattern *relocs_pattern,
+nds32_find_reloc_table (const struct nds32_relocs_pattern *relocs_pattern,
struct nds32_relax_hint_table *hint_info)
{
unsigned int opcode, seq_size;
enum nds32_br_range range;
- struct nds32_relocs_pattern *pattern, *hi_pattern = NULL;
+ const struct nds32_relocs_pattern *pattern, *hi_pattern = NULL;
const char *opc = NULL;
relax_info_t *relax_info = NULL;
nds32_relax_fixup_info_t *fixup_info, *hint_fixup;
@@ -5931,9 +5931,8 @@ nds32_match_hint_insn (struct nds32_opcode *opcode, uint32_t seq)
static void
nds32_elf_append_relax_relocs (const char *key, const void *value)
{
- struct nds32_relocs_pattern *relocs_pattern =
- (struct nds32_relocs_pattern *) value;
- struct nds32_relocs_pattern *pattern_temp, *pattern_now;
+ const struct nds32_relocs_pattern *relocs_pattern = value;
+ const struct nds32_relocs_pattern *pattern_temp, *pattern_now;
symbolS *sym, *hi_sym = NULL;
expressionS exp;
fragS *fragP;
@@ -5950,7 +5949,7 @@ nds32_elf_append_relax_relocs (const char *key, const void *value)
char *where;
int pcrel;
- if (!relocs_pattern)
+ if (!relocs_pattern || !relocs_pattern->opcode)
return;
if (!nds32_find_reloc_table (relocs_pattern, &hint_info))
@@ -6268,7 +6267,7 @@ static int
nds32_elf_append_relax_relocs_traverse (void **slot, void *arg ATTRIBUTE_UNUSED)
{
string_tuple_t *tuple = *((string_tuple_t **) slot);
- nds32_elf_append_relax_relocs (tuple->key, tuple->value);
+ nds32_elf_append_relax_relocs (tuple->key, (const void *) tuple->value);
return 1;
}
@@ -6612,7 +6611,7 @@ md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & ((valueT) -1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
/* GAS will call this function when a symbol table lookup fails, before it
@@ -7356,8 +7355,7 @@ md_atof (int type, char *litP, int *sizeP)
{
for (i = 0; i < prec; i++)
{
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
}
@@ -7365,8 +7363,7 @@ md_atof (int type, char *litP, int *sizeP)
{
for (i = prec - 1; i >= 0; i--)
{
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
}
@@ -7690,10 +7687,10 @@ nds32_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
return;
}
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
{
/* HOW DIFF RELOCATION WORKS.
@@ -7834,7 +7831,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
code = fixP->fx_r_type;
reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("internal error: can't export reloc type %d (`%s')"),
diff --git a/gas/config/tc-nds32.h b/gas/config/tc-nds32.h
index 14109f0..f8966c5 100644
--- a/gas/config/tc-nds32.h
+++ b/gas/config/tc-nds32.h
@@ -112,6 +112,7 @@ extern void tc_nds32_frame_initial_instructions (void);
#define GAS_SORT_RELOCS 1
/* Values passed to md_apply_fix don't include the symbol value. */
#define MD_APPLY_SYM_VALUE(FIX) 0
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (1 + 2 + 4)
#define HANDLE_ALIGN(s, f) nds32_handle_align (f)
#undef DIFF_EXPR_OK /* They should be fixed in linker. */
#define md_relax_frag(segment, fragP, stretch) nds32_relax_frag (segment, fragP, stretch)
diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c
index cf23c9b..dcabf5f 100644
--- a/gas/config/tc-ns32k.c
+++ b/gas/config/tc-ns32k.c
@@ -1105,7 +1105,7 @@ parse (const char *line, int recursive_level)
c = *lineptr;
*(char *) lineptr = '\0';
- desc = (struct ns32k_opcode *) str_hash_find (inst_hash_handle, line);
+ desc = str_hash_find (inst_hash_handle, line);
if (!desc)
as_fatal (_("No such opcode"));
@@ -1577,13 +1577,13 @@ md_number_to_field (char *buf, long val, bit_fixS *field_ptr)
#ifdef ENDIAN
*mem_ptr = object;
#else
- mem_ptr[0] = (char) object;
+ mem_ptr[0] = object;
object >>= 8;
- mem_ptr[1] = (char) object;
+ mem_ptr[1] = object;
object >>= 8;
- mem_ptr[2] = (char) object;
+ mem_ptr[2] = object;
object >>= 8;
- mem_ptr[3] = (char) object;
+ mem_ptr[3] = object;
#endif
}
else
@@ -1723,26 +1723,26 @@ convert_iif (void)
{
case 4:
gen_to_words (words, 2, 8);
- md_number_to_imm (memP, (long) words[0],
+ md_number_to_imm (memP, words[0],
sizeof (LITTLENUM_TYPE));
md_number_to_imm (memP + sizeof (LITTLENUM_TYPE),
- (long) words[1],
+ words[1],
sizeof (LITTLENUM_TYPE));
break;
case 8:
gen_to_words (words, 4, 11);
- md_number_to_imm (memP, (long) words[0],
+ md_number_to_imm (memP, words[0],
sizeof (LITTLENUM_TYPE));
md_number_to_imm (memP + sizeof (LITTLENUM_TYPE),
- (long) words[1],
+ words[1],
sizeof (LITTLENUM_TYPE));
md_number_to_imm ((memP + 2
* sizeof (LITTLENUM_TYPE)),
- (long) words[2],
+ words[2],
sizeof (LITTLENUM_TYPE));
md_number_to_imm ((memP + 3
* sizeof (LITTLENUM_TYPE)),
- (long) words[3],
+ words[3],
sizeof (LITTLENUM_TYPE));
break;
}
@@ -1758,7 +1758,7 @@ convert_iif (void)
the object later. */
exprP.X_add_number += iif.iifP[i].object_adjust;
fix_new_ns32k_exp (frag_now,
- (long) (memP - frag_now->fr_literal),
+ memP - frag_now->fr_literal,
size,
&exprP,
iif.iifP[i].pcrel,
@@ -1806,12 +1806,12 @@ convert_iif (void)
size = default_disp_size; /* Normally 4 bytes. */
memP = frag_more (size);
fix_new_ns32k_exp (frag_now,
- (long) (memP - frag_now->fr_literal),
+ memP - frag_now->fr_literal,
size,
&exprP,
0, /* never iif.iifP[i].pcrel, */
1, /* always iif.iifP[i].im_disp */
- (bit_fixS *) 0, 0,
+ 0, 0,
inst_frag,
inst_offset);
break; /* Exit this absolute hack. */
@@ -1966,7 +1966,7 @@ md_fix_pcrel_adjust (fixS *fixP)
void
md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
{
- long val = * (long *) valP;
+ long val = *valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
if (fix_bit_fixP (fixP))
@@ -2035,7 +2035,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
disp = (S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset) - object_address;
disp += md_pcrel_adjust (fragP);
- md_number_to_disp (buffer_address, (long) disp, (int) ext);
+ md_number_to_disp (buffer_address, disp, ext);
fragP->fr_fix += ext;
}
@@ -2053,7 +2053,7 @@ md_estimate_size_before_relax (fragS *fragP, segT segment)
/* We don't relax symbols defined in another segment. The
thing to do is to assume the object will occupy 4 bytes. */
fix_new_ns32k (fragP,
- (int) (fragP->fr_fix),
+ fragP->fr_fix,
4,
fragP->fr_symbol,
fragP->fr_offset,
@@ -2093,8 +2093,8 @@ md_create_short_jump (char *ptr,
valueT offset;
offset = to_addr - from_addr;
- md_number_to_chars (ptr, (valueT) 0xEA, 1);
- md_number_to_disp (ptr + 1, (valueT) offset, 2);
+ *ptr++ = 0xEA;
+ md_number_to_disp (ptr, offset, 2);
}
void
@@ -2107,8 +2107,8 @@ md_create_long_jump (char *ptr,
valueT offset;
offset = to_addr - from_addr;
- md_number_to_chars (ptr, (valueT) 0xEA, 1);
- md_number_to_disp (ptr + 1, (valueT) offset, 4);
+ *ptr++ = 0xEA;
+ md_number_to_disp (ptr, offset, 4);
}
const char md_shortopts[] = "m:";
diff --git a/gas/config/tc-or1k.c b/gas/config/tc-or1k.c
index 5b3e013..33975fe 100644
--- a/gas/config/tc-or1k.c
+++ b/gas/config/tc-or1k.c
@@ -164,7 +164,7 @@ valueT
md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & -(1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
symbolS *
@@ -223,7 +223,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
long
md_pcrel_from_section (fixS * fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| (S_GET_SEGMENT (fixP->fx_addsy) != sec)
|| S_IS_EXTERNAL (fixP->fx_addsy)
@@ -391,4 +391,3 @@ or1k_cfi_frame_initial_instructions (void)
{
cfi_add_CFA_def_cfa_register (1);
}
-
diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index 2c3722c..2c8a1b8 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -239,12 +239,12 @@ md_number_to_chars (char con[], valueT value, int nbytes)
void
md_apply_fix (fixS *fixP,
- valueT * valP,
- segT seg ATTRIBUTE_UNUSED)
+ valueT *valP,
+ segT seg ATTRIBUTE_UNUSED)
{
valueT code;
valueT mask;
- valueT val = * valP;
+ valueT val = *valP;
char *buf;
int shift;
int size;
@@ -710,7 +710,7 @@ md_assemble (char *instruction_string)
c = *p;
*p = '\0';
- op = (struct pdp11_opcode *)str_hash_find (insn_hash, str);
+ op = str_hash_find (insn_hash, str);
*p = c;
if (op == 0)
{
diff --git a/gas/config/tc-pj.c b/gas/config/tc-pj.c
index 849f905..61fada7 100644
--- a/gas/config/tc-pj.c
+++ b/gas/config/tc-pj.c
@@ -252,7 +252,7 @@ md_assemble (char *str)
if (nlen == 0)
as_bad (_("can't find opcode "));
- opcode = (pj_opc_info_t *) str_hash_find (opcode_hash_control, op_start);
+ opcode = str_hash_find (opcode_hash_control, op_start);
*op_end = pend;
if (opcode == NULL)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 33f3a4c..9b3aaab 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1951,7 +1951,7 @@ ppc_cleanup (void)
char *p;
asection *seg = now_seg;
subsegT subseg = now_subseg;
- asection *apuinfo_secp = (asection *) NULL;
+ asection *apuinfo_secp = NULL;
unsigned int i;
/* Create the .PPC.EMB.apuinfo section. */
@@ -1959,13 +1959,13 @@ ppc_cleanup (void)
bfd_set_section_flags (apuinfo_secp, SEC_HAS_CONTENTS | SEC_READONLY);
p = frag_more (4);
- md_number_to_chars (p, (valueT) 8, 4);
+ md_number_to_chars (p, 8, 4);
p = frag_more (4);
- md_number_to_chars (p, (valueT) ppc_apuinfo_num * 4, 4);
+ md_number_to_chars (p, ppc_apuinfo_num * 4, 4);
p = frag_more (4);
- md_number_to_chars (p, (valueT) 2, 4);
+ md_number_to_chars (p, 2, 4);
p = frag_more (8);
strcpy (p, APUINFO_LABEL);
@@ -1973,7 +1973,7 @@ ppc_cleanup (void)
for (i = 0; i < ppc_apuinfo_num; i++)
{
p = frag_more (4);
- md_number_to_chars (p, (valueT) ppc_apuinfo_list[i], 4);
+ md_number_to_chars (p, ppc_apuinfo_list[i], 4);
}
frag_align (2, 0, 0);
@@ -2071,7 +2071,7 @@ ppc_insert_operand (uint64_t insn,
errmsg = NULL;
insn = (*operand->insert) (insn, val, cpu, &errmsg);
- if (errmsg != (const char *) NULL)
+ if (errmsg != NULL)
as_bad_where (file, line, "%s", errmsg);
}
else
@@ -2298,7 +2298,7 @@ ppc_elf_suffix (char **str_p, expressionS *exp_p)
}
*str_p = str;
- if (reloc == (int) BFD_RELOC_PPC64_TOC
+ if (reloc == BFD_RELOC_PPC64_TOC
&& exp_p->X_op == O_symbol
&& strcmp (S_GET_NAME (exp_p->X_add_symbol), ".TOC.") == 0)
{
@@ -2311,7 +2311,7 @@ ppc_elf_suffix (char **str_p, expressionS *exp_p)
&& (ppc_cpu & PPC_OPCODE_POWER10) == 0)
reloc = BFD_RELOC_PPC64_REL24_P9NOTOC;
- return (bfd_reloc_code_real_type) reloc;
+ return reloc;
}
return BFD_RELOC_NONE;
@@ -2470,8 +2470,7 @@ ppc_elf_lcomm (int xxx ATTRIBUTE_UNUSED)
if (S_GET_SEGMENT (symbolP) == bss_section)
symbol_get_frag (symbolP)->fr_symbol = 0;
symbol_set_frag (symbolP, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size,
- (char *) 0);
+ pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
*pfrag = 0;
S_SET_SIZE (symbolP, size);
S_SET_SEGMENT (symbolP, bss_section);
@@ -2780,7 +2779,7 @@ ppc_xcoff_suffix (char **str_p)
&& (ppc_obj64 ? ptr->valid64 : ptr->valid32))
{
*str_p = str;
- return (bfd_reloc_code_real_type) ptr->reloc;
+ return ptr->reloc;
}
return BFD_RELOC_NONE;
@@ -2948,7 +2947,7 @@ ppc_frob_label (symbolS *sym)
/* Set the class of a label based on where it is defined. This handles
symbols without suffixes. Also, move the symbol so that it follows
the csect symbol. */
- if (ppc_current_csect != (symbolS *) NULL)
+ if (ppc_current_csect != NULL)
{
if (symbol_get_tc (sym)->symbol_class == -1)
symbol_get_tc (sym)->symbol_class = symbol_get_tc (ppc_current_csect)->symbol_class;
@@ -3331,8 +3330,8 @@ md_assemble (char *str)
*s++ = '\0';
/* Look up the opcode in the hash table. */
- opcode = (const struct powerpc_opcode *) str_hash_find (ppc_hash, str);
- if (opcode == (const struct powerpc_opcode *) NULL)
+ opcode = str_hash_find (ppc_hash, str);
+ if (opcode == NULL)
{
as_bad (_("unrecognized opcode: `%s'"), str);
ppc_clear_labels ();
@@ -3453,7 +3452,7 @@ md_assemble (char *str)
if (operand->insert)
{
insn = (*operand->insert) (insn, val, ppc_cpu, &errmsg);
- if (errmsg != (const char *) NULL)
+ if (errmsg != NULL)
as_bad ("%s", errmsg);
}
else if (operand->shift >= 0)
@@ -3496,7 +3495,7 @@ md_assemble (char *str)
&& (operand->flags & PPC_OPERAND_GPR_0) != 0))
as_warn (_("invalid register expression"));
insn = ppc_insert_operand (insn, operand, ex.X_add_number,
- ppc_cpu, (char *) NULL, 0);
+ ppc_cpu, NULL, 0);
}
else if (ex.X_op == O_constant
|| (ex.X_op == O_big && ex.X_add_number > 0))
@@ -3694,7 +3693,7 @@ md_assemble (char *str)
else
insn = ppc_insert_operand (insn, operand,
ppc_obj64 ? 13 : 2,
- ppc_cpu, (char *) NULL, 0);
+ ppc_cpu, NULL, 0);
break;
/* We'll only use the 32 (or 64) bit form of these relocations
@@ -4465,8 +4464,7 @@ ppc_comm (int lcomm)
frag_align (align, 0, 0);
symbol_set_frag (def_sym, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, def_sym,
- def_size, (char *) NULL);
+ pfrag = frag_var (rs_org, 1, 1, 0, def_sym, def_size, NULL);
*pfrag = 0;
S_SET_SEGMENT (def_sym, section->segment);
symbol_get_tc (def_sym)->align = align;
@@ -4642,14 +4640,14 @@ ppc_change_csect (symbolS *sym, offsetT align)
frag_align (align, 0, 0);
symbol_set_frag (sym, frag_now);
- S_SET_VALUE (sym, (valueT) frag_now_fix ());
+ S_SET_VALUE (sym, frag_now_fix ());
symbol_get_tc (sym)->align = align;
symbol_get_tc (sym)->output = 1;
symbol_get_tc (sym)->within = sym;
for (list = section->csects;
- symbol_get_tc (list)->next != (symbolS *) NULL;
+ symbol_get_tc (list)->next != NULL;
list = symbol_get_tc (list)->next)
;
symbol_get_tc (list)->next = sym;
@@ -5122,7 +5120,7 @@ ppc_stabx (int ignore ATTRIBUTE_UNUSED)
exp.X_add_number = 0;
/* Fall through. */
case O_constant:
- S_SET_VALUE (sym, (valueT) exp.X_add_number);
+ S_SET_VALUE (sym, exp.X_add_number);
symbol_set_frag (sym, &zero_address_frag);
break;
@@ -5290,7 +5288,7 @@ ppc_function (int ignore ATTRIBUTE_UNUSED)
/* Ignore any [PR] suffix. */
name = ppc_canonicalize_symbol_name (name);
s = strchr (name, '[');
- if (s != (char *) NULL
+ if (s != NULL
&& strcmp (s + 1, "PR]") == 0)
*s = '\0';
@@ -5391,7 +5389,6 @@ ppc_bf (int ignore ATTRIBUTE_UNUSED)
saved_bi_sym = 0;
}
-
symbol_get_tc (sym)->output = 1;
ppc_frob_label (sym);
@@ -5461,13 +5458,13 @@ ppc_biei (int ei)
saved_bi_sym = sym;
for (look = last_biei ? last_biei : symbol_rootP;
- (look != (symbolS *) NULL
+ (look != NULL
&& (S_GET_STORAGE_CLASS (look) == C_FILE
|| S_GET_STORAGE_CLASS (look) == C_BINCL
|| S_GET_STORAGE_CLASS (look) == C_EINCL));
look = symbol_next (look))
;
- if (look != (symbolS *) NULL)
+ if (look != NULL)
{
symbol_remove (sym, &symbol_rootP, &symbol_lastP);
symbol_insert (sym, look, &symbol_rootP, &symbol_lastP);
@@ -5633,7 +5630,7 @@ ppc_ec (int ignore ATTRIBUTE_UNUSED)
static void
ppc_toc (int ignore ATTRIBUTE_UNUSED)
{
- if (ppc_toc_csect != (symbolS *) NULL)
+ if (ppc_toc_csect != NULL)
subseg_set (data_section, symbol_get_tc (ppc_toc_csect)->subseg);
else
{
@@ -5650,7 +5647,7 @@ ppc_toc (int ignore ATTRIBUTE_UNUSED)
sym = symbol_find_or_make ("TOC[TC0]");
symbol_set_frag (sym, frag_now);
S_SET_SEGMENT (sym, data_section);
- S_SET_VALUE (sym, (valueT) frag_now_fix ());
+ S_SET_VALUE (sym, frag_now_fix ());
symbol_get_tc (sym)->subseg = subseg;
symbol_get_tc (sym)->output = 1;
symbol_get_tc (sym)->within = sym;
@@ -5658,7 +5655,7 @@ ppc_toc (int ignore ATTRIBUTE_UNUSED)
ppc_toc_csect = sym;
for (list = ppc_xcoff_data_section.csects;
- symbol_get_tc (list)->next != (symbolS *) NULL;
+ symbol_get_tc (list)->next != NULL;
list = symbol_get_tc (list)->next)
;
symbol_get_tc (list)->next = sym;
@@ -5766,7 +5763,7 @@ ppc_tc (int ignore ATTRIBUTE_UNUSED)
char endc;
symbolS *sym;
- if (ppc_toc_csect == (symbolS *) NULL
+ if (ppc_toc_csect == NULL
|| ppc_toc_csect != ppc_current_csect)
{
as_bad (_(".tc not in .toc section"));
@@ -5804,7 +5801,7 @@ ppc_tc (int ignore ATTRIBUTE_UNUSED)
S_SET_SEGMENT (sym, now_seg);
symbol_set_frag (sym, frag_now);
- S_SET_VALUE (sym, (valueT) frag_now_fix ());
+ S_SET_VALUE (sym, frag_now_fix ());
/* AIX assembler seems to allow any storage class to be set in .tc.
But for now, only XMC_TC and XMC_TE are supported by us. */
@@ -6010,7 +6007,7 @@ ppc_symbol_new_hook (symbolS *sym)
return;
s = strchr (S_GET_NAME (sym), '[');
- if (s == (const char *) NULL)
+ if (s == NULL)
{
/* There is no suffix. */
return;
@@ -6111,7 +6108,7 @@ ppc_frob_symbol (symbolS *sym)
if (sym == abs_section_sym)
return 1;
- if (symbol_get_tc (sym)->real_name != (char *) NULL)
+ if (symbol_get_tc (sym)->real_name != NULL)
S_SET_NAME (sym, symbol_get_tc (sym)->real_name);
else
{
@@ -6120,7 +6117,7 @@ ppc_frob_symbol (symbolS *sym)
name = S_GET_NAME (sym);
s = strchr (name, '[');
- if (s != (char *) NULL)
+ if (s != NULL)
{
unsigned int len;
char *snew;
@@ -6132,7 +6129,7 @@ ppc_frob_symbol (symbolS *sym)
}
}
- if (set_end != (symbolS *) NULL)
+ if (set_end != NULL)
{
SA_SET_SYM_ENDNDX (set_end, sym);
set_end = NULL;
@@ -6140,15 +6137,11 @@ ppc_frob_symbol (symbolS *sym)
if (SF_GET_FUNCTION (sym))
{
- /* Make sure coff_last_function is reset. Otherwise, we won't create
- the auxent for the next function. */
- coff_last_function = 0;
ppc_last_function = sym;
- if (symbol_get_tc (sym)->u.size != (symbolS *) NULL)
+ if (symbol_get_tc (sym)->u.size != NULL)
{
resolve_symbol_value (symbol_get_tc (sym)->u.size);
- SA_SET_SYM_FSIZE (sym,
- (long) S_GET_VALUE (symbol_get_tc (sym)->u.size));
+ SA_SET_SYM_FSIZE (sym, S_GET_VALUE (symbol_get_tc (sym)->u.size));
}
else
{
@@ -6164,16 +6157,12 @@ ppc_frob_symbol (symbolS *sym)
else if (S_GET_STORAGE_CLASS (sym) == C_FCN
&& strcmp (S_GET_NAME (sym), ".ef") == 0)
{
- if (ppc_last_function == (symbolS *) NULL)
+ if (ppc_last_function == NULL)
as_bad (_(".ef with no preceding .function"));
else
{
set_end = ppc_last_function;
ppc_last_function = NULL;
-
- /* We don't have a C_EFCN symbol, but we need to force the
- COFF backend to believe that it has seen one. */
- coff_last_function = NULL;
}
}
@@ -6211,7 +6200,7 @@ ppc_frob_symbol (symbolS *sym)
{
/* This is a csect symbol. x_scnlen is the size of the
csect. */
- if (symbol_get_tc (sym)->next == (symbolS *) NULL)
+ if (symbol_get_tc (sym)->next == NULL)
a->u.auxent.x_csect.x_scnlen.u64
= bfd_section_size (S_GET_SEGMENT (sym)) - S_GET_VALUE (sym);
else
@@ -6266,10 +6255,10 @@ ppc_frob_symbol (symbolS *sym)
next = symbol_next (sym);
while (symbol_get_tc (next)->symbol_class == XMC_TC0)
next = symbol_next (next);
- if (next == (symbolS *) NULL
+ if (next == NULL
|| (!ppc_is_toc_sym (next)))
{
- if (ppc_after_toc_frag == (fragS *) NULL)
+ if (ppc_after_toc_frag == NULL)
a->u.auxent.x_csect.x_scnlen.u64
= bfd_section_size (data_section) - S_GET_VALUE (sym);
else
@@ -6302,14 +6291,14 @@ ppc_frob_symbol (symbolS *sym)
/* Skip the initial dummy symbol. */
csect = symbol_get_tc (csect)->next;
- if (csect == (symbolS *) NULL)
+ if (csect == NULL)
{
as_warn (_("warning: symbol %s has no csect"), S_GET_NAME (sym));
a->u.auxent.x_csect.x_scnlen.u64 = 0;
}
else
{
- while (symbol_get_tc (csect)->next != (symbolS *) NULL)
+ while (symbol_get_tc (csect)->next != NULL)
{
resolve_symbol_value (symbol_get_tc (csect)->next);
if (S_GET_VALUE (symbol_get_tc (csect)->next)
@@ -6345,7 +6334,7 @@ ppc_frob_symbol (symbolS *sym)
asymbol *bsym = symbol_get_bfdsym (symbol_get_tc (sym)->within);
combined_entry_type *c = coffsymbol (bsym)->native;
- S_SET_VALUE (sym, (valueT) (size_t) c);
+ S_SET_VALUE (sym, (uintptr_t) c);
coffsymbol (symbol_get_bfdsym (sym))->native->fix_value = 1;
}
else if (S_GET_STORAGE_CLASS (sym) == C_STSYM)
@@ -6504,7 +6493,7 @@ md_section_align (asection *seg ATTRIBUTE_UNUSED, valueT addr)
#else
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
#endif
}
@@ -6607,17 +6596,17 @@ ppc_fix_adjustable (fixS *fix)
if (bfd_section_flags (symseg) & SEC_DEBUGGING)
return 1;
- if (ppc_toc_csect != (symbolS *) NULL
+ if (ppc_toc_csect != NULL
&& fix->fx_addsy != ppc_toc_csect
&& symseg == data_section
&& val >= ppc_toc_frag->fr_address
- && (ppc_after_toc_frag == (fragS *) NULL
+ && (ppc_after_toc_frag == NULL
|| val < ppc_after_toc_frag->fr_address))
{
symbolS *sy;
for (sy = symbol_next (ppc_toc_csect);
- sy != (symbolS *) NULL;
+ sy != NULL;
sy = symbol_next (sy))
{
TC_SYMFIELD_TYPE *sy_tc = symbol_get_tc (sy);
@@ -6894,6 +6883,9 @@ ppc_handle_align (segT sec, struct frag *fragP)
{
valueT count = (fragP->fr_next->fr_address
- (fragP->fr_address + fragP->fr_fix));
+ if (count == 0)
+ return;
+
char *dest = fragP->fr_literal + fragP->fr_fix;
enum ppc_nop_encoding_for_rs_align_code nop_select = *dest & 0xff;
@@ -6901,8 +6893,7 @@ ppc_handle_align (segT sec, struct frag *fragP)
We could pad with zeros up to an instruction boundary then follow
with nops but odd counts indicate data in an executable section
so padding with zeros is most appropriate. */
- if (count == 0
- || (nop_select == PPC_NOP_VLE ? (count & 1) != 0 : (count & 3) != 0))
+ if (nop_select == PPC_NOP_VLE ? (count & 1) != 0 : (count & 3) != 0)
{
*dest = 0;
return;
@@ -6920,28 +6911,13 @@ ppc_handle_align (segT sec, struct frag *fragP)
if (count > 4 * nop_limit && count < 0x2000000)
{
- struct frag *rest;
-
- /* Make a branch, then follow with nops. Insert another
- frag to handle the nops. */
+ /* Make a branch, then follow with nops. */
md_number_to_chars (dest, 0x48000000 + count, 4);
+ dest += 4;
+ fragP->fr_fix += 4;
count -= 4;
if (count == 0)
return;
-
- segment_info_type *seginfo = seg_info (sec);
- struct obstack *ob = &seginfo->frchainP->frch_obstack;
- rest = frag_alloc (ob, 4);
- memcpy (rest, fragP, SIZEOF_STRUCT_FRAG);
- fragP->fr_next = rest;
- fragP = rest;
- rest->fr_address += rest->fr_fix + 4;
- rest->fr_fix = 0;
- /* If we leave the next frag as rs_align_code we'll come here
- again, resulting in a bunch of branches rather than a
- branch followed by nops. */
- rest->fr_type = rs_align;
- dest = rest->fr_literal;
}
md_number_to_chars (dest, 0x60000000, 4);
@@ -6984,7 +6960,7 @@ ppc_handle_align (segT sec, struct frag *fragP)
void
md_apply_fix (fixS *fixP, valueT *valP, segT seg)
{
- valueT value = * valP;
+ valueT value = *valP;
offsetT fieldval;
const struct powerpc_operand *operand;
@@ -7011,7 +6987,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
use *valP, and must use fx_offset instead. If the relocation
is PC-relative, we then need to re-apply md_pcrel_from_section
to this new relocation value. */
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
else
@@ -7785,7 +7761,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
reloc->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_PPC_NEG);
reloc->addend = fixp->fx_addnumber;
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_subtract (fixp);
relocs[0] = NULL;
diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h
index f6b37f8..e568c42 100644
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -19,6 +19,7 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#ifndef TC_PPC
#define TC_PPC
#include "opcode/ppc.h"
@@ -72,7 +73,7 @@ extern const char *ppc_target_format (void);
/* We don't need to handle .word strangely. */
#define WORKING_DOT_WORD
-#define MAX_MEM_FOR_RS_ALIGN_CODE 4
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) 8
#define HANDLE_ALIGN(SEC, FRAGP) \
if ((FRAGP)->fr_type == rs_align_code) \
ppc_handle_align (SEC, FRAGP);
@@ -367,3 +368,5 @@ extern int ppc_dwarf2_line_min_insn_length;
#define DWARF2_DEFAULT_RETURN_COLUMN 0x41
#define DWARF2_CIE_DATA_ALIGNMENT ppc_cie_data_alignment
#define EH_FRAME_ALIGNMENT 2
+
+#endif /* TC_PPC */
diff --git a/gas/config/tc-pru.c b/gas/config/tc-pru.c
index 70a4e76..dcc23ba 100644
--- a/gas/config/tc-pru.c
+++ b/gas/config/tc-pru.c
@@ -134,12 +134,12 @@ typedef struct pru_insn_info
/* Opcode hash table. */
static htab_t pru_opcode_hash = NULL;
#define pru_opcode_lookup(NAME) \
- ((struct pru_opcode *) str_hash_find (pru_opcode_hash, (NAME)))
+ (str_hash_find (pru_opcode_hash, (NAME)))
/* Register hash table. */
static htab_t pru_reg_hash = NULL;
#define pru_reg_lookup(NAME) \
- ((struct pru_reg *) str_hash_find (pru_reg_hash, (NAME)))
+ (str_hash_find (pru_reg_hash, (NAME)))
/* The known current alignment of the current section. */
static int pru_current_align;
@@ -255,7 +255,7 @@ pru_align (int log_size, const char *pfill, symbolS *label)
old_frag = symbol_get_frag (label);
old_value = S_GET_VALUE (label);
- new_value = (valueT) frag_now_fix ();
+ new_value = frag_now_fix ();
/* It is possible to have more than one label at a particular
address, especially if debugging is enabled, so we must
@@ -341,10 +341,10 @@ s_pru_align (int ignore ATTRIBUTE_UNUSED)
{
input_line_pointer++;
fill = get_absolute_expression ();
- pfill = (const char *) &fill;
+ pfill = &fill;
}
else if (subseg_text_p (now_seg))
- pfill = (const char *) &nop;
+ pfill = nop;
else
{
pfill = NULL;
@@ -680,7 +680,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
/* In general, fix instructions with immediate
constants. But leave LDI32 for the linker,
which is prepared to shorten insns. */
- if (fixP->fx_addsy == (symbolS *) NULL
+ if (fixP->fx_addsy == NULL
&& fixP->fx_r_type != BFD_RELOC_PRU_LDI32)
fixP->fx_done = 1;
@@ -751,7 +751,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
fixP->fx_subsy = NULL;
}
/* We don't actually support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
/* For the DIFF relocs, write the value into the object file while still
@@ -765,11 +765,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
break;
case BFD_RELOC_PRU_GNU_DIFF16:
case BFD_RELOC_PRU_GNU_DIFF16_PMEM:
- bfd_putl16 ((bfd_vma) value, where);
+ bfd_putl16 (value, where);
break;
case BFD_RELOC_PRU_GNU_DIFF32:
case BFD_RELOC_PRU_GNU_DIFF32_PMEM:
- bfd_putl32 ((bfd_vma) value, where);
+ bfd_putl32 (value, where);
break;
default:
break;
@@ -949,7 +949,7 @@ pru_assemble_expression (const char *exprstr,
if (pru_mode == PRU_MODE_TEST && ep->X_op == O_constant)
value = ep->X_add_number;
- return (unsigned long) value;
+ return value;
}
/* Try to parse a non-relocatable expression. */
@@ -1100,7 +1100,6 @@ pru_assemble_arg_b (pru_insn_infoS *insn_info, const char *argstr)
SET_INSN_FIELD (RS2, insn_info->insn_code, src2->index);
SET_INSN_FIELD (RS2SEL, insn_info->insn_code, src2->regsel);
}
-
}
static void
@@ -1554,7 +1553,6 @@ md_show_usage (FILE *stream)
" -mlink-relax generate relocations for linker relaxation (default).\n"
" -mno-link-relax don't generate relocations for linker relaxation.\n"
));
-
}
/* This function is called once, at assembler startup time.
@@ -1817,7 +1815,7 @@ pru_frob_label (symbolS *lab)
/* Update the label's address with the current output pointer. */
symbol_set_frag (lab, frag_now);
- S_SET_VALUE (lab, (valueT) frag_now_fix ());
+ S_SET_VALUE (lab, frag_now_fix ());
/* Record this label for future adjustment after we find out what
kind of data it references, and the required alignment therewith. */
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 8485ad4..8a33568 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -93,6 +93,7 @@ enum riscv_csr_class
CSR_CLASS_SSAIA_AND_H_32, /* Ssaia with H, rv32 only */
CSR_CLASS_SSAIA_OR_SSCSRIND, /* Ssaia/Smcsrind */
CSR_CLASS_SSAIA_OR_SSCSRIND_AND_H, /* Ssaia/Smcsrind with H */
+ CSR_CLASS_SSCCFG, /* Ssccfg */
CSR_CLASS_SSCSRIND, /* Sscsrind */
CSR_CLASS_SSCSRIND_AND_H, /* Sscsrind with H */
CSR_CLASS_SSSTATEEN, /* S[ms]stateen only */
@@ -331,6 +332,7 @@ struct riscv_option_stack
struct riscv_option_stack *next;
struct riscv_set_options options;
riscv_subset_list_t *subset_list;
+ unsigned xlen;
};
static struct riscv_option_stack *riscv_opts_stack = NULL;
@@ -536,7 +538,7 @@ make_mapping_symbol (enum riscv_seg_mstate state,
{
/* Store current $x+arch into tc_segment_info. */
seg_info (now_seg)->tc_segment_info_data.arch_map_symbol = symbol;
- xfree ((void *) buff);
+ xfree (buff);
}
/* If .fill or other data filling directive generates zero sized data,
@@ -932,7 +934,7 @@ opcode_name_lookup (char **s)
save_c = *e;
*e = '\0';
- o = (struct opcode_name_t *) str_hash_find (opcode_names_hash, *s);
+ o = str_hash_find (opcode_names_hash, *s);
/* Advance to next token if one was recognized. */
if (o)
@@ -960,15 +962,15 @@ static htab_t reg_names_hash = NULL;
static htab_t csr_extra_hash = NULL;
#define ENCODE_REG_HASH(cls, n) \
- ((void *)(uintptr_t)((n) * RCLASS_MAX + (cls) + 1))
-#define DECODE_REG_CLASS(hash) (((uintptr_t)(hash) - 1) % RCLASS_MAX)
-#define DECODE_REG_NUM(hash) (((uintptr_t)(hash) - 1) / RCLASS_MAX)
+ ((n) * RCLASS_MAX + (cls) + 1)
+#define DECODE_REG_CLASS(hash) (((hash) - 1) % RCLASS_MAX)
+#define DECODE_REG_NUM(hash) (((hash) - 1) / RCLASS_MAX)
static void
hash_reg_name (enum reg_class class, const char *name, unsigned n)
{
- void *hash = ENCODE_REG_HASH (class, n);
- if (str_hash_insert (reg_names_hash, name, hash, 0) != NULL)
+ uintptr_t hash = ENCODE_REG_HASH (class, n);
+ if (str_hash_insert_int (reg_names_hash, name, hash, 0) != NULL)
as_fatal (_("internal: duplicate %s"), name);
}
@@ -994,7 +996,7 @@ riscv_init_csr_hash (const char *name,
bool need_enrty = true;
pre_entry = NULL;
- entry = (struct riscv_csr_extra *) str_hash_find (csr_extra_hash, name);
+ entry = str_hash_find (csr_extra_hash, name);
while (need_enrty && entry != NULL)
{
if (entry->csr_class == class
@@ -1118,6 +1120,9 @@ riscv_csr_address (const char *csr_name,
is_h_required = (csr_class == CSR_CLASS_SSAIA_OR_SSCSRIND_AND_H);
extension = "ssaia or sscsrind";
break;
+ case CSR_CLASS_SSCCFG:
+ extension = "ssccfg";
+ break;
case CSR_CLASS_SSCSRIND:
case CSR_CLASS_SSCSRIND_AND_H:
is_h_required = (csr_class == CSR_CLASS_SSCSRIND_AND_H);
@@ -1206,8 +1211,7 @@ riscv_csr_address (const char *csr_name,
static unsigned int
reg_csr_lookup_internal (const char *s)
{
- struct riscv_csr_extra *r =
- (struct riscv_csr_extra *) str_hash_find (csr_extra_hash, s);
+ struct riscv_csr_extra *r = str_hash_find (csr_extra_hash, s);
if (r == NULL)
return -1U;
@@ -1218,13 +1222,13 @@ reg_csr_lookup_internal (const char *s)
static unsigned int
reg_lookup_internal (const char *s, enum reg_class class)
{
- void *r;
+ uintptr_t r;
if (class == RCLASS_CSR)
return reg_csr_lookup_internal (s);
- r = str_hash_find (reg_names_hash, s);
- if (r == NULL || DECODE_REG_CLASS (r) != class)
+ r = str_hash_find_int (reg_names_hash, s);
+ if (r == (uintptr_t) -1 || DECODE_REG_CLASS (r) != class)
return -1;
if (riscv_subset_supports (&riscv_rps_as, "e")
@@ -1752,6 +1756,21 @@ validate_riscv_insn (const struct riscv_opcode *opc, int length)
goto unknown_validate_operand;
}
break;
+ case 'm': /* Vendor-specific (MIPS) operands. */
+ switch (*++oparg)
+ {
+ case '@': USE_BITS (OP_MASK_MIPS_HINT, OP_SH_MIPS_HINT);
+ break;
+ case '#': USE_BITS (OP_MASK_MIPS_IMM9, OP_SH_MIPS_IMM9);
+ break;
+ case '$': used_bits |= ENCODE_MIPS_LDP_IMM (-1U); break;
+ case '%': used_bits |= ENCODE_MIPS_LWP_IMM (-1U); break;
+ case '^': used_bits |= ENCODE_MIPS_SDP_IMM (-1U); break;
+ case '&': used_bits |= ENCODE_MIPS_SWP_IMM (-1U); break;
+ default:
+ goto unknown_validate_operand;
+ }
+ break;
default:
goto unknown_validate_operand;
}
@@ -1867,15 +1886,13 @@ riscv_record_pcrel_fixup (htab_t p, const asection *sec, bfd_vma address,
symbolS *symbol, bfd_vma target)
{
riscv_pcrel_hi_fixup entry = {sec, address, symbol, target};
- riscv_pcrel_hi_fixup **slot =
- (riscv_pcrel_hi_fixup **) htab_find_slot (p, &entry, INSERT);
+ void **slot = htab_find_slot (p, &entry, INSERT);
if (slot == NULL)
return false;
- *slot = (riscv_pcrel_hi_fixup *) xmalloc (sizeof (riscv_pcrel_hi_fixup));
- if (*slot == NULL)
- return false;
- **slot = entry;
+ riscv_pcrel_hi_fixup *pent = xmalloc (sizeof (*pent));
+ *slot = pent;
+ *pent = entry;
return true;
}
@@ -2029,7 +2046,7 @@ macro_build (expressionS *ep, const char *name, const char *fmt, ...)
va_start (args, fmt);
r = BFD_RELOC_UNUSED;
- mo = (struct riscv_opcode *) str_hash_find (op_hash, name);
+ mo = str_hash_find (op_hash, name);
gas_assert (mo);
/* Find a non-RVC variant of the instruction. append_insn will compress
@@ -2845,7 +2862,7 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
break;
}
- insn = (struct riscv_opcode *) str_hash_find (hash, str);
+ insn = str_hash_find (hash, str);
probing_insn_operands = true;
@@ -4173,6 +4190,92 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
#undef ENCODE_UIMM_BIT_FIELD
break;
+ case 'm': /* Vendor-specific (MIPS) operands. */
+ switch (*++oparg)
+ {
+ case '@': /* hint 0 - 31. */
+ my_getExpression (imm_expr, asarg);
+ check_absolute_expr (ip, imm_expr, FALSE);
+ if ((unsigned long)imm_expr->X_add_number > 31)
+ as_bad(_("Improper hint amount (%lu)"),
+ (unsigned long)imm_expr->X_add_number);
+ INSERT_OPERAND(MIPS_HINT, *ip, imm_expr->X_add_number);
+ imm_expr->X_op = O_absent;
+ asarg = expr_parse_end;
+ continue;
+
+ case '#': /* immediate 0 - 511. */
+ my_getExpression (imm_expr, asarg);
+ check_absolute_expr (ip, imm_expr, FALSE);
+ if ((unsigned long)imm_expr->X_add_number > 511)
+ as_bad(_("Improper immediate amount (%lu)"),
+ (unsigned long)imm_expr->X_add_number);
+ INSERT_OPERAND(MIPS_IMM9, *ip, imm_expr->X_add_number);
+ imm_expr->X_op = O_absent;
+ asarg = expr_parse_end;
+ continue;
+
+ case '$': /* LDP offset 0 to (1<<7)-8. */
+ my_getExpression (imm_expr, asarg);
+ check_absolute_expr (ip, imm_expr, FALSE);
+ if ((unsigned long)imm_expr->X_add_number >= (1 << 7)
+ || ((unsigned long)imm_expr->X_add_number & 0x7) != 0)
+ as_bad(_("Improper LDP offset amount (%lu)"),
+ (unsigned long)imm_expr->X_add_number);
+ INSERT_OPERAND(MIPS_LDP_OFFSET, *ip,
+ (imm_expr->X_add_number >> 3));
+ imm_expr->X_op = O_absent;
+ asarg = expr_parse_end;
+ continue;
+
+ case '%': /* LWP offset 0 to (1<<7)-4. */
+ my_getExpression (imm_expr, asarg);
+ check_absolute_expr (ip, imm_expr, FALSE);
+ if ((unsigned long)imm_expr->X_add_number >= (1 << 7)
+ || ((unsigned long)imm_expr->X_add_number & 0x3) != 0)
+ as_bad(_("Improper LWP offset amount (%lu)"),
+ (unsigned long)imm_expr->X_add_number);
+ INSERT_OPERAND(MIPS_LWP_OFFSET, *ip,
+ (imm_expr->X_add_number >> 2));
+ imm_expr->X_op = O_absent;
+ asarg = expr_parse_end;
+ continue;
+
+ case '^': /* SDP offset 0 to (1<<7)-8. */
+ my_getExpression (imm_expr, asarg);
+ check_absolute_expr (ip, imm_expr, FALSE);
+ if ((unsigned long)imm_expr->X_add_number >= (1 << 7)
+ || ((unsigned long)imm_expr->X_add_number & 0x7) != 0)
+ as_bad(_("Improper SDP offset amount (%lu)"),
+ (unsigned long)imm_expr->X_add_number);
+ INSERT_OPERAND(MIPS_SDP_OFFSET10, *ip,
+ (imm_expr->X_add_number >> 3));
+ INSERT_OPERAND(MIPS_SDP_OFFSET25, *ip,
+ (imm_expr->X_add_number >> 5));
+ imm_expr->X_op = O_absent;
+ asarg = expr_parse_end;
+ continue;
+
+ case '&': /* SWP offset 0 to (1<<7)-4. */
+ my_getExpression (imm_expr, asarg);
+ check_absolute_expr (ip, imm_expr, FALSE);
+ if ((unsigned long)imm_expr->X_add_number >= (1 << 7)
+ || ((unsigned long)imm_expr->X_add_number & 0x3) != 0)
+ as_bad(_("Improper SWP offset amount (%lu)"),
+ (unsigned long)imm_expr->X_add_number);
+ INSERT_OPERAND(MIPS_SWP_OFFSET9, *ip,
+ (imm_expr->X_add_number >> 2));
+ INSERT_OPERAND(MIPS_SWP_OFFSET25, *ip,
+ (imm_expr->X_add_number >> 5));
+ imm_expr->X_op = O_absent;
+ asarg = expr_parse_end;
+ continue;
+
+ default:
+ goto unknown_riscv_ip_operand;
+ }
+ break;
+
default:
goto unknown_riscv_ip_operand;
}
@@ -4219,12 +4322,12 @@ riscv_ip_hardcode (char *str,
switch (imm_expr->X_op)
{
case O_constant:
- values[num++] = (insn_t) imm_expr->X_add_number;
+ values[num++] = imm_expr->X_add_number;
break;
case O_big:
/* Extract lower 32-bits of a big number.
Assume that generic_bignum_to_int32 work on such number. */
- values[num++] = (insn_t) generic_bignum_to_int32 ();
+ values[num++] = generic_bignum_to_int32 ();
break;
default:
/* The first value isn't constant, so it should be
@@ -4513,7 +4616,7 @@ bool riscv_parse_name (const char *name, struct expressionS *ep,
gas_assert (mode == expr_normal);
regno = reg_lookup_internal (name, RCLASS_GPR);
- if (regno == (unsigned int)-1)
+ if (regno == -1u)
return false;
if (symbol_find (name) != NULL)
@@ -4747,7 +4850,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
bfd_vma delta = target - md_pcrel_from (fixP);
bfd_putl32 (bfd_getl32 (buf) | ENCODE_JTYPE_IMM (delta), buf);
if (!riscv_opts.relax && S_IS_LOCAL (fixP->fx_addsy))
- fixP->fx_done = 1;
+ {
+ if (!VALID_JTYPE_IMM (delta))
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("invalid J-type offset (%+lld)"),
+ (long long) delta);
+ fixP->fx_done = 1;
+ }
}
break;
@@ -4759,7 +4868,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
bfd_vma delta = target - md_pcrel_from (fixP);
bfd_putl32 (bfd_getl32 (buf) | ENCODE_BTYPE_IMM (delta), buf);
if (!riscv_opts.relax && S_IS_LOCAL (fixP->fx_addsy))
- fixP->fx_done = 1;
+ {
+ if (!VALID_BTYPE_IMM (delta))
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("invalid B-type offset (%+lld)"),
+ (long long) delta);
+ fixP->fx_done = 1;
+ }
}
break;
@@ -4771,7 +4886,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
bfd_vma delta = target - md_pcrel_from (fixP);
bfd_putl16 (bfd_getl16 (buf) | ENCODE_CBTYPE_IMM (delta), buf);
if (!riscv_opts.relax && S_IS_LOCAL (fixP->fx_addsy))
- fixP->fx_done = 1;
+ {
+ if (!VALID_CBTYPE_IMM (delta))
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("invalid CB-type offset (%+lld)"),
+ (long long) delta);
+ fixP->fx_done = 1;
+ }
}
break;
@@ -4783,7 +4904,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
bfd_vma delta = target - md_pcrel_from (fixP);
bfd_putl16 (bfd_getl16 (buf) | ENCODE_CJTYPE_IMM (delta), buf);
if (!riscv_opts.relax && S_IS_LOCAL (fixP->fx_addsy))
- fixP->fx_done = 1;
+ {
+ if (!VALID_CJTYPE_IMM (delta))
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("invalid CJ-type offset (%+lld)"),
+ (long long) delta);
+ fixP->fx_done = 1;
+ }
}
break;
@@ -4808,7 +4935,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
/* Record PCREL_HI20. */
if (!riscv_record_pcrel_fixup (riscv_pcrel_hi_fixup_hash,
- (const asection *) seg,
+ seg,
md_pcrel_from (fixP),
fixP->fx_addsy,
target))
@@ -4818,7 +4945,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
| ENCODE_UTYPE_IMM (RISCV_CONST_HIGH_PART (value)),
buf);
if (!riscv_opts.relax)
- fixP->fx_done = 1;
+ {
+ if (xlen > 32
+ && !VALID_UTYPE_IMM (RISCV_CONST_HIGH_PART (value)))
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("invalid pcrel_hi offset (%+lld)"),
+ (long long) value);
+ fixP->fx_done = 1;
+ }
}
relaxable = true;
break;
@@ -4830,8 +4964,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
and set fx_done for -mno-relax. */
{
bfd_vma location_pcrel_hi = S_GET_VALUE (fixP->fx_addsy) + *valP;
- riscv_pcrel_hi_fixup search =
- {(const asection *) seg, location_pcrel_hi, 0, 0};
+ riscv_pcrel_hi_fixup search = {seg, location_pcrel_hi, 0, 0};
riscv_pcrel_hi_fixup *entry = htab_find (riscv_pcrel_hi_fixup_hash,
&search);
if (entry && entry->symbol
@@ -4844,7 +4977,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
bfd_putl32 (bfd_getl32 (buf) | ENCODE_STYPE_IMM (value), buf);
else
bfd_putl32 (bfd_getl32 (buf) | ENCODE_ITYPE_IMM (value), buf);
- /* Relaxations should never be enabled by `.option relax'. */
+ /* Relaxations should never be enabled by `.option relax'.
+ The offset is checked by corresponding %pcrel_hi entry. */
if (!riscv_opts.relax)
fixP->fx_done = 1;
}
@@ -4939,7 +5073,7 @@ s_riscv_option (int x ATTRIBUTE_UNUSED)
}
else if (strcmp (name, "norvc") == 0)
{
- riscv_update_subset (&riscv_rps_as, "-c");
+ riscv_update_subset_norvc (&riscv_rps_as);
riscv_arch_str (xlen, riscv_rps_as.subset_list, true/* update */);
riscv_set_rvc (false);
}
@@ -4977,6 +5111,7 @@ s_riscv_option (int x ATTRIBUTE_UNUSED)
s->next = riscv_opts_stack;
s->options = riscv_opts;
s->subset_list = riscv_rps_as.subset_list;
+ s->xlen = xlen;
riscv_opts_stack = s;
riscv_rps_as.subset_list = riscv_copy_subset_list (s->subset_list);
}
@@ -4993,6 +5128,7 @@ s_riscv_option (int x ATTRIBUTE_UNUSED)
riscv_opts_stack = s->next;
riscv_opts = s->options;
riscv_rps_as.subset_list = s->subset_list;
+ xlen = s->xlen;
riscv_release_subset_list (release_subsets);
free (s);
}
@@ -5367,7 +5503,7 @@ RISC-V options:\n\
-fno-pic don't generate position-independent code (default)\n\
-march=ISA set the RISC-V architecture\n\
-misa-spec=ISAspec set the RISC-V ISA spec (2.2, 20190608, 20191213)\n\
- -mpriv-spec=PRIVspec set the RISC-V privilege spec (1.10, 1.11, 1.12)\n\
+ -mpriv-spec=PRIVspec set the RISC-V privilege spec (1.10, 1.11, 1.12, 1.13)\n\
-mabi=ABI set the RISC-V ABI\n\
-mrelax enable relax (default)\n\
-mno-relax disable relax\n\
@@ -5616,7 +5752,7 @@ riscv_insert_uleb128_fixes (bfd *abfd ATTRIBUTE_UNUSED,
exp_dup->X_add_number = 0; /* Set addend of SUB_ULEB128 to zero. */
fix_new_exp (fragP, fragP->fr_fix, 0,
exp_dup, 0, BFD_RELOC_RISCV_SUB_ULEB128);
- free ((void *) exp_dup);
+ free (exp_dup);
}
}
@@ -5643,7 +5779,7 @@ riscv_md_end (void)
void
riscv_adjust_symtab (void)
{
- bfd_map_over_sections (stdoutput, riscv_check_mapping_symbols, (char *) 0);
+ bfd_map_over_sections (stdoutput, riscv_check_mapping_symbols, NULL);
elf_adjust_symtab ();
}
@@ -5752,35 +5888,6 @@ s_variant_cc (int ignored ATTRIBUTE_UNUSED)
elfsym->internal_elf_sym.st_other |= STO_RISCV_VARIANT_CC;
}
-/* Same as elf_copy_symbol_attributes, but without copying st_other.
- This is needed so RISC-V specific st_other values can be independently
- specified for an IFUNC resolver (that is called by the dynamic linker)
- and the symbol it resolves (aliased to the resolver). In particular,
- if a function symbol has special st_other value set via directives,
- then attaching an IFUNC resolver to that symbol should not override
- the st_other setting. Requiring the directive on the IFUNC resolver
- symbol would be unexpected and problematic in C code, where the two
- symbols appear as two independent function declarations. */
-
-void
-riscv_elf_copy_symbol_attributes (symbolS *dest, symbolS *src)
-{
- struct elf_obj_sy *srcelf = symbol_get_obj (src);
- struct elf_obj_sy *destelf = symbol_get_obj (dest);
- /* If size is unset, copy size from src. Because we don't track whether
- .size has been used, we can't differentiate .size dest, 0 from the case
- where dest's size is unset. */
- if (!destelf->size && S_GET_SIZE (dest) == 0)
- {
- if (srcelf->size)
- {
- destelf->size = XNEW (expressionS);
- *destelf->size = *srcelf->size;
- }
- S_SET_SIZE (dest, S_GET_SIZE (src));
- }
-}
-
/* RISC-V pseudo-ops table. */
static const pseudo_typeS riscv_pseudo_table[] =
{
diff --git a/gas/config/tc-riscv.h b/gas/config/tc-riscv.h
index e2e8e7a..853f349 100644
--- a/gas/config/tc-riscv.h
+++ b/gas/config/tc-riscv.h
@@ -64,7 +64,7 @@ extern bool riscv_frag_align_code (int);
extern void riscv_handle_align (fragS *);
#define HANDLE_ALIGN(s, f) riscv_handle_align (f)
-#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 4)
/* The ISA of the target may change based on command-line arguments. */
#define TARGET_FORMAT riscv_target_format ()
@@ -175,8 +175,16 @@ extern void riscv_init_frag (struct frag *, int);
#define obj_adjust_symtab() riscv_adjust_symtab ()
extern void riscv_adjust_symtab (void);
-void riscv_elf_copy_symbol_attributes (symbolS *, symbolS *);
+/* Don't copy st_other.
+ This is needed so RISC-V specific st_other values can be independently
+ specified for an IFUNC resolver (that is called by the dynamic linker)
+ and the symbol it resolves (aliased to the resolver). In particular,
+ if a function symbol has special st_other value set via directives,
+ then attaching an IFUNC resolver to that symbol should not override
+ the st_other setting. Requiring the directive on the IFUNC resolver
+ symbol would be unexpected and problematic in C code, where the two
+ symbols appear as two independent function declarations. */
#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST, SRC) \
- riscv_elf_copy_symbol_attributes (DEST, SRC)
+ elf_copy_symbol_size (DEST, SRC)
#endif /* TC_RISCV */
diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c
index 6d24bc3..36ccacd 100644
--- a/gas/config/tc-rl78.c
+++ b/gas/config/tc-rl78.c
@@ -705,7 +705,7 @@ rl78_cons_fix_new (fragS * frag,
type = BFD_RELOC_RL78_DIFF;
}
- fixP = fix_new_exp (frag, where, (int) size, exp, 0, type);
+ fixP = fix_new_exp (frag, where, size, exp, 0, type);
switch (exp->X_md)
{
/* These are intended to have values larger than the container,
@@ -1420,7 +1420,7 @@ md_apply_fix (struct fix * f ATTRIBUTE_UNUSED,
return;
op = f->fx_frag->fr_literal + f->fx_where;
- val = (unsigned long) * t;
+ val = *t;
if (f->fx_addsy == NULL)
f->fx_done = 1;
@@ -1508,5 +1508,5 @@ valueT
md_section_align (segT segment, valueT size)
{
int align = bfd_section_alignment (segment);
- return ((size + (1 << align) - 1) & -(1 << align));
+ return (size + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
diff --git a/gas/config/tc-rl78.h b/gas/config/tc-rl78.h
index 4a51325..09d9987 100644
--- a/gas/config/tc-rl78.h
+++ b/gas/config/tc-rl78.h
@@ -75,7 +75,7 @@ extern void rl78_cons_fix_new (fragS *, int, int, expressionS *);
#define RELOC_EXPANSION_POSSIBLE 1
#define MAX_RELOC_EXPANSION 8
-#define MAX_MEM_FOR_RS_ALIGN_CODE 8
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) 8
#define HANDLE_ALIGN(SEC, FRAG) rl78_handle_align (FRAG)
extern void rl78_handle_align (fragS *);
diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index bd45c53..8685df1 100644
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -2252,13 +2252,13 @@ rx_cons_fix_new (fragS * frag,
type = BFD_RELOC_RX_DIFF;
}
- fix_new_exp (frag, where, (int) size, exp, 0, type);
+ fix_new_exp (frag, where, size, exp, 0, type);
}
void
-md_apply_fix (struct fix * f ATTRIBUTE_UNUSED,
- valueT * t ATTRIBUTE_UNUSED,
- segT s ATTRIBUTE_UNUSED)
+md_apply_fix (struct fix *f,
+ valueT *t,
+ segT s ATTRIBUTE_UNUSED)
{
/* Instruction bytes are always little endian. */
char * op;
@@ -2274,7 +2274,7 @@ md_apply_fix (struct fix * f ATTRIBUTE_UNUSED,
#define OP4(x) op[target_big_endian ? 3-x : x]
op = f->fx_frag->fr_literal + f->fx_where;
- val = (unsigned long) * t;
+ val = *t;
/* Opcode words are always the same endian. Data words are either
big or little endian. */
diff --git a/gas/config/tc-rx.h b/gas/config/tc-rx.h
index 3c4524f..29c4382 100644
--- a/gas/config/tc-rx.h
+++ b/gas/config/tc-rx.h
@@ -96,7 +96,7 @@ extern void rx_cons_fix_new (fragS *, int, int, expressionS *,
goto around; \
}
-#define MAX_MEM_FOR_RS_ALIGN_CODE 8
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) 8
#define HANDLE_ALIGN(SEC, FRAG) rx_handle_align (FRAG)
extern void rx_handle_align (fragS *);
diff --git a/gas/config/tc-s12z.c b/gas/config/tc-s12z.c
index 9c8fcfe..5110470 100644
--- a/gas/config/tc-s12z.c
+++ b/gas/config/tc-s12z.c
@@ -186,7 +186,7 @@ valueT
md_section_align (asection *seg, valueT addr)
{
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
void
@@ -579,9 +579,7 @@ lex_opr (uint8_t *buffer, int *n_bytes, expressionS *exp,
}
else if (lex_reg_name (REG_BIT_Dn, &reg2))
{
- if (c >= -1 * (long) (0x1u << 17)
- &&
- c < (long) (0x1u << 17) - 1)
+ if (c >= -1 * (1L << 17) && c < (1L << 17) - 1)
{
*n_bytes = 3;
*xb = 0x80;
@@ -3891,7 +3889,7 @@ tc_gen_reloc (asection *section, fixS *fixp)
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("Relocation %d is not supported by object file format."),
@@ -3930,11 +3928,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
{
long value = *valP;
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
/* We don't actually support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
/*
@@ -3946,23 +3944,23 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
switch (fixP->fx_r_type)
{
case BFD_RELOC_8:
- ((bfd_byte *) where)[0] = (bfd_byte) value;
+ where[0] = value;
break;
case BFD_RELOC_16:
- bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb16 (value, where);
break;
case BFD_RELOC_24:
- bfd_putb24 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb24 (value, where);
break;
case BFD_RELOC_S12Z_OPR:
{
switch (fixP->fx_size)
{
case 3:
- bfd_putb24 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb24 (value, where);
break;
case 2:
- bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb16 (value, where);
break;
default:
abort ();
@@ -3970,14 +3968,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
}
break;
case BFD_RELOC_32:
- bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb32 (value, where);
break;
case BFD_RELOC_16_PCREL:
if (value < -0x4000 || value > 0x3FFF)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value out of 16-bit range."));
- bfd_putb16 ((bfd_vma) value | 0x8000, (unsigned char *) where);
+ bfd_putb16 (value | 0x8000, where);
break;
default:
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index a0cfeea..b073d8e 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -24,6 +24,8 @@
#include "subsegs.h"
#include "dwarf2dbg.h"
#include "dw2gencfi.h"
+#include "sframe.h"
+#include "gen-sframe.h"
#include "opcode/s390.h"
#include "elf/s390.h"
@@ -97,6 +99,17 @@ const char FLT_CHARS[] = "dD";
/* The dwarf2 data alignment, adjusted for 32 or 64 bit. */
int s390_cie_data_alignment;
+/* Register numbers used for SFrame stack trace info. */
+
+/* Designated stack pointer DWARF register number according to s390x ELF ABI. */
+const unsigned int s390_sframe_cfa_sp_reg = 15;
+
+/* Preferred frame pointer DWARF register number according to s390x ELF ABI. */
+const unsigned int s390_sframe_cfa_fp_reg = 11;
+
+/* Designated return address DWARF register number according to s390x ELF ABI. */
+const unsigned int s390_sframe_cfa_ra_reg = DWARF2_DEFAULT_RETURN_COLUMN;
+
/* The target specific pseudo-ops which we support. */
/* Define the prototypes for the pseudo-ops */
@@ -343,7 +356,7 @@ s390_parse_cpu (const char *arg,
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX },
{ STRING_COMMA_LEN ("z16"), STRING_COMMA_LEN ("arch14"),
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX },
- { STRING_COMMA_LEN (""), STRING_COMMA_LEN ("arch15"),
+ { STRING_COMMA_LEN ("z17"), STRING_COMMA_LEN ("arch15"),
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX }
};
static struct
@@ -727,9 +740,9 @@ s390_insert_operand (unsigned char *insn,
{
if (operand->flags & S390_OPERAND_PCREL)
{
- val = (offsetT) ((addressT) val << 1);
- min = (offsetT) ((addressT) min << 1);
- max = (offsetT) ((addressT) max << 1);
+ val = (addressT) val << 1;
+ min = (addressT) min << 1;
+ max = (addressT) max << 1;
}
s390_bad_operand_out_of_range (operand_number, val, min, max,
@@ -738,7 +751,7 @@ s390_insert_operand (unsigned char *insn,
return;
}
/* val is ok, now restrict it to operand->bits bits. */
- uval = (addressT) val & ((((addressT) 1 << (operand->bits-1)) << 1) - 1);
+ uval = val & ((((addressT) 1 << (operand->bits-1)) << 1) - 1);
/* val is restrict, now check for special case. */
if (operand->bits == 20 && operand->shift == 20)
uval = (uval >> 12) | ((uval & 0xfff) << 8);
@@ -748,8 +761,8 @@ s390_insert_operand (unsigned char *insn,
addressT min, max;
max = (((addressT) 1 << (operand->bits - 1)) << 1) - 1;
- min = (offsetT) 0;
- uval = (addressT) val;
+ min = 0;
+ uval = val;
/* Vector register operands have an additional bit in the RXB
field. */
@@ -1316,7 +1329,7 @@ s390_elf_cons (int nbytes /* 1=.byte, 2=.word, 4=.long */)
as_bad (_("relocation not applicable"));
}
else
- emit_expr (&exp, (unsigned int) nbytes);
+ emit_expr (&exp, nbytes);
}
while (*input_line_pointer++ == ',');
@@ -1906,8 +1919,7 @@ md_gather_operands (char *str,
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, 4,
&fixups[i].exp,
(operand->flags & S390_OPERAND_PCREL) != 0,
- ((bfd_reloc_code_real_type)
- (fixups[i].opindex + (int) BFD_RELOC_UNUSED)));
+ fixups[i].opindex + BFD_RELOC_UNUSED);
/* s390_insert_operand () does the range checking. */
if (operand->flags & S390_OPERAND_PCREL)
fixP->fx_no_overflow = 1;
@@ -1931,8 +1943,8 @@ md_assemble (char *str)
*s++ = '\0';
/* Look up the opcode in the hash table. */
- opcode = (struct s390_opcode *) str_hash_find (s390_opcode_hash, str);
- if (opcode == (const struct s390_opcode *) NULL)
+ opcode = str_hash_find (s390_opcode_hash, str);
+ if (opcode == NULL)
{
as_bad (_("Unrecognized opcode: `%s'"), str);
return;
@@ -1988,9 +2000,8 @@ s390_insn (int ignore ATTRIBUTE_UNUSED)
*s++ = '\0';
/* Look up the opcode in the hash table. */
- opformat = (struct s390_opcode *)
- str_hash_find (s390_opformat_hash, input_line_pointer);
- if (opformat == (const struct s390_opcode *) NULL)
+ opformat = str_hash_find (s390_opformat_hash, input_line_pointer);
+ if (opformat == NULL)
{
as_bad (_("Unrecognized opcode format: `%s'"), input_line_pointer);
return;
@@ -2085,7 +2096,7 @@ s390_literals (int ignore ATTRIBUTE_UNUSED)
/* Emit symbol for start of literal pool. */
S_SET_SEGMENT (lp_sym, now_seg);
- S_SET_VALUE (lp_sym, (valueT) frag_now_fix ());
+ S_SET_VALUE (lp_sym, frag_now_fix ());
symbol_set_frag (lp_sym, frag_now);
while (lpe_list)
@@ -2093,7 +2104,7 @@ s390_literals (int ignore ATTRIBUTE_UNUSED)
lpe = lpe_list;
lpe_list = lpe_list->next;
S_SET_SEGMENT (lpe->sym, now_seg);
- S_SET_VALUE (lpe->sym, (valueT) frag_now_fix ());
+ S_SET_VALUE (lpe->sym, frag_now_fix ());
symbol_set_frag (lpe->sym, frag_now);
/* Emit literal pool entry. */
@@ -2491,19 +2502,19 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
else
fixP->fx_done = 1;
- if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
{
const struct s390_operand *operand;
int opindex;
- opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+ opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
operand = &s390_operands[opindex];
if (fixP->fx_done)
{
/* Insert the fully resolved operand value. */
s390_insert_operand ((unsigned char *) where, operand,
- (offsetT) value, fixP->fx_file, fixP->fx_line, 0);
+ value, fixP->fx_file, fixP->fx_line, 0);
return;
}
@@ -2632,9 +2643,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
if (fixP->fx_pcrel)
value >>= 1;
- mop = bfd_getb16 ((unsigned char *) where);
- mop |= (unsigned short) (value & 0xfff);
- bfd_putb16 ((bfd_vma) mop, (unsigned char *) where);
+ mop = bfd_getb16 (where);
+ mop |= value & 0xfff;
+ bfd_putb16 (mop, where);
}
break;
@@ -2644,10 +2655,10 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
if (fixP->fx_done)
{
unsigned int mop;
- mop = bfd_getb32 ((unsigned char *) where);
- mop |= (unsigned int) ((value & 0xfff) << 8 |
- (value & 0xff000) >> 12);
- bfd_putb32 ((bfd_vma) mop, (unsigned char *) where);
+ mop = bfd_getb32 (where);
+ mop |= ((value & 0xfff) << 8
+ | (value & 0xff000) >> 12);
+ bfd_putb32 (mop, where);
}
break;
@@ -2687,9 +2698,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
unsigned int mop;
value >>= 1;
- mop = bfd_getb32 ((unsigned char *) where - 1);
- mop |= (unsigned int) (value & 0xffffff);
- bfd_putb32 ((bfd_vma) mop, (unsigned char *) where - 1);
+ mop = bfd_getb32 (where - 1);
+ mop |= value & 0xffffff;
+ bfd_putb32 (mop, where - 1);
}
break;
@@ -2867,6 +2878,48 @@ tc_s390_regname_to_dw2regnum (char *regname)
return regnum;
}
+/* Whether SFrame stack trace info is supported. */
+
+bool
+s390_support_sframe_p (void)
+{
+ /* At this time, SFrame is supported for s390x (64-bit) only. */
+ return (s390_arch_size == 64);
+}
+
+/* Specify if RA tracking is needed. */
+
+bool
+s390_sframe_ra_tracking_p (void)
+{
+ return true;
+}
+
+/* Specify the fixed offset to recover RA from CFA.
+ (useful only when RA tracking is not needed). */
+
+offsetT
+s390_sframe_cfa_ra_offset (void)
+{
+ return (offsetT) SFRAME_CFA_FIXED_RA_INVALID;
+}
+
+/* Get the abi/arch identifier for SFrame. */
+
+unsigned char
+s390_sframe_get_abi_arch (void)
+{
+ unsigned char sframe_abi_arch = 0;
+
+ if (s390_support_sframe_p ())
+ {
+ gas_assert (target_big_endian);
+ sframe_abi_arch = SFRAME_ABI_S390X_ENDIAN_BIG;
+ }
+
+ return sframe_abi_arch;
+}
+
void
s390_elf_final_processing (void)
{
diff --git a/gas/config/tc-s390.h b/gas/config/tc-s390.h
index 9206c02..0c62125 100644
--- a/gas/config/tc-s390.h
+++ b/gas/config/tc-s390.h
@@ -19,6 +19,7 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#ifndef TC_S390
#define TC_S390
struct fix;
@@ -98,3 +99,36 @@ extern int s390_cie_data_alignment;
extern void s390_elf_final_processing (void);
#define elf_tc_final_processing s390_elf_final_processing
+
+/* SFrame. */
+
+/* Whether SFrame stack trace info is supported. */
+extern bool s390_support_sframe_p (void);
+#define support_sframe_p s390_support_sframe_p
+
+/* The stack pointer DWARF register number for SFrame CFA tracking. */
+extern const unsigned int s390_sframe_cfa_sp_reg;
+#define SFRAME_CFA_SP_REG s390_sframe_cfa_sp_reg
+
+/* The frame pointer DWARF register number for SFrame CFA and FP tracking. */
+extern const unsigned int s390_sframe_cfa_fp_reg;
+#define SFRAME_CFA_FP_REG s390_sframe_cfa_fp_reg
+
+/* The return address DWARF register number for SFrame RA tracking. */
+extern const unsigned int s390_sframe_cfa_ra_reg;
+#define SFRAME_CFA_RA_REG s390_sframe_cfa_ra_reg
+
+/* Whether SFrame return address tracking is needed. */
+extern bool s390_sframe_ra_tracking_p (void);
+#define sframe_ra_tracking_p s390_sframe_ra_tracking_p
+
+/* The fixed offset from CFA for SFrame to recover the return address.
+ (useful only when SFrame RA tracking is not needed). */
+extern offsetT s390_sframe_cfa_ra_offset (void);
+#define sframe_cfa_ra_offset s390_sframe_cfa_ra_offset
+
+/* The abi/arch identifier for SFrame. */
+unsigned char s390_sframe_get_abi_arch (void);
+#define sframe_get_abi_arch s390_sframe_get_abi_arch
+
+#endif /* TC_S390 */
diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c
index ab49875..f3f1b2a 100644
--- a/gas/config/tc-score.c
+++ b/gas/config/tc-score.c
@@ -244,7 +244,7 @@ const size_t md_longopts_size = sizeof (md_longopts);
#define s3_GP 28
#define s3_PIC_CALL_REG 29
#define s3_MAX_LITERAL_POOL_SIZE 1024
-#define s3_FAIL 0x80000000
+#define s3_FAIL -2147483648
#define s3_SUCCESS 0
#define s3_INSN48_SIZE 6
#define s3_INSN_SIZE 4
@@ -1013,7 +1013,7 @@ s3_end_of_line (char *str)
s3_skip_whitespace (str);
if (*str != '\0')
{
- retval = (int) s3_FAIL;
+ retval = s3_FAIL;
if (!s3_inst.error)
s3_inst.error = s3_BAD_GARBAGE;
@@ -1032,7 +1032,7 @@ s3_score_reg_parse (char **ccp, htab_t htab)
p = start;
if (!ISALPHA (*p) || !is_name_beginner (*p))
- return (int) s3_FAIL;
+ return s3_FAIL;
c = *p++;
@@ -1040,7 +1040,7 @@ s3_score_reg_parse (char **ccp, htab_t htab)
c = *p++;
*--p = 0;
- reg = (struct s3_reg_entry *) str_hash_find (htab, start);
+ reg = str_hash_find (htab, start);
*p = c;
if (reg)
@@ -1048,7 +1048,7 @@ s3_score_reg_parse (char **ccp, htab_t htab)
*ccp = p;
return reg->number;
}
- return (int) s3_FAIL;
+ return s3_FAIL;
}
/* If shift <= 0, only return reg. */
@@ -1057,10 +1057,10 @@ static int
s3_reg_required_here (char **str, int shift, enum s3_score_reg_type reg_type)
{
static char buff[s3_MAX_LITERAL_POOL_SIZE];
- int reg = (int) s3_FAIL;
+ int reg = s3_FAIL;
char *start = *str;
- if ((reg = s3_score_reg_parse (str, s3_all_reg_maps[reg_type].htab)) != (int) s3_FAIL)
+ if ((reg = s3_score_reg_parse (str, s3_all_reg_maps[reg_type].htab)) != s3_FAIL)
{
if (reg_type == s3_REG_TYPE_SCORE)
{
@@ -1105,18 +1105,18 @@ s3_skip_past_comma (char **str)
if (c == ',' && comma++)
{
s3_inst.error = s3_BAD_SKIP_COMMA;
- return (int) s3_FAIL;
+ return s3_FAIL;
}
}
if ((c == '\0') || (comma == 0))
{
s3_inst.error = s3_BAD_SKIP_COMMA;
- return (int) s3_FAIL;
+ return s3_FAIL;
}
*str = p;
- return comma ? s3_SUCCESS : (int) s3_FAIL;
+ return comma ? s3_SUCCESS : s3_FAIL;
}
static void
@@ -1125,12 +1125,12 @@ s3_do_rdrsrs (char *str)
int reg;
s3_skip_whitespace (str);
- if ((reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if ((reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -1192,7 +1192,7 @@ s3_my_get_expression (expressionS * ep, char **str)
*str = input_line_pointer;
input_line_pointer = save_in;
s3_inst.error = _("illegal expression");
- return (int) s3_FAIL;
+ return s3_FAIL;
}
/* Get rid of any bignums now, so that we don't generate an error for which
we can't establish a line number later on. Big numbers are never valid
@@ -1205,7 +1205,7 @@ s3_my_get_expression (expressionS * ep, char **str)
s3_inst.error = _("invalid constant");
*str = input_line_pointer;
input_line_pointer = save_in;
- return (int) s3_FAIL;
+ return s3_FAIL;
}
if ((ep->X_add_symbol != NULL)
@@ -1224,7 +1224,7 @@ s3_my_get_expression (expressionS * ep, char **str)
s3_inst.error = s3_BAD_ARGS;
*str = input_line_pointer;
input_line_pointer = save_in;
- return (int) s3_FAIL;
+ return s3_FAIL;
}
*str = input_line_pointer;
@@ -1263,14 +1263,14 @@ s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
{
if (!(val >= -0x2000 && val <= 0x3fff))
{
- return (int) s3_FAIL;
+ return s3_FAIL;
}
}
else
{
if (!(val >= -8192 && val <= 8191))
{
- return (int) s3_FAIL;
+ return s3_FAIL;
}
}
@@ -1282,14 +1282,14 @@ s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
{
if (!(val >= -0x7fff && val <= 0xffff && val != 0x8000))
{
- return (int) s3_FAIL;
+ return s3_FAIL;
}
}
else
{
if (!(val >= -32767 && val <= 32768))
{
- return (int) s3_FAIL;
+ return s3_FAIL;
}
}
@@ -1304,7 +1304,7 @@ s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
val = 0;
return val;
}
- return (int) s3_FAIL;
+ return s3_FAIL;
case _IMM32:
if (val >= 0 && val <= 0xffffffff)
@@ -1313,7 +1313,7 @@ s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
}
else
{
- return (int) s3_FAIL;
+ return s3_FAIL;
}
default:
@@ -1327,7 +1327,7 @@ s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
break;
}
- return (int) s3_FAIL;
+ return s3_FAIL;
}
static int
@@ -1358,18 +1358,18 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type)
if (*dataptr == '|') /* process PCE */
{
- if (s3_my_get_expression (&s3_inst.reloc.exp, &pp) == (int) s3_FAIL)
- return (int) s3_FAIL;
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &pp) == s3_FAIL)
+ return s3_FAIL;
s3_end_of_line (pp);
if (s3_inst.error != 0)
- return (int) s3_FAIL; /* to ouptut_inst to printf out the error */
+ return s3_FAIL; /* to ouptut_inst to printf out the error */
*str = dataptr;
}
else /* process 16 bit */
{
- if (s3_my_get_expression (&s3_inst.reloc.exp, str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, str) == s3_FAIL)
{
- return (int) s3_FAIL;
+ return s3_FAIL;
}
dataptr = (char *)data_exp;
@@ -1424,7 +1424,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type)
|| ((*dataptr == '-') && (*(dataptr + 1) != '0'))))
{
s3_inst.error = s3_BAD_ARGS;
- return (int) s3_FAIL;
+ return s3_FAIL;
}
}
@@ -1444,7 +1444,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type)
|| (data_type == _IMM4)))
{
s3_inst.error = s3_BAD_ARGS;
- return (int) s3_FAIL;
+ return s3_FAIL;
}
if (s3_inst.reloc.exp.X_add_symbol)
@@ -1452,7 +1452,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type)
switch (data_type)
{
case _SIMM16_LA:
- return (int) s3_FAIL;
+ return s3_FAIL;
case _VALUE_HI16:
s3_inst.reloc.type = BFD_RELOC_HI16_S;
s3_inst.reloc.pc_rel = 0;
@@ -1487,7 +1487,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type)
if (data_type == _SIMM16_LA && s3_inst.reloc.exp.X_unsigned == 1)
{
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _SIMM16_LA_POS, hex_p);
- if (value == (int) s3_FAIL) /* for advance to check if this is ldis */
+ if (value == s3_FAIL) /* for advance to check if this is ldis */
if ((s3_inst.reloc.exp.X_add_number & 0xffff) == 0)
{
s3_inst.instruction |= 0x8000000;
@@ -1500,14 +1500,14 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type)
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, hex_p);
}
- if (value == (int) s3_FAIL)
+ if (value == s3_FAIL)
{
if (data_type == _IMM32)
{
sprintf (s3_err_msg,
_("invalid constant: %d bit expression not in range %u..%u"),
s3_score_df_range[data_type].bits,
- 0, (unsigned)0xffffffff);
+ 0, 0xffffffff);
}
else if (data_type == _IMM5_MULTI_LOAD)
{
@@ -1531,7 +1531,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type)
}
s3_inst.error = s3_err_msg;
- return (int) s3_FAIL;
+ return s3_FAIL;
}
if (((s3_score_df_range[data_type].range[0] != 0) || (data_type == _IMM5_RANGE_8_31))
@@ -1551,7 +1551,7 @@ s3_data_op2 (char **str, int shift, enum score_data_type data_type)
&& (((s3_inst.instruction >> 20) & 0x1F) != 0x10))
{
s3_inst.error = _("invalid constant: bit expression not defined");
- return (int) s3_FAIL;
+ return s3_FAIL;
}
}
@@ -1564,10 +1564,10 @@ s3_do_rdsi16 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 1, _SIMM16) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 1, _SIMM16) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
/* ldi.->ldiu! only for imm5 */
@@ -1632,10 +1632,10 @@ s3_do_ldis (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 1, _IMM16) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 1, _IMM16) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
}
@@ -1645,9 +1645,9 @@ s3_do_sub_rdsi16 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_data_op2 (&str, 1, _SIMM16_NEG) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_data_op2 (&str, 1, _SIMM16_NEG) != s3_FAIL)
s3_end_of_line (str);
}
@@ -1657,9 +1657,9 @@ s3_do_sub_rdi16 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_data_op2 (&str, 1, _IMM16_NEG) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_data_op2 (&str, 1, _IMM16_NEG) != s3_FAIL)
s3_end_of_line (str);
}
@@ -1669,10 +1669,10 @@ s3_do_rdrssi14 (char *str) /* -(2^13)~((2^13)-1) */
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL)
s3_data_op2 (&str, 1, _SIMM14);
}
@@ -1682,11 +1682,11 @@ s3_do_sub_rdrssi14 (char *str) /* -(2^13)~((2^13)-1) */
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_data_op2 (&str, 1, _SIMM14_NEG) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_data_op2 (&str, 1, _SIMM14_NEG) != s3_FAIL)
s3_end_of_line (str);
}
@@ -1697,12 +1697,12 @@ s3_do_rdrsi5 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 10, _IMM5) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
if ((((s3_inst.instruction >> 20) & 0x1f) == ((s3_inst.instruction >> 15) & 0x1f))
@@ -1722,11 +1722,11 @@ s3_do_rdrsi14 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_data_op2 (&str, 1, _IMM14) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_data_op2 (&str, 1, _IMM14) != s3_FAIL)
s3_end_of_line (str);
}
@@ -1736,10 +1736,10 @@ s3_do_xrsi5 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 10, _IMM5) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 15) & 0x10) == 0))
@@ -1757,10 +1757,10 @@ s3_do_rdi16 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 1, _IMM16) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 1, _IMM16) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
/* ldis */
@@ -1806,8 +1806,8 @@ s3_do_macro_rdi32hi (char *str)
s3_skip_whitespace (str);
/* Do not handle s3_end_of_line(). */
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL)
s3_data_op2 (&str, 1, _VALUE_HI16);
}
@@ -1817,8 +1817,8 @@ s3_do_macro_rdi32lo (char *str)
s3_skip_whitespace (str);
/* Do not handle s3_end_of_line(). */
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL)
s3_data_op2 (&str, 1, _VALUE_LO16);
}
@@ -1828,9 +1828,9 @@ s3_do_rdi16_pic (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_data_op2 (&str, 1, _IMM16_pic) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_data_op2 (&str, 1, _IMM16_pic) != s3_FAIL)
s3_end_of_line (str);
}
@@ -1840,9 +1840,9 @@ s3_do_addi_s_pic (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_data_op2 (&str, 1, _SIMM16_pic) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_data_op2 (&str, 1, _SIMM16_pic) != s3_FAIL)
s3_end_of_line (str);
}
@@ -1852,9 +1852,9 @@ s3_do_addi_u_pic (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_data_op2 (&str, 1, _IMM16_LO16_pic) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_data_op2 (&str, 1, _IMM16_LO16_pic) != s3_FAIL)
s3_end_of_line (str);
}
@@ -1864,7 +1864,7 @@ s3_do_rd (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL)
s3_end_of_line (str);
}
@@ -1874,8 +1874,8 @@ s3_do_rs (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
if ((s3_inst.relax_inst != 0x8000) )
@@ -1892,7 +1892,7 @@ s3_do_i15 (char *str)
{
s3_skip_whitespace (str);
- if (s3_data_op2 (&str, 10, _IMM15) != (int) s3_FAIL)
+ if (s3_data_op2 (&str, 10, _IMM15) != s3_FAIL)
s3_end_of_line (str);
}
@@ -1901,7 +1901,7 @@ s3_do_xi5x (char *str)
{
s3_skip_whitespace (str);
- if (s3_data_op2 (&str, 15, _IMM5) == (int) s3_FAIL || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_data_op2 (&str, 15, _IMM5) == s3_FAIL || s3_end_of_line (str) == s3_FAIL)
return;
if (s3_inst.relax_inst != 0x8000)
@@ -1916,10 +1916,10 @@ s3_do_rdrs (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
if (s3_inst.relax_inst != 0x8000)
@@ -1949,9 +1949,9 @@ s3_do_rdcrs (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) != s3_FAIL)
s3_end_of_line (str);
}
@@ -1964,15 +1964,15 @@ s3_do_rdsrs (char *str)
/* mfsr */
if ((s3_inst.instruction & 0xff) == 0x50)
{
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL
- && s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_SR) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL
+ && s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_SR) != s3_FAIL)
s3_end_of_line (str);
}
else
{
- if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL
- && s3_skip_past_comma (&str) != (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != s3_FAIL
+ && s3_skip_past_comma (&str) != s3_FAIL)
s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_SR);
}
}
@@ -1983,10 +1983,10 @@ s3_do_rdxrs (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 10) & 0x10) == 0)
@@ -2005,10 +2005,10 @@ s3_do_rsrs (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 20) & 0x1f) == 3) )
@@ -2028,23 +2028,23 @@ s3_do_ceinst (char *str)
strbak = str;
s3_skip_whitespace (str);
- if (s3_data_op2 (&str, 20, _IMM5) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 5, _IMM5) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_data_op2 (&str, 20, _IMM5) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 5, _IMM5) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 0, _IMM5) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
else
{
str = strbak;
- if (s3_data_op2 (&str, 0, _IMM25) == (int) s3_FAIL)
+ if (s3_data_op2 (&str, 0, _IMM25) == s3_FAIL)
return;
}
}
@@ -2056,7 +2056,7 @@ s3_reglow_required_here (char **str, int shift)
int reg;
char *start = *str;
- if ((reg = s3_score_reg_parse (str, s3_all_reg_maps[s3_REG_TYPE_SCORE].htab)) != (int) s3_FAIL)
+ if ((reg = s3_score_reg_parse (str, s3_all_reg_maps[s3_REG_TYPE_SCORE].htab)) != s3_FAIL)
{
if ((reg == 1) && (s3_nor1 == 1) && (s3_inst.bwarn == 0))
{
@@ -2076,7 +2076,7 @@ s3_reglow_required_here (char **str, int shift)
*str = start;
sprintf (buff, _("low register (r0-r15) expected, not '%.100s'"), start);
s3_inst.error = buff;
- return (int) s3_FAIL;
+ return s3_FAIL;
}
/* Handle add!/and!/or!/sub!. */
@@ -2085,10 +2085,10 @@ s3_do16_rdrs2 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reglow_required_here (&str, 4) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reglow_required_here (&str, 0) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reglow_required_here (&str, 4) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reglow_required_here (&str, 0) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -2100,8 +2100,8 @@ s3_do16_br (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -2115,8 +2115,8 @@ s3_do16_brr (char *str)
s3_skip_whitespace (str);
- if ((rd = s3_reg_required_here (&str, 0,s3_REG_TYPE_SCORE)) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if ((rd = s3_reg_required_here (&str, 0,s3_REG_TYPE_SCORE)) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -2127,8 +2127,8 @@ static void
s3_do_ltb (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL)
{
return;
}
@@ -2140,9 +2140,9 @@ s3_do_ltb (char *str)
return;
}
- if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL)
{
return;
}
@@ -2199,8 +2199,7 @@ s3_dependency_type_from_insn (char *insn_name)
const struct s3_insn_to_dependency *tmp;
strcpy (name, insn_name);
- tmp = (const struct s3_insn_to_dependency *)
- str_hash_find (s3_dependency_insn_hsh, name);
+ tmp = str_hash_find (s3_dependency_insn_hsh, name);
if (tmp)
return tmp->type;
@@ -2395,7 +2394,7 @@ s3_handle_dependency (struct s3_score_it *theinst)
static enum insn_class
s3_get_insn_class_from_type (enum score_insn_type type)
{
- enum insn_class retval = (int) s3_FAIL;
+ enum insn_class retval = s3_FAIL;
switch (type)
{
@@ -2659,8 +2658,7 @@ s3_parse_16_32_inst (char *insnstr, bool gen_frag_p)
c = *p;
*p = '\0';
- opcode = (const struct s3_asm_opcode *) str_hash_find (s3_score_ops_hsh,
- operator);
+ opcode = str_hash_find (s3_score_ops_hsh, operator);
*p = c;
memset (&s3_inst, '\0', sizeof (s3_inst));
@@ -2706,8 +2704,7 @@ s3_parse_48_inst (char *insnstr, bool gen_frag_p)
c = *p;
*p = '\0';
- opcode = (const struct s3_asm_opcode *) str_hash_find (s3_score_ops_hsh,
- operator);
+ opcode = str_hash_find (s3_score_ops_hsh, operator);
*p = c;
memset (&s3_inst, '\0', sizeof (s3_inst));
@@ -2744,7 +2741,7 @@ s3_append_insn (char *str, bool gen_frag_p)
if (s3_inst.error)
{
- retval = (int) s3_FAIL;
+ retval = s3_FAIL;
as_bad (_("%s -- `%s'"), s3_inst.error, s3_inst.str);
s3_inst.error = NULL;
}
@@ -2757,10 +2754,10 @@ s3_do16_mv_cmp (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -2771,10 +2768,10 @@ s3_do16_cmpi (char *str)
{
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 0, _SIMM5) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 0, _SIMM5) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -2785,10 +2782,10 @@ s3_do16_addi (char *str)
{
s3_skip_whitespace (str);
- if (s3_reglow_required_here (&str, 6) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 0, _SIMM6) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reglow_required_here (&str, 6) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 0, _SIMM6) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -2800,10 +2797,10 @@ s3_do16_rdi5 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reglow_required_here (&str, 5) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reglow_required_here (&str, 5) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 0, _IMM5) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
else
{
@@ -2820,7 +2817,7 @@ s3_do16_xi5 (char *str)
{
s3_skip_whitespace (str);
- if (s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_data_op2 (&str, 0, _IMM5) == s3_FAIL || s3_end_of_line (str) == s3_FAIL)
return;
}
@@ -2834,7 +2831,7 @@ s3_validate_immediate_align (int val, unsigned int data_type)
if (val % 2)
{
s3_inst.error = _("address offset must be half word alignment");
- return (int) s3_FAIL;
+ return s3_FAIL;
}
}
else if ((data_type == _IMM5_RSHIFT_2) || (data_type == _IMM10_RSHIFT_2))
@@ -2842,7 +2839,7 @@ s3_validate_immediate_align (int val, unsigned int data_type)
if (val % 4)
{
s3_inst.error = _("address offset must be word alignment");
- return (int) s3_FAIL;
+ return s3_FAIL;
}
}
@@ -2874,19 +2871,19 @@ s3_exp_ldst_offset (char **str, int shift, unsigned int data_type)
data_type += 24;
}
- if (s3_my_get_expression (&s3_inst.reloc.exp, str) == (int) s3_FAIL)
- return (int) s3_FAIL;
+ if (s3_my_get_expression (&s3_inst.reloc.exp, str) == s3_FAIL)
+ return s3_FAIL;
if (s3_inst.reloc.exp.X_op == O_constant)
{
/* Need to check the immediate align. */
int value = s3_validate_immediate_align (s3_inst.reloc.exp.X_add_number, data_type);
- if (value == (int) s3_FAIL)
- return (int) s3_FAIL;
+ if (value == s3_FAIL)
+ return s3_FAIL;
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, 0);
- if (value == (int) s3_FAIL)
+ if (value == s3_FAIL)
{
if (data_type < 30)
sprintf (s3_err_msg,
@@ -2899,7 +2896,7 @@ s3_exp_ldst_offset (char **str, int shift, unsigned int data_type)
s3_score_df_range[data_type - 24].bits,
s3_score_df_range[data_type - 24].range[0], s3_score_df_range[data_type - 24].range[1]);
s3_inst.error = s3_err_msg;
- return (int) s3_FAIL;
+ return s3_FAIL;
}
if (data_type == _IMM5_RSHIFT_1)
@@ -2939,8 +2936,8 @@ s3_do_ldst_insn (char *str)
s3_skip_whitespace (str);
- if (((conflict_reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL))
+ if (((conflict_reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL))
return;
/* ld/sw rD, [rA, simm15] ld/sw rD, [rA]+, simm12 ld/sw rD, [rA, simm12]+. */
@@ -2949,7 +2946,7 @@ s3_do_ldst_insn (char *str)
str++;
s3_skip_whitespace (str);
- if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
+ if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == s3_FAIL)
return;
/* Conflicts can occur on stores as well as loads. */
@@ -2967,8 +2964,8 @@ s3_do_ldst_insn (char *str)
/* ld/sw rD, [rA]+, simm12. */
if (s3_skip_past_comma (&str) == s3_SUCCESS)
{
- if ((s3_exp_ldst_offset (&str, 3, _SIMM12) == (int) s3_FAIL)
- || (s3_end_of_line (str) == (int) s3_FAIL))
+ if ((s3_exp_ldst_offset (&str, 3, _SIMM12) == s3_FAIL)
+ || (s3_end_of_line (str) == s3_FAIL))
return;
if (conflict_reg)
@@ -3008,7 +3005,7 @@ s3_do_ldst_insn (char *str)
else
{
s3_SET_INSN_ERROR (NULL);
- if (s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -3027,7 +3024,7 @@ s3_do_ldst_insn (char *str)
/* ld/sw rD, [rA] convert to ld/sw rD, [rA, simm15]. */
else
{
- if (s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_end_of_line (str) == s3_FAIL)
return;
ldst_idx = s3_inst.instruction & OPC_PSEUDOLDST_MASK;
@@ -3086,13 +3083,13 @@ s3_do_ldst_insn (char *str)
/* ld/sw rD, [rA, simm15] ld/sw rD, [rA, simm12]+. */
else
{
- if (s3_skip_past_comma (&str) == (int) s3_FAIL)
+ if (s3_skip_past_comma (&str) == s3_FAIL)
{
s3_inst.error = _("pre-indexed expression expected");
return;
}
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL)
return;
s3_skip_whitespace (str);
@@ -3124,7 +3121,7 @@ s3_do_ldst_insn (char *str)
}
}
- if (s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_end_of_line (str) == s3_FAIL)
return;
if (s3_inst.reloc.exp.X_op == O_constant)
@@ -3156,7 +3153,7 @@ s3_do_ldst_insn (char *str)
}
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, 0);
- if (value == (int) s3_FAIL)
+ if (value == s3_FAIL)
{
if (data_type < 30)
sprintf (s3_err_msg,
@@ -3272,7 +3269,7 @@ s3_do_cache (char *str)
{
s3_skip_whitespace (str);
- if ((s3_data_op2 (&str, 20, _IMM5) == (int) s3_FAIL) || (s3_skip_past_comma (&str) == (int) s3_FAIL))
+ if ((s3_data_op2 (&str, 20, _IMM5) == s3_FAIL) || (s3_skip_past_comma (&str) == s3_FAIL))
{
return;
}
@@ -3289,13 +3286,13 @@ s3_do_cache (char *str)
str++;
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL)
return;
s3_skip_whitespace (str);
/* cache op, [rA] */
- if (s3_skip_past_comma (&str) == (int) s3_FAIL)
+ if (s3_skip_past_comma (&str) == s3_FAIL)
{
s3_SET_INSN_ERROR (NULL);
if (*str != ']')
@@ -3308,7 +3305,7 @@ s3_do_cache (char *str)
/* cache op, [rA, simm15] */
else
{
- if (s3_exp_ldst_offset (&str, 0, _SIMM15) == (int) s3_FAIL)
+ if (s3_exp_ldst_offset (&str, 0, _SIMM15) == s3_FAIL)
{
return;
}
@@ -3321,7 +3318,7 @@ s3_do_cache (char *str)
}
}
- if (s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_end_of_line (str) == s3_FAIL)
return;
}
else
@@ -3338,21 +3335,21 @@ s3_do_crdcrscrsimm5 (char *str)
strbak = str;
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE_CR) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_CR) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL)
{
str = strbak;
/* cop1 cop_code20. */
- if (s3_data_op2 (&str, 5, _IMM20) == (int) s3_FAIL)
+ if (s3_data_op2 (&str, 5, _IMM20) == s3_FAIL)
return;
}
else
{
- if (s3_data_op2 (&str, 5, _IMM5) == (int) s3_FAIL)
+ if (s3_data_op2 (&str, 5, _IMM5) == s3_FAIL)
return;
}
@@ -3365,8 +3362,8 @@ s3_do_ldst_cop (char *str)
{
s3_skip_whitespace (str);
- if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL))
+ if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL))
return;
if (*str == '[')
@@ -3374,14 +3371,14 @@ s3_do_ldst_cop (char *str)
str++;
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL)
return;
s3_skip_whitespace (str);
if (*str++ != ']')
{
- if (s3_exp_ldst_offset (&str, 5, _IMM10_RSHIFT_2) == (int) s3_FAIL)
+ if (s3_exp_ldst_offset (&str, 5, _IMM10_RSHIFT_2) == s3_FAIL)
return;
s3_skip_whitespace (str);
@@ -3404,7 +3401,7 @@ s3_do16_ldst_insn (char *str)
int conflict_reg = 0;
s3_skip_whitespace (str);
- if ((s3_reglow_required_here (&str, 8) == (int) s3_FAIL) || (s3_skip_past_comma (&str) == (int) s3_FAIL))
+ if ((s3_reglow_required_here (&str, 8) == s3_FAIL) || (s3_skip_past_comma (&str) == s3_FAIL))
return;
if (*str == '[')
@@ -3413,7 +3410,7 @@ s3_do16_ldst_insn (char *str)
str++;
s3_skip_whitespace (str);
- if ((conflict_reg = s3_reglow_required_here (&str, 5)) == (int) s3_FAIL)
+ if ((conflict_reg = s3_reglow_required_here (&str, 5)) == s3_FAIL)
return;
if (conflict_reg&0x8)
{
@@ -3427,17 +3424,17 @@ s3_do16_ldst_insn (char *str)
if (*str == ']')
{
str++;
- if (s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_end_of_line (str) == s3_FAIL)
return;
}
else
{
- if (s3_skip_past_comma (&str) == (int) s3_FAIL)
+ if (s3_skip_past_comma (&str) == s3_FAIL)
{
s3_inst.error = _("comma is expected");
return;
}
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL)
return;
s3_skip_whitespace (str);
if (*str++ != ']')
@@ -3445,7 +3442,7 @@ s3_do16_ldst_insn (char *str)
s3_inst.error = _("missing ]");
return;
}
- if (s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_end_of_line (str) == s3_FAIL)
return;
if (s3_inst.reloc.exp.X_op == O_constant)
{
@@ -3453,7 +3450,7 @@ s3_do16_ldst_insn (char *str)
unsigned int data_type;
data_type = _IMM5_RSHIFT_2;
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, 0);
- if (value == (int) s3_FAIL)
+ if (value == s3_FAIL)
{
if (data_type < 30)
sprintf (s3_err_msg,
@@ -3490,12 +3487,12 @@ s3_do_lw48 (char *str)
s3_skip_whitespace (str);
- if ((s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL))
+ if ((s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL))
return;
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -3533,12 +3530,12 @@ s3_do_sw48 (char *str)
s3_skip_whitespace (str);
- if ((s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL))
+ if ((s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL))
return;
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -3575,12 +3572,12 @@ s3_do_ldi48 (char *str)
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL)
return;
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -3605,7 +3602,7 @@ s3_do_sdbbp48 (char *str)
{
s3_skip_whitespace (str);
- if (s3_data_op2 (&str, 5, _IMM5) == (int) s3_FAIL || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_data_op2 (&str, 5, _IMM5) == s3_FAIL || s3_end_of_line (str) == s3_FAIL)
return;
}
@@ -3614,12 +3611,12 @@ s3_do_and48 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reglow_required_here (&str, 38) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reglow_required_here (&str, 34) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 2, _IMM32) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reglow_required_here (&str, 38) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reglow_required_here (&str, 34) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 2, _IMM32) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
}
@@ -3628,12 +3625,12 @@ s3_do_or48 (char *str)
{
s3_skip_whitespace (str);
- if (s3_reglow_required_here (&str, 38) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reglow_required_here (&str, 34) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 2, _IMM32) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reglow_required_here (&str, 38) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reglow_required_here (&str, 34) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 2, _IMM32) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
}
@@ -3653,9 +3650,9 @@ s3_do_mbitclr (char *str)
s3_inst.instruction &= 0x0;
- if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL)
- || (s3_data_op2 (&str, 0, _IMM11) == (int) s3_FAIL))
+ if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL)
+ || (s3_data_op2 (&str, 0, _IMM11) == s3_FAIL))
return;
/* Get imm11 and refill opcode. */
@@ -3672,8 +3669,8 @@ s3_do_mbitclr (char *str)
}
str++;
- if ((s3_skip_past_comma (&str) == (int) s3_FAIL)
- || (s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL))
+ if ((s3_skip_past_comma (&str) == s3_FAIL)
+ || (s3_data_op2 (&str, 10, _IMM5) == s3_FAIL))
return;
/* Set imm11 to opcode. */
@@ -3698,9 +3695,9 @@ s3_do_mbitset (char *str)
s3_inst.instruction &= 0x0;
- if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL)
- || (s3_data_op2 (&str, 0, _IMM11) == (int) s3_FAIL))
+ if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL)
+ || (s3_data_op2 (&str, 0, _IMM11) == s3_FAIL))
return;
/* Get imm11 and refill opcode. */
@@ -3717,8 +3714,8 @@ s3_do_mbitset (char *str)
}
str++;
- if ((s3_skip_past_comma (&str) == (int) s3_FAIL)
- || (s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL))
+ if ((s3_skip_past_comma (&str) == s3_FAIL)
+ || (s3_data_op2 (&str, 10, _IMM5) == s3_FAIL))
return;
/* Set imm11 to opcode. */
@@ -3732,10 +3729,10 @@ s3_do16_slli_srli (char *str)
{
s3_skip_whitespace (str);
- if ((s3_reglow_required_here (&str, 5) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL)
- || s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if ((s3_reglow_required_here (&str, 5) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL)
+ || s3_data_op2 (&str, 0, _IMM5) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
}
@@ -3744,10 +3741,10 @@ s3_do16_ldiu (char *str)
{
s3_skip_whitespace (str);
- if ((s3_reg_required_here (&str, 5,s3_REG_TYPE_SCORE) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL)
- || s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if ((s3_reg_required_here (&str, 5,s3_REG_TYPE_SCORE) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL)
+ || s3_data_op2 (&str, 0, _IMM5) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
}
@@ -3755,8 +3752,8 @@ static void
s3_do16_push_pop (char *str)
{
s3_skip_whitespace (str);
- if ((s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if ((s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE)) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
}
@@ -3766,10 +3763,10 @@ s3_do16_rpush (char *str)
int reg;
int val;
s3_skip_whitespace (str);
- if ((reg = (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE))) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 0, _IMM5_MULTI_LOAD) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if ((reg = (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE))) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 0, _IMM5_MULTI_LOAD) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
/* 0: indicate 32.
@@ -3794,10 +3791,10 @@ s3_do16_rpop (char *str)
int reg;
int val;
s3_skip_whitespace (str);
- if ((reg = (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE))) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_data_op2 (&str, 0, _IMM5_MULTI_LOAD) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if ((reg = (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE))) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_data_op2 (&str, 0, _IMM5_MULTI_LOAD) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
/* 0: indicate 32.
@@ -3847,7 +3844,7 @@ s3_do_ldst_unalign (char *str)
str++;
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL)
return;
if (*str++ == ']')
@@ -3864,14 +3861,14 @@ s3_do_ldst_unalign (char *str)
return;
}
- if (s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_end_of_line (str) == s3_FAIL)
return;
}
/* lcw/lce/scb/sce rD, [rA]+. */
else
{
- if (((conflict_reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL))
+ if (((conflict_reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL))
{
return;
}
@@ -3882,7 +3879,7 @@ s3_do_ldst_unalign (char *str)
int reg;
s3_skip_whitespace (str);
- if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
+ if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == s3_FAIL)
{
return;
}
@@ -3909,7 +3906,7 @@ s3_do_ldst_unalign (char *str)
return;
}
- if (s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_end_of_line (str) == s3_FAIL)
return;
}
else
@@ -3938,8 +3935,8 @@ s3_do_ldst_atomic (char *str)
s3_skip_whitespace (str);
- if ((s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL))
+ if ((s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL))
{
return;
}
@@ -3952,7 +3949,7 @@ s3_do_ldst_atomic (char *str)
int reg;
s3_skip_whitespace (str);
- if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
+ if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == s3_FAIL)
{
return;
}
@@ -4095,7 +4092,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
For an external symbol: lw rD, <sym>($gp)
(BFD_RELOC_SCORE_GOT15 or BFD_RELOC_SCORE_CALL15) */
sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
- if (s3_append_insn (tmp, false) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, false) == s3_FAIL)
return;
if (reg_rd == s3_PIC_CALL_REG)
@@ -4109,7 +4106,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
- if (s3_append_insn (tmp, false) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, false) == s3_FAIL)
return;
memcpy (&var_insts[1], &s3_inst, sizeof (struct s3_score_it));
@@ -4119,7 +4116,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
{
/* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */
sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
- if (s3_append_insn (tmp, true) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, true) == s3_FAIL)
return;
/* Insn 2 */
@@ -4127,8 +4124,8 @@ s3_build_la_pic (int reg_rd, expressionS exp)
var_num = 1;
/* Fix part
For an external symbol: addi rD, <constant> */
- sprintf (tmp, "addi r%d, %d", reg_rd, (int)add_number);
- if (s3_append_insn (tmp, false) == (int) s3_FAIL)
+ sprintf (tmp, "addi r%d, %d", reg_rd, (int) add_number);
+ if (s3_append_insn (tmp, false) == s3_FAIL)
return;
memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it));
@@ -4137,7 +4134,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
For a local symbol: addi rD, <sym>+<constant> (BFD_RELOC_GOT_LO16) */
sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd,
S_GET_NAME (add_symbol), (int) add_number);
- if (s3_append_insn (tmp, false) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, false) == s3_FAIL)
return;
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
@@ -4150,7 +4147,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
/* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */
sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
- if (s3_append_insn (tmp, true) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, true) == s3_FAIL)
return;
/* Insn 2 */
@@ -4159,7 +4156,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
/* Fix part
For an external symbol: ldis r1, HI%<constant> */
sprintf (tmp, "ldis r1, %d", hi);
- if (s3_append_insn (tmp, false) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, false) == s3_FAIL)
return;
memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it));
@@ -4172,7 +4169,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
hi += 1;
}
sprintf (tmp, "ldis_pic r1, %d", hi);
- if (s3_append_insn (tmp, false) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, false) == s3_FAIL)
return;
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
@@ -4184,7 +4181,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
/* Fix part
For an external symbol: ori r1, LO%<constant> */
sprintf (tmp, "ori r1, %d", lo);
- if (s3_append_insn (tmp, false) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, false) == s3_FAIL)
return;
memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it));
@@ -4192,7 +4189,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
/* Var part
For a local symbol: addi r1, <sym>+LO%<constant> (BFD_RELOC_GOT_LO16) */
sprintf (tmp, "addi_u_pic r1, %s + %d", S_GET_NAME (add_symbol), lo);
- if (s3_append_insn (tmp, false) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, false) == s3_FAIL)
return;
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
@@ -4200,7 +4197,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
/* Insn 4: add rD, rD, r1 */
sprintf (tmp, "add r%d, r%d, r1", reg_rd, reg_rd);
- if (s3_append_insn (tmp, true) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, true) == s3_FAIL)
return;
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
@@ -4217,8 +4214,8 @@ s3_do_macro_la_rdi32 (char *str)
int reg_rd;
s3_skip_whitespace (str);
- if ((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL)
+ if ((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL)
{
return;
}
@@ -4229,13 +4226,13 @@ s3_do_macro_la_rdi32 (char *str)
char append_str[s3_MAX_LITERAL_POOL_SIZE];
/* Check immediate value. */
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL)
{
s3_inst.error = _("expression error");
return;
}
else if ((s3_inst.reloc.exp.X_add_symbol == NULL)
- && (s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _IMM32, 0) == (int) s3_FAIL))
+ && (s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _IMM32, 0) == s3_FAIL))
{
s3_inst.error = _("value not in range [0, 0xffffffff]");
return;
@@ -4245,7 +4242,7 @@ s3_do_macro_la_rdi32 (char *str)
str = keep_data;
/* la rd, simm16. */
- if (s3_data_op2 (&str, 1, _SIMM16_LA) != (int) s3_FAIL)
+ if (s3_data_op2 (&str, 1, _SIMM16_LA) != s3_FAIL)
{
s3_end_of_line (str);
return;
@@ -4256,8 +4253,8 @@ s3_do_macro_la_rdi32 (char *str)
s3_SET_INSN_ERROR (NULL);
/* Reset str. */
str = keep_data;
- if ((s3_data_op2 (&str, 1, _VALUE_HI16) == (int) s3_FAIL)
- || (s3_end_of_line (str) == (int) s3_FAIL))
+ if ((s3_data_op2 (&str, 1, _VALUE_HI16) == s3_FAIL)
+ || (s3_end_of_line (str) == s3_FAIL))
{
return;
}
@@ -4266,11 +4263,11 @@ s3_do_macro_la_rdi32 (char *str)
if ((s3_score_pic == s3_NO_PIC) || (!s3_inst.reloc.exp.X_add_symbol))
{
sprintf (append_str, "ld_i32hi r%d, %s", reg_rd, keep_data);
- if (s3_append_insn (append_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, true) == s3_FAIL)
return;
sprintf (append_str, "ld_i32lo r%d, %s", reg_rd, keep_data);
- if (s3_append_insn (append_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, true) == s3_FAIL)
return;
}
else
@@ -4294,8 +4291,8 @@ s3_do_macro_li_rdi32 (char *str)
int reg_rd;
s3_skip_whitespace (str);
- if ((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL)
+ if ((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL)
{
return;
}
@@ -4305,7 +4302,7 @@ s3_do_macro_li_rdi32 (char *str)
char *keep_data = str;
/* Check immediate value. */
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL)
{
s3_inst.error = _("expression error");
return;
@@ -4321,7 +4318,7 @@ s3_do_macro_li_rdi32 (char *str)
str = keep_data;
/* li rd, simm16. */
- if (s3_data_op2 (&str, 1, _SIMM16_LA) != (int) s3_FAIL)
+ if (s3_data_op2 (&str, 1, _SIMM16_LA) != s3_FAIL)
{
s3_end_of_line (str);
return;
@@ -4334,8 +4331,8 @@ s3_do_macro_li_rdi32 (char *str)
/* Reset str. */
str = keep_data;
- if ((s3_data_op2 (&str, 1, _VALUE_HI16) == (int) s3_FAIL)
- || (s3_end_of_line (str) == (int) s3_FAIL))
+ if ((s3_data_op2 (&str, 1, _VALUE_HI16) == s3_FAIL)
+ || (s3_end_of_line (str) == s3_FAIL))
{
return;
}
@@ -4348,12 +4345,12 @@ s3_do_macro_li_rdi32 (char *str)
{
sprintf (append_str, "ld_i32hi r%d, %s", reg_rd, keep_data);
- if (s3_append_insn (append_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, true) == s3_FAIL)
return;
else
{
sprintf (append_str, "ld_i32lo r%d, %s", reg_rd, keep_data);
- if (s3_append_insn (append_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, true) == s3_FAIL)
return;
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
@@ -4380,15 +4377,15 @@ s3_do_macro_mul_rdrsrs (char *str)
strcpy (append_str, str);
backupstr = append_str;
s3_skip_whitespace (backupstr);
- if (((reg_rd = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
- || (s3_skip_past_comma (&backupstr) == (int) s3_FAIL)
- || ((reg_rs1 = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL))
+ if (((reg_rd = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == s3_FAIL)
+ || (s3_skip_past_comma (&backupstr) == s3_FAIL)
+ || ((reg_rs1 = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == s3_FAIL))
{
s3_inst.error = s3_BAD_ARGS;
return;
}
- if (s3_skip_past_comma (&backupstr) == (int) s3_FAIL)
+ if (s3_skip_past_comma (&backupstr) == s3_FAIL)
{
/* rem/remu rA, rB is error format. */
if (strcmp (s3_inst.name, "rem") == 0 || strcmp (s3_inst.name, "remu") == 0)
@@ -4405,8 +4402,8 @@ s3_do_macro_mul_rdrsrs (char *str)
else
{
s3_SET_INSN_ERROR (NULL);
- if (((reg_rs2 = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
- || (s3_end_of_line (backupstr) == (int) s3_FAIL))
+ if (((reg_rs2 = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == s3_FAIL)
+ || (s3_end_of_line (backupstr) == s3_FAIL))
{
return;
}
@@ -4431,11 +4428,11 @@ s3_do_macro_mul_rdrsrs (char *str)
}
/* Output mul/mulu or div/divu or rem/remu. */
- if (s3_append_insn (append_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, true) == s3_FAIL)
return;
/* Output mfcel or mfceh. */
- if (s3_append_insn (append_str1, true) == (int) s3_FAIL)
+ if (s3_append_insn (append_str1, true) == s3_FAIL)
return;
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
@@ -4461,11 +4458,11 @@ s3_exp_macro_ldst_abs (char *str)
strcpy (verifystr, str);
backupstr = verifystr;
s3_skip_whitespace (backupstr);
- if ((reg_rd = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
+ if ((reg_rd = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == s3_FAIL)
return;
tmp = backupstr;
- if (s3_skip_past_comma (&backupstr) == (int) s3_FAIL)
+ if (s3_skip_past_comma (&backupstr) == s3_FAIL)
return;
backupstr = tmp;
@@ -4492,19 +4489,19 @@ s3_do_macro_bcmp (char *str)
memset (inst_expand, 0, sizeof inst_expand);
s3_skip_whitespace (str);
- if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- ||(reg_b = s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL)
+ if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ ||(reg_b = s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE)) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL)
return;
keep_data_size = strlen (str) + 1;
keep_data = xmalloc (keep_data_size * 2 + 14);
memcpy (keep_data, str, keep_data_size);
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL
||reg_b == 0
- || s3_end_of_line (str) == (int) s3_FAIL)
+ || s3_end_of_line (str) == s3_FAIL)
goto out;
else if (s3_inst.reloc.exp.X_add_symbol == 0)
{
@@ -4533,14 +4530,14 @@ s3_do_macro_bcmp (char *str)
if (s3_score_pic == s3_NO_PIC)
{
sprintf (append_str, "cmp! r%d, r%d", reg_a, reg_b);
- if (s3_append_insn (append_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, true) == s3_FAIL)
goto out;
if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
memcpy (append_str, "beq ", 4);
else
memcpy (append_str, "bne ", 4);
memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
- if (s3_append_insn (append_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, true) == s3_FAIL)
goto out;
}
else
@@ -4565,7 +4562,7 @@ s3_do_macro_bcmp (char *str)
if (s3_score_pic == s3_NO_PIC)
{
sprintf (append_str, "cmp! r%d, r%d", reg_a, reg_b);
- if (s3_append_insn (append_str, false) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, false) == s3_FAIL)
goto out;
memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it));
@@ -4574,7 +4571,7 @@ s3_do_macro_bcmp (char *str)
else
memcpy (append_str, "bne ", 4);
memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
- if (s3_append_insn (append_str, false) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, false) == s3_FAIL)
goto out;
memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it));
}
@@ -4649,16 +4646,16 @@ s3_do_macro_bcmpz (char *str)
memset (inst_expand, 0, sizeof inst_expand);
s3_skip_whitespace (str);
- if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL)
+ if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL)
return;
keep_data_size = strlen (str) + 1;
keep_data = xmalloc (keep_data_size * 2 + 13);
memcpy (keep_data, str, keep_data_size);
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
goto out;
else if (s3_inst.reloc.exp.X_add_symbol == 0)
{
@@ -4683,14 +4680,14 @@ s3_do_macro_bcmpz (char *str)
if (s3_score_pic == s3_NO_PIC)
{
sprintf (append_str, "cmpi! r%d, 0", reg_a);
- if (s3_append_insn (append_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, true) == s3_FAIL)
goto out;
if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
memcpy (append_str, "beq ", 4);
else
memcpy (append_str, "bne ", 4);
memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
- if (s3_append_insn (append_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, true) == s3_FAIL)
goto out;
}
else
@@ -4715,7 +4712,7 @@ s3_do_macro_bcmpz (char *str)
if (s3_score_pic == s3_NO_PIC)
{
sprintf (append_str, "cmpi! r%d, 0", reg_a);
- if (s3_append_insn (append_str, false) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, false) == s3_FAIL)
goto out;
memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it));
if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
@@ -4723,7 +4720,7 @@ s3_do_macro_bcmpz (char *str)
else
memcpy (append_str, "bne ", 4);
memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
- if (s3_append_insn (append_str, false) == (int) s3_FAIL)
+ if (s3_append_insn (append_str, false) == s3_FAIL)
goto out;
memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it));
}
@@ -4801,7 +4798,7 @@ s3_nopic_need_relax (symbolS * sym, int before_relaxing)
not be referenced off the $gp, although it appears as though
they can. */
symname = S_GET_NAME (sym);
- if (symname != (const char *)NULL
+ if (symname != NULL
&& (strcmp (symname, "eprol") == 0
|| strcmp (symname, "etext") == 0
|| strcmp (symname, "_gp") == 0
@@ -4814,13 +4811,15 @@ s3_nopic_need_relax (symbolS * sym, int before_relaxing)
{
return 1;
}
- else if ((!S_IS_DEFINED (sym) || S_IS_COMMON (sym)) && (0
- /* We must defer this decision until after the whole file has been read,
- since there might be a .extern after the first use of this symbol. */
- || (before_relaxing
- && S_GET_VALUE (sym) == 0)
- || (S_GET_VALUE (sym) != 0
- && S_GET_VALUE (sym) <= s3_g_switch_value)))
+ else if ((!S_IS_DEFINED (sym) || S_IS_COMMON (sym))
+ && (0
+ /* We must defer this decision until after the
+ whole file has been read, since there might be a
+ .extern after the first use of this symbol. */
+ || (before_relaxing
+ && S_GET_VALUE (sym) == 0)
+ || (S_GET_VALUE (sym) != 0
+ && S_GET_VALUE (sym) <= s3_g_switch_value)))
{
return 0;
}
@@ -4864,7 +4863,7 @@ s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
For an external symbol: lw rD, <sym>($gp)
(BFD_RELOC_SCORE_GOT15) */
sprintf (tmp, "lw_pic r1, %s", S_GET_NAME (add_symbol));
- if (s3_append_insn (tmp, false) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, false) == s3_FAIL)
return;
memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it));
@@ -4876,7 +4875,7 @@ s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
sprintf (tmp, "addi_s_pic r1, %s", S_GET_NAME (add_symbol));
- if (s3_append_insn (tmp, false) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, false) == s3_FAIL)
return;
memcpy (&var_insts[1], &s3_inst, sizeof (struct s3_score_it));
@@ -4884,7 +4883,7 @@ s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
/* Insn 2 or Insn 3: lw/st rD, [r1, constant] */
sprintf (tmp, "%s r%d, [r1, %d]", insn_name, reg_rd, add_number);
- if (s3_append_insn (tmp, true) == (int) s3_FAIL)
+ if (s3_append_insn (tmp, true) == s3_FAIL)
return;
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
@@ -4920,10 +4919,10 @@ s3_do_macro_ldst_label (char *str)
backup_str = verifystr;
s3_skip_whitespace (backup_str);
- if ((reg_rd = s3_reg_required_here (&backup_str, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
+ if ((reg_rd = s3_reg_required_here (&backup_str, -1, s3_REG_TYPE_SCORE)) == s3_FAIL)
return;
- if (s3_skip_past_comma (&backup_str) == (int) s3_FAIL)
+ if (s3_skip_past_comma (&backup_str) == s3_FAIL)
return;
label_str = backup_str;
@@ -4940,18 +4939,18 @@ s3_do_macro_ldst_label (char *str)
absolute_value = backup_str;
s3_inst.type = Rd_rvalueRs_SI15;
- if (s3_my_get_expression (&s3_inst.reloc.exp, &backup_str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &backup_str) == s3_FAIL)
{
s3_inst.error = _("expression error");
return;
}
else if ((s3_inst.reloc.exp.X_add_symbol == NULL)
- && (s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _VALUE, 0) == (int) s3_FAIL))
+ && (s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _VALUE, 0) == s3_FAIL))
{
s3_inst.error = _("value not in range [0, 0x7fffffff]");
return;
}
- else if (s3_end_of_line (backup_str) == (int) s3_FAIL)
+ else if (s3_end_of_line (backup_str) == s3_FAIL)
{
s3_inst.error = _("end on line error");
return;
@@ -4969,8 +4968,8 @@ s3_do_macro_ldst_label (char *str)
/* Ld/st rD, label. */
s3_inst.type = Rd_rvalueRs_SI15;
backup_str = absolute_value;
- if ((s3_data_op2 (&backup_str, 1, _GP_IMM15) == (int) s3_FAIL)
- || (s3_end_of_line (backup_str) == (int) s3_FAIL))
+ if ((s3_data_op2 (&backup_str, 1, _GP_IMM15) == s3_FAIL)
+ || (s3_end_of_line (backup_str) == s3_FAIL))
{
return;
}
@@ -5028,7 +5027,7 @@ s3_do_macro_ldst_label (char *str)
ld/st rd, [r1, 0] */
for (i = 0; i < 3; i++)
{
- if (s3_append_insn (append_str[i], false) == (int) s3_FAIL)
+ if (s3_append_insn (append_str[i], false) == s3_FAIL)
return;
memcpy (&inst_expand[i], &s3_inst, sizeof (struct s3_score_it));
@@ -5121,10 +5120,10 @@ s3_do_lw_pic (char *str)
int reg_rd;
s3_skip_whitespace (str);
- if (((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
- || (s3_skip_past_comma (&str) == (int) s3_FAIL)
- || (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL)
- || (s3_end_of_line (str) == (int) s3_FAIL))
+ if (((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL)
+ || (s3_skip_past_comma (&str) == s3_FAIL)
+ || (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL)
+ || (s3_end_of_line (str) == s3_FAIL))
{
return;
}
@@ -5158,7 +5157,7 @@ s3_do_empty (char *str)
return;
}
}
- if (s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_end_of_line (str) == s3_FAIL)
return;
if (s3_inst.relax_inst != 0x8000)
@@ -5187,8 +5186,8 @@ s3_do_jump (char *str)
char *save_in;
s3_skip_whitespace (str);
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
if (s3_inst.reloc.exp.X_add_symbol == 0)
@@ -5214,8 +5213,8 @@ s3_do_jump (char *str)
static void
s3_do_branch (char *str)
{
- if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -5253,8 +5252,8 @@ s3_do_branch (char *str)
static void
s3_do16_branch (char *str)
{
- if ((s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL))
+ if ((s3_my_get_expression (&s3_inst.reloc.exp, &str) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL))
{
;
}
@@ -5384,8 +5383,8 @@ s3_do16_dsp (char *str)
s3_skip_whitespace (str);
- if ((rd = s3_reglow_required_here (&str, 0)) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if ((rd = s3_reglow_required_here (&str, 0)) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -5408,10 +5407,10 @@ s3_do16_dsp2 (char *str)
s3_skip_whitespace (str);
- if (s3_reglow_required_here (&str, 4) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reglow_required_here (&str, 0) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reglow_required_here (&str, 4) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reglow_required_here (&str, 0) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -5435,10 +5434,10 @@ s3_do_dsp (char *str)
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 20) & 0x1f) == 3) )
@@ -5464,12 +5463,12 @@ s3_do_dsp2 (char *str)
s3_skip_whitespace (str);
- if ((reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if ((reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
{
return;
}
@@ -5513,10 +5512,10 @@ s3_do_dsp3 (char *str)
s3_skip_whitespace (str);
- if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_skip_past_comma (&str) == (int) s3_FAIL
- || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
- || s3_end_of_line (str) == (int) s3_FAIL)
+ if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_skip_past_comma (&str) == s3_FAIL
+ || s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == s3_FAIL
+ || s3_end_of_line (str) == s3_FAIL)
return;
if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 20) & 0x1f) == 3) )
@@ -5554,7 +5553,7 @@ s3_s_change_sec (int sec)
switch (sec)
{
case 'r':
- seg = subseg_new (s3_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ());
+ seg = subseg_new (s3_RDATA_SECTION_NAME, get_absolute_expression ());
bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY
| SEC_RELOC | SEC_DATA));
if (strcmp (TARGET_OS, "elf") != 0)
@@ -5562,7 +5561,7 @@ s3_s_change_sec (int sec)
demand_empty_rest_of_line ();
break;
case 's':
- seg = subseg_new (".sdata", (subsegT) get_absolute_expression ());
+ seg = subseg_new (".sdata", get_absolute_expression ());
bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_RELOC
| SEC_DATA | SEC_SMALL_DATA));
if (strcmp (TARGET_OS, "elf") != 0)
@@ -5577,7 +5576,7 @@ s3_s_score_mask (int reg_type ATTRIBUTE_UNUSED)
{
long mask, off;
- if (s3_cur_proc_ptr == (s3_procS *) NULL)
+ if (s3_cur_proc_ptr == NULL)
{
as_warn (_(".mask outside of .ent"));
demand_empty_rest_of_line ();
@@ -5604,7 +5603,7 @@ s3_get_symbol (void)
symbolS *p;
c = get_symbol_name (&name);
- p = (symbolS *) symbol_find_or_make (name);
+ p = symbol_find_or_make (name);
(void) restore_line_pointer (c);
return p;
}
@@ -5711,7 +5710,7 @@ s3_s_score_frame (int ignore ATTRIBUTE_UNUSED)
backupstr = input_line_pointer;
#ifdef OBJ_ELF
- if (s3_cur_proc_ptr == (s3_procS *) NULL)
+ if (s3_cur_proc_ptr == NULL)
{
as_warn (_(".frame outside of .ent"));
demand_empty_rest_of_line ();
@@ -5816,13 +5815,13 @@ s3_s_score_end (int x ATTRIBUTE_UNUSED)
exp.X_add_number = 0;
emit_expr (&exp, 4);
fragp = frag_more (7 * 4);
- md_number_to_chars (fragp, (valueT) s3_cur_proc_ptr->reg_mask, 4);
- md_number_to_chars (fragp + 4, (valueT) s3_cur_proc_ptr->reg_offset, 4);
- md_number_to_chars (fragp + 8, (valueT) s3_cur_proc_ptr->fpreg_mask, 4);
- md_number_to_chars (fragp + 12, (valueT) s3_cur_proc_ptr->leaf, 4);
- md_number_to_chars (fragp + 16, (valueT) s3_cur_proc_ptr->frame_offset, 4);
- md_number_to_chars (fragp + 20, (valueT) s3_cur_proc_ptr->frame_reg, 4);
- md_number_to_chars (fragp + 24, (valueT) s3_cur_proc_ptr->pc_reg, 4);
+ md_number_to_chars (fragp, s3_cur_proc_ptr->reg_mask, 4);
+ md_number_to_chars (fragp + 4, s3_cur_proc_ptr->reg_offset, 4);
+ md_number_to_chars (fragp + 8, s3_cur_proc_ptr->fpreg_mask, 4);
+ md_number_to_chars (fragp + 12, s3_cur_proc_ptr->leaf, 4);
+ md_number_to_chars (fragp + 16, s3_cur_proc_ptr->frame_offset, 4);
+ md_number_to_chars (fragp + 20, s3_cur_proc_ptr->frame_reg, 4);
+ md_number_to_chars (fragp + 24, s3_cur_proc_ptr->pc_reg, 4);
subseg_set (saved_seg, saved_subseg);
}
@@ -5906,21 +5905,21 @@ s3_s_score_cpload (int ignore ATTRIBUTE_UNUSED)
return;
}
- if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
+ if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == s3_FAIL)
return;
demand_empty_rest_of_line ();
sprintf (insn_str, "ld_i32hi r%d, %s", s3_GP, GP_DISP_LABEL);
- if (s3_append_insn (insn_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (insn_str, true) == s3_FAIL)
return;
sprintf (insn_str, "ld_i32lo r%d, %s", s3_GP, GP_DISP_LABEL);
- if (s3_append_insn (insn_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (insn_str, true) == s3_FAIL)
return;
sprintf (insn_str, "add r%d, r%d, r%d", s3_GP, s3_GP, reg);
- if (s3_append_insn (insn_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (insn_str, true) == s3_FAIL)
return;
}
@@ -5941,8 +5940,8 @@ s3_s_score_cprestore (int ignore ATTRIBUTE_UNUSED)
return;
}
- if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
- || s3_skip_past_comma (&input_line_pointer) == (int) s3_FAIL)
+ if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == s3_FAIL
+ || s3_skip_past_comma (&input_line_pointer) == s3_FAIL)
{
return;
}
@@ -5952,7 +5951,7 @@ s3_s_score_cprestore (int ignore ATTRIBUTE_UNUSED)
if (cprestore_offset <= 0x3fff)
{
sprintf (insn_str, "sw r%d, [r%d, %d]", s3_GP, reg, cprestore_offset);
- if (s3_append_insn (insn_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (insn_str, true) == s3_FAIL)
return;
}
else
@@ -5963,15 +5962,15 @@ s3_s_score_cprestore (int ignore ATTRIBUTE_UNUSED)
s3_nor1 = 0;
sprintf (insn_str, "li r1, %d", cprestore_offset);
- if (s3_append_insn (insn_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (insn_str, true) == s3_FAIL)
return;
sprintf (insn_str, "add r1, r1, r%d", reg);
- if (s3_append_insn (insn_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (insn_str, true) == s3_FAIL)
return;
sprintf (insn_str, "sw r%d, [r1]", s3_GP);
- if (s3_append_insn (insn_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (insn_str, true) == s3_FAIL)
return;
s3_nor1 = r1_bak;
@@ -6021,7 +6020,7 @@ s3_s_score_cpadd (int ignore ATTRIBUTE_UNUSED)
return;
}
- if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
+ if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == s3_FAIL)
{
return;
}
@@ -6029,7 +6028,7 @@ s3_s_score_cpadd (int ignore ATTRIBUTE_UNUSED)
/* Add $gp to the register named as an argument. */
sprintf (insn_str, "add r%d, r%d, r%d", reg, reg, s3_GP);
- if (s3_append_insn (insn_str, true) == (int) s3_FAIL)
+ if (s3_append_insn (insn_str, true) == s3_FAIL)
return;
}
@@ -6192,7 +6191,7 @@ s3_s_score_lcomm (int bytes_p)
symbol_get_frag (symbolP)->fr_symbol = NULL;
symbol_set_frag (symbolP, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, (offsetT) temp, NULL);
+ pfrag = frag_var (rs_org, 1, 1, 0, symbolP, temp, NULL);
*pfrag = 0;
@@ -6452,7 +6451,7 @@ s3_begin (void)
s3_build_dependency_insn_hsh ();
- for (i = (int)s3_REG_TYPE_FIRST; i < (int)s3_REG_TYPE_MAX; i++)
+ for (i = s3_REG_TYPE_FIRST; i < s3_REG_TYPE_MAX; i++)
s3_build_reg_hsh (s3_all_reg_maps + i);
/* Initialize dependency vector. */
@@ -6461,7 +6460,7 @@ s3_begin (void)
bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0);
seg = now_seg;
subseg = now_subseg;
- s3_pdr_seg = subseg_new (".pdr", (subsegT) 0);
+ s3_pdr_seg = subseg_new (".pdr", 0);
bfd_set_section_flags (s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
bfd_set_section_alignment (s3_pdr_seg, 2);
subseg_set (seg, subseg);
@@ -6480,17 +6479,16 @@ s3_number_to_chars (char *buf, valueT val, int n)
}
static valueT
-s3_normal_chars_to_number (char *buf, int n)
+s3_normal_chars_to_number (const char *buf, int n)
{
valueT result = 0;
- unsigned char *where = (unsigned char *)buf;
if (target_big_endian)
{
while (n--)
{
result <<= 8;
- result |= (*where++ & 255);
+ result |= (*buf++ & 255);
}
}
else
@@ -6498,7 +6496,7 @@ s3_normal_chars_to_number (char *buf, int n)
while (n--)
{
result <<= 8;
- result |= (where[n] & 255);
+ result |= (buf[n] & 255);
}
}
@@ -6508,7 +6506,7 @@ s3_normal_chars_to_number (char *buf, int n)
static void
s3_number_to_chars_littleendian (void *p, valueT data, int n)
{
- char *buf = (char *) p;
+ char *buf = p;
switch (n)
{
@@ -6531,7 +6529,7 @@ s3_number_to_chars_littleendian (void *p, valueT data, int n)
static valueT
s3_chars_to_number_littleendian (const void *p, int n)
{
- char *buf = (char *) p;
+ const char *buf = p;
valueT result = 0;
switch (n)
@@ -6617,19 +6615,19 @@ s3_atof (int type, char *litP, int *sizeP)
if (target_big_endian)
{
for (i = 0; i < prec; i++)
- {
- s3_md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
+ {
+ s3_md_number_to_chars (litP, words[i], 2);
+ litP += 2;
+ }
}
else
{
for (i = 0; i < prec; i += 2)
- {
- s3_md_number_to_chars (litP, (valueT) words[i + 1], 2);
- s3_md_number_to_chars (litP + 2, (valueT) words[i], 2);
- litP += 4;
- }
+ {
+ s3_md_number_to_chars (litP, words[i + 1], 2);
+ s3_md_number_to_chars (litP + 2, words[i], 2);
+ litP += 4;
+ }
}
return 0;
@@ -6771,7 +6769,7 @@ s3_relax_branch_inst16 (fragS * fragp)
if (s == NULL)
frag_addr = 0;
else
- symbol_address = (addressT) symbol_get_frag (s)->fr_address;
+ symbol_address = symbol_get_frag (s)->fr_address;
inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN16_SIZE);
offset = (inst_value & 0x1ff) << 1;
@@ -6814,7 +6812,7 @@ s3_relax_cmpbranch_inst32 (fragS * fragp)
if (s == NULL)
frag_addr = 0;
else
- symbol_address = (addressT) symbol_get_frag (s)->fr_address;
+ symbol_address = symbol_get_frag (s)->fr_address;
inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN_SIZE);
offset = (inst_value & 0x1)
diff --git a/gas/config/tc-score.h b/gas/config/tc-score.h
index 92776c8..e02ff8f 100644
--- a/gas/config/tc-score.h
+++ b/gas/config/tc-score.h
@@ -30,7 +30,7 @@
#define DIFF_EXPR_OK
#define RELOC_EXPANSION_POSSIBLE
#define MAX_RELOC_EXPANSION 2
-#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 4)
#define md_undefined_symbol(name) NULL
diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c
index c822144..7b6b685 100644
--- a/gas/config/tc-score7.c
+++ b/gas/config/tc-score7.c
@@ -90,7 +90,7 @@ static void s7_do_lw_pic (char *);
#define s7_GP 28
#define s7_PIC_CALL_REG 29
#define s7_MAX_LITERAL_POOL_SIZE 1024
-#define s7_FAIL 0x80000000
+#define s7_FAIL -2147483648
#define s7_SUCCESS 0
#define s7_INSN_SIZE 4
#define s7_INSN16_SIZE 2
@@ -1102,7 +1102,7 @@ s7_end_of_line (char *str)
s7_skip_whitespace (str);
if (*str != '\0')
{
- retval = (int) s7_FAIL;
+ retval = s7_FAIL;
if (!s7_inst.error)
s7_inst.error = s7_BAD_GARBAGE;
@@ -1121,7 +1121,7 @@ s7_score_reg_parse (char **ccp, htab_t htab)
p = start;
if (!ISALPHA (*p) || !is_name_beginner (*p))
- return (int) s7_FAIL;
+ return s7_FAIL;
c = *p++;
@@ -1129,7 +1129,7 @@ s7_score_reg_parse (char **ccp, htab_t htab)
c = *p++;
*--p = 0;
- reg = (struct s7_reg_entry *) str_hash_find (htab, start);
+ reg = str_hash_find (htab, start);
*p = c;
if (reg)
@@ -1137,7 +1137,7 @@ s7_score_reg_parse (char **ccp, htab_t htab)
*ccp = p;
return reg->number;
}
- return (int) s7_FAIL;
+ return s7_FAIL;
}
/* If shift <= 0, only return reg. */
@@ -1145,10 +1145,10 @@ static int
s7_reg_required_here (char **str, int shift, enum s7_score_reg_type reg_type)
{
static char buff[s7_MAX_LITERAL_POOL_SIZE];
- int reg = (int) s7_FAIL;
+ int reg = s7_FAIL;
char *start = *str;
- if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[reg_type].htab)) != (int) s7_FAIL)
+ if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[reg_type].htab)) != s7_FAIL)
{
if (reg_type == s7_REG_TYPE_SCORE)
{
@@ -1193,18 +1193,18 @@ s7_skip_past_comma (char **str)
if (c == ',' && comma++)
{
s7_inst.error = s7_BAD_SKIP_COMMA;
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
if ((c == '\0') || (comma == 0))
{
s7_inst.error = s7_BAD_SKIP_COMMA;
- return (int) s7_FAIL;
+ return s7_FAIL;
}
*str = p;
- return comma ? s7_SUCCESS : (int) s7_FAIL;
+ return comma ? s7_SUCCESS : s7_FAIL;
}
static void
@@ -1212,12 +1212,12 @@ s7_do_rdrsrs (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
{
return;
}
@@ -1271,7 +1271,7 @@ s7_my_get_expression (expressionS * ep, char **str)
*str = input_line_pointer;
input_line_pointer = save_in;
s7_inst.error = _("illegal expression");
- return (int) s7_FAIL;
+ return s7_FAIL;
}
/* Get rid of any bignums now, so that we don't generate an error for which
we can't establish a line number later on. Big numbers are never valid
@@ -1284,7 +1284,7 @@ s7_my_get_expression (expressionS * ep, char **str)
s7_inst.error = _("invalid constant");
*str = input_line_pointer;
input_line_pointer = save_in;
- return (int) s7_FAIL;
+ return s7_FAIL;
}
if ((ep->X_add_symbol != NULL)
@@ -1300,7 +1300,7 @@ s7_my_get_expression (expressionS * ep, char **str)
s7_inst.error = s7_BAD_ARGS;
*str = input_line_pointer;
input_line_pointer = save_in;
- return (int) s7_FAIL;
+ return s7_FAIL;
}
*str = input_line_pointer;
@@ -1340,14 +1340,14 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
{
if (!(val >= -0x800 && val <= 0xfff))
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
else
{
if (!(val >= -2048 && val <= 2047))
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
@@ -1359,14 +1359,14 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
{
if (!(val >= -0x2000 && val <= 0x3fff))
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
else
{
if (!(val >= -8192 && val <= 8191))
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
@@ -1378,14 +1378,14 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
{
if (!(val >= -0x4000 && val <= 0x7fff))
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
else
{
if (!(val >= -16384 && val <= 16383))
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
@@ -1397,14 +1397,14 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
{
if (!(val >= -0x8000 && val <= 0xffff))
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
else
{
if (!(val >= -32768 && val <= 32767))
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
@@ -1416,14 +1416,14 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
{
if (!(val >= -0x7fff && val <= 0xffff && val != 0x8000))
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
else
{
if (!(val >= -32767 && val <= 32768))
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
@@ -1438,7 +1438,7 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
}
else
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
default:
@@ -1452,7 +1452,7 @@ s7_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
break;
}
- return (int) s7_FAIL;
+ return s7_FAIL;
}
static int
@@ -1483,18 +1483,18 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type)
if (*dataptr == '|') /* process PCE */
{
- if (s7_my_get_expression (&s7_inst.reloc.exp, &pp) == (int) s7_FAIL)
- return (int) s7_FAIL;
+ if (s7_my_get_expression (&s7_inst.reloc.exp, &pp) == s7_FAIL)
+ return s7_FAIL;
s7_end_of_line (pp);
if (s7_inst.error != 0)
- return (int) s7_FAIL; /* to ouptut_inst to printf out the error */
+ return s7_FAIL; /* to ouptut_inst to printf out the error */
*str = dataptr;
}
else /* process 16 bit */
{
- if (s7_my_get_expression (&s7_inst.reloc.exp, str) == (int) s7_FAIL)
+ if (s7_my_get_expression (&s7_inst.reloc.exp, str) == s7_FAIL)
{
- return (int) s7_FAIL;
+ return s7_FAIL;
}
dataptr = (char *) data_exp;
@@ -1546,7 +1546,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type)
|| ((*dataptr == '-') && (*(dataptr + 1) != '0'))))
{
s7_inst.error = s7_BAD_ARGS;
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
@@ -1564,7 +1564,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type)
|| (data_type == _IMM4)))
{
s7_inst.error = s7_BAD_ARGS;
- return (int) s7_FAIL;
+ return s7_FAIL;
}
if (s7_inst.reloc.exp.X_add_symbol)
@@ -1572,7 +1572,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type)
switch (data_type)
{
case _SIMM16_LA:
- return (int) s7_FAIL;
+ return s7_FAIL;
case _VALUE_HI16:
s7_inst.reloc.type = BFD_RELOC_HI16_S;
s7_inst.reloc.pc_rel = 0;
@@ -1607,7 +1607,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type)
if (data_type == _SIMM16_LA && s7_inst.reloc.exp.X_unsigned == 1)
{
value = s7_validate_immediate (s7_inst.reloc.exp.X_add_number, _SIMM16_LA_POS, hex_p);
- if (value == (int) s7_FAIL) /* for advance to check if this is ldis */
+ if (value == s7_FAIL) /* for advance to check if this is ldis */
if ((s7_inst.reloc.exp.X_add_number & 0xffff) == 0)
{
s7_inst.instruction |= 0x8000000;
@@ -1620,7 +1620,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type)
value = s7_validate_immediate (s7_inst.reloc.exp.X_add_number, data_type, hex_p);
}
- if (value == (int) s7_FAIL)
+ if (value == s7_FAIL)
{
if ((data_type != _SIMM14_NEG) && (data_type != _SIMM16_NEG) && (data_type != _IMM16_NEG))
{
@@ -1638,7 +1638,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type)
}
s7_inst.error = s7_err_msg;
- return (int) s7_FAIL;
+ return s7_FAIL;
}
if ((s7_score_df_range[data_type].range[0] != 0) || (data_type == _IMM5_RANGE_8_31))
@@ -1673,7 +1673,7 @@ s7_data_op2 (char **str, int shift, enum score_data_type data_type)
&& (((s7_inst.instruction >> 20) & 0x1F) != 0x1f))
{
s7_inst.error = _("invalid constant: bit expression not defined");
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
@@ -1687,10 +1687,10 @@ s7_do_rdsi16 (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_data_op2 (&str, 1, _SIMM16) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_data_op2 (&str, 1, _SIMM16) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
return;
/* ldi. */
@@ -1720,9 +1720,9 @@ s7_do_sub_rdsi16 (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_data_op2 (&str, 1, _SIMM16_NEG) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_data_op2 (&str, 1, _SIMM16_NEG) != s7_FAIL)
s7_end_of_line (str);
}
@@ -1734,10 +1734,10 @@ s7_do_rdrssi14 (char *str) /* -(2^13)~((2^13)-1) */
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL)
s7_data_op2 (&str, 1, _SIMM14);
}
@@ -1748,11 +1748,11 @@ s7_do_sub_rdrssi14 (char *str) /* -(2^13)~((2^13)-1) */
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_data_op2 (&str, 1, _SIMM14_NEG) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_data_op2 (&str, 1, _SIMM14_NEG) != s7_FAIL)
s7_end_of_line (str);
}
@@ -1763,12 +1763,12 @@ s7_do_rdrsi5 (char *str) /* 0~((2^14)-1) */
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_data_op2 (&str, 10, _IMM5) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_data_op2 (&str, 10, _IMM5) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
return;
if ((((s7_inst.instruction >> 20) & 0x1f) == ((s7_inst.instruction >> 15) & 0x1f))
@@ -1788,11 +1788,11 @@ s7_do_rdrsi14 (char *str) /* 0 ~ ((2^14)-1) */
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_data_op2 (&str, 1, _IMM14) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_data_op2 (&str, 1, _IMM14) != s7_FAIL)
s7_end_of_line (str);
}
@@ -1803,10 +1803,10 @@ s7_do_xrsi5 (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_data_op2 (&str, 10, _IMM5) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_data_op2 (&str, 10, _IMM5) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
return;
if ((s7_inst.relax_inst != 0x8000) && (((s7_inst.instruction >> 15) & 0x10) == 0))
@@ -1825,10 +1825,10 @@ s7_do_rdi16 (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_data_op2 (&str, 1, _IMM16) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_data_op2 (&str, 1, _IMM16) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
return;
}
@@ -1838,8 +1838,8 @@ s7_do_macro_rdi32hi (char *str)
s7_skip_whitespace (str);
/* Do not handle s7_end_of_line(). */
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL)
s7_data_op2 (&str, 1, _VALUE_HI16);
}
@@ -1849,8 +1849,8 @@ s7_do_macro_rdi32lo (char *str)
s7_skip_whitespace (str);
/* Do not handle s7_end_of_line(). */
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL)
s7_data_op2 (&str, 1, _VALUE_LO16);
}
@@ -1861,9 +1861,9 @@ s7_do_rdi16_pic (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_data_op2 (&str, 1, _IMM16_pic) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_data_op2 (&str, 1, _IMM16_pic) != s7_FAIL)
s7_end_of_line (str);
}
@@ -1874,9 +1874,9 @@ s7_do_addi_s_pic (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_data_op2 (&str, 1, _SIMM16_pic) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_data_op2 (&str, 1, _SIMM16_pic) != s7_FAIL)
s7_end_of_line (str);
}
@@ -1887,9 +1887,9 @@ s7_do_addi_u_pic (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_data_op2 (&str, 1, _IMM16_LO16_pic) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_data_op2 (&str, 1, _IMM16_LO16_pic) != s7_FAIL)
s7_end_of_line (str);
}
@@ -1900,7 +1900,7 @@ s7_do_rd (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL)
s7_end_of_line (str);
}
@@ -1909,8 +1909,8 @@ s7_do_rs (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
return;
if ((s7_inst.relax_inst != 0x8000) && (((s7_inst.instruction >> 15) & 0x10) == 0))
@@ -1927,7 +1927,7 @@ s7_do_i15 (char *str)
{
s7_skip_whitespace (str);
- if (s7_data_op2 (&str, 10, _IMM15) != (int) s7_FAIL)
+ if (s7_data_op2 (&str, 10, _IMM15) != s7_FAIL)
s7_end_of_line (str);
}
@@ -1936,7 +1936,7 @@ s7_do_xi5x (char *str)
{
s7_skip_whitespace (str);
- if (s7_data_op2 (&str, 15, _IMM5) == (int) s7_FAIL || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_data_op2 (&str, 15, _IMM5) == s7_FAIL || s7_end_of_line (str) == s7_FAIL)
return;
if (s7_inst.relax_inst != 0x8000)
@@ -1951,10 +1951,10 @@ s7_do_rdrs (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
return;
if (s7_inst.relax_inst != 0x8000)
@@ -2005,9 +2005,9 @@ s7_do_rdcrs (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) != s7_FAIL)
s7_end_of_line (str);
}
@@ -2021,15 +2021,15 @@ s7_do_rdsrs (char *str)
/* mfsr */
if ((s7_inst.instruction & 0xff) == 0x50)
{
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE_SR) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE_SR) != s7_FAIL)
s7_end_of_line (str);
}
else
{
- if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL)
s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE_SR);
}
}
@@ -2041,10 +2041,10 @@ s7_do_rdxrs (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
return;
if ((s7_inst.relax_inst != 0x8000) && (((s7_inst.instruction >> 10) & 0x10) == 0)
@@ -2063,10 +2063,10 @@ s7_do_rsrs (char *str)
{
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
return;
if ((s7_inst.relax_inst != 0x8000) && (((s7_inst.instruction >> 20) & 0x1f) == 3)
@@ -2087,23 +2087,23 @@ s7_do_ceinst (char *str)
strbak = str;
s7_skip_whitespace (str);
- if (s7_data_op2 (&str, 20, _IMM5) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_data_op2 (&str, 5, _IMM5) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_data_op2 (&str, 0, _IMM5) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_data_op2 (&str, 20, _IMM5) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_data_op2 (&str, 5, _IMM5) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_data_op2 (&str, 0, _IMM5) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
{
return;
}
else
{
str = strbak;
- if (s7_data_op2 (&str, 0, _IMM25) == (int) s7_FAIL)
+ if (s7_data_op2 (&str, 0, _IMM25) == s7_FAIL)
return;
}
}
@@ -2115,7 +2115,7 @@ s7_reglow_required_here (char **str, int shift)
int reg;
char *start = *str;
- if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[s7_REG_TYPE_SCORE].htab)) != (int) s7_FAIL)
+ if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[s7_REG_TYPE_SCORE].htab)) != s7_FAIL)
{
if ((reg == 1) && (s7_nor1 == 1) && (s7_inst.bwarn == 0))
{
@@ -2135,7 +2135,7 @@ s7_reglow_required_here (char **str, int shift)
*str = start;
sprintf (buff, _("low register(r0-r15)expected, not '%.100s'"), start);
s7_inst.error = buff;
- return (int) s7_FAIL;
+ return s7_FAIL;
}
/* Handle addc!/add!/and!/cmp!/neg!/not!/or!/sll!/srl!/sra!/xor!/sub!. */
@@ -2145,10 +2145,10 @@ s7_do16_rdrs (char *str)
{
s7_skip_whitespace (str);
- if (s7_reglow_required_here (&str, 8) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reglow_required_here (&str, 4) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reglow_required_here (&str, 8) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reglow_required_here (&str, 4) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
{
return;
}
@@ -2185,8 +2185,8 @@ s7_do16_rs (char *str)
s7_skip_whitespace (str);
- if ((rd = s7_reglow_required_here (&str, 4)) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if ((rd = s7_reglow_required_here (&str, 4)) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
{
return;
}
@@ -2204,7 +2204,7 @@ s7_do16_xrs (char *str)
{
s7_skip_whitespace (str);
- if (s7_reglow_required_here (&str, 4) == (int) s7_FAIL || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reglow_required_here (&str, 4) == s7_FAIL || s7_end_of_line (str) == s7_FAIL)
{
return;
}
@@ -2223,7 +2223,7 @@ s7_reghigh_required_here (char **str, int shift)
int reg;
char *start = *str;
- if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[s7_REG_TYPE_SCORE].htab)) != (int) s7_FAIL)
+ if ((reg = s7_score_reg_parse (str, s7_all_reg_maps[s7_REG_TYPE_SCORE].htab)) != s7_FAIL)
{
if (15 < reg && reg < 32)
{
@@ -2237,7 +2237,7 @@ s7_reghigh_required_here (char **str, int shift)
*str = start;
sprintf (buff, _("high register(r16-r31)expected, not '%.100s'"), start);
s7_inst.error = buff;
- return (int) s7_FAIL;
+ return s7_FAIL;
}
/* Handle mhfl!. */
@@ -2247,10 +2247,10 @@ s7_do16_hrdrs (char *str)
{
s7_skip_whitespace (str);
- if (s7_reghigh_required_here (&str, 8) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_reglow_required_here (&str, 4) != (int) s7_FAIL
- && s7_end_of_line (str) != (int) s7_FAIL)
+ if (s7_reghigh_required_here (&str, 8) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_reglow_required_here (&str, 4) != s7_FAIL
+ && s7_end_of_line (str) != s7_FAIL)
{
s7_inst.relax_inst |= ((((s7_inst.instruction >> 8) & 0xf) | 0x10) << 20)
| (((s7_inst.instruction >> 4) & 0xf) << 15) | (0xf << 10);
@@ -2265,10 +2265,10 @@ s7_do16_rdhrs (char *str)
{
s7_skip_whitespace (str);
- if (s7_reglow_required_here (&str, 8) != (int) s7_FAIL
- && s7_skip_past_comma (&str) != (int) s7_FAIL
- && s7_reghigh_required_here (&str, 4) != (int) s7_FAIL
- && s7_end_of_line (str) != (int) s7_FAIL)
+ if (s7_reglow_required_here (&str, 8) != s7_FAIL
+ && s7_skip_past_comma (&str) != s7_FAIL
+ && s7_reghigh_required_here (&str, 4) != s7_FAIL
+ && s7_end_of_line (str) != s7_FAIL)
{
s7_inst.relax_inst |= (((s7_inst.instruction >> 8) & 0xf) << 20)
| ((((s7_inst.instruction >> 4) & 0xf) | 0x10) << 15) | (0xf << 10);
@@ -2321,8 +2321,7 @@ s7_dependency_type_from_insn (char *insn_name)
const struct s7_insn_to_dependency *tmp;
strcpy (name, insn_name);
- tmp = (const struct s7_insn_to_dependency *)
- str_hash_find (s7_dependency_insn_hsh, name);
+ tmp = str_hash_find (s7_dependency_insn_hsh, name);
if (tmp)
return tmp->type;
@@ -2545,7 +2544,7 @@ s7_handle_dependency (struct s7_score_it *theinst)
static enum insn_class
s7_get_insn_class_from_type (enum score_insn_type type)
{
- enum insn_class retval = (int) s7_FAIL;
+ enum insn_class retval = s7_FAIL;
switch (type)
{
@@ -2790,8 +2789,7 @@ s7_parse_16_32_inst (char *insnstr, bool gen_frag_p)
c = *p;
*p = '\0';
- opcode = (const struct s7_asm_opcode *) str_hash_find (s7_score_ops_hsh,
- operator);
+ opcode = str_hash_find (s7_score_ops_hsh, operator);
*p = c;
memset (&s7_inst, '\0', sizeof (s7_inst));
@@ -2828,7 +2826,7 @@ s7_append_insn (char *str, bool gen_frag_p)
if (s7_inst.error)
{
- retval = (int) s7_FAIL;
+ retval = s7_FAIL;
as_bad (_("%s -- `%s'"), s7_inst.error, s7_inst.str);
s7_inst.error = NULL;
}
@@ -2849,10 +2847,10 @@ s7_do16_mv_rdrs (char *str)
backupstr = str;
s7_skip_whitespace (str);
- if ((reg_rd = s7_reg_required_here (&str, 8, s7_REG_TYPE_SCORE)) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || (reg_rs = s7_reg_required_here (&str, 4, s7_REG_TYPE_SCORE)) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if ((reg_rd = s7_reg_required_here (&str, 8, s7_REG_TYPE_SCORE)) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || (reg_rs = s7_reg_required_here (&str, 4, s7_REG_TYPE_SCORE)) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
{
return;
}
@@ -2872,7 +2870,7 @@ s7_do16_mv_rdrs (char *str)
char append_str[s7_MAX_LITERAL_POOL_SIZE];
sprintf (append_str, "mlfh! %s", backupstr);
- if (s7_append_insn (append_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (append_str, true) == s7_FAIL)
return;
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
s7_inst.bwarn = -1;
@@ -2891,7 +2889,7 @@ s7_do16_mv_rdrs (char *str)
char append_str[s7_MAX_LITERAL_POOL_SIZE];
sprintf (append_str, "mhfl! %s", backupstr);
- if (s7_append_insn (append_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (append_str, true) == s7_FAIL)
return;
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
@@ -2906,10 +2904,10 @@ s7_do16_rdi4 (char *str)
{
s7_skip_whitespace (str);
- if (s7_reglow_required_here (&str, 8) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_data_op2 (&str, 3, _IMM4) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reglow_required_here (&str, 8) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_data_op2 (&str, 3, _IMM4) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
{
return;
}
@@ -2949,10 +2947,10 @@ s7_do16_rdi5 (char *str)
{
s7_skip_whitespace (str);
- if (s7_reglow_required_here (&str, 8) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_data_op2 (&str, 3, _IMM5) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_reglow_required_here (&str, 8) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_data_op2 (&str, 3, _IMM5) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
return;
else
{
@@ -2969,7 +2967,7 @@ s7_do16_xi5 (char *str)
{
s7_skip_whitespace (str);
- if (s7_data_op2 (&str, 3, _IMM5) == (int) s7_FAIL || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_data_op2 (&str, 3, _IMM5) == s7_FAIL || s7_end_of_line (str) == s7_FAIL)
return;
else
{
@@ -2989,7 +2987,7 @@ s7_validate_immediate_align (int val, unsigned int data_type)
if (val % 2)
{
s7_inst.error = _("address offset must be half word alignment");
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
else if ((data_type == _IMM5_RSHIFT_2) || (data_type == _IMM10_RSHIFT_2))
@@ -2997,7 +2995,7 @@ s7_validate_immediate_align (int val, unsigned int data_type)
if (val % 4)
{
s7_inst.error = _("address offset must be word alignment");
- return (int) s7_FAIL;
+ return s7_FAIL;
}
}
@@ -3037,19 +3035,19 @@ s7_exp_ldst_offset (char **str, int shift, unsigned int data_type)
}
}
- if (s7_my_get_expression (&s7_inst.reloc.exp, str) == (int) s7_FAIL)
- return (int) s7_FAIL;
+ if (s7_my_get_expression (&s7_inst.reloc.exp, str) == s7_FAIL)
+ return s7_FAIL;
if (s7_inst.reloc.exp.X_op == O_constant)
{
/* Need to check the immediate align. */
int value = s7_validate_immediate_align (s7_inst.reloc.exp.X_add_number, data_type);
- if (value == (int) s7_FAIL)
- return (int) s7_FAIL;
+ if (value == s7_FAIL)
+ return s7_FAIL;
value = s7_validate_immediate (s7_inst.reloc.exp.X_add_number, data_type, hex_p);
- if (value == (int) s7_FAIL)
+ if (value == s7_FAIL)
{
if (data_type < 30)
sprintf (s7_err_msg,
@@ -3062,7 +3060,7 @@ s7_exp_ldst_offset (char **str, int shift, unsigned int data_type)
s7_score_df_range[data_type - 24].bits,
s7_score_df_range[data_type - 24].range[0], s7_score_df_range[data_type - 24].range[1]);
s7_inst.error = s7_err_msg;
- return (int) s7_FAIL;
+ return s7_FAIL;
}
if (data_type == _IMM5_RSHIFT_1)
@@ -3104,8 +3102,8 @@ s7_do_ldst_insn (char *str)
s7_skip_whitespace (str);
- if (((conflict_reg = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
- || (s7_skip_past_comma (&str) == (int) s7_FAIL))
+ if (((conflict_reg = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == s7_FAIL)
+ || (s7_skip_past_comma (&str) == s7_FAIL))
return;
/* ld/sw rD, [rA, simm15] ld/sw rD, [rA]+, simm12 ld/sw rD, [rA, simm12]+. */
@@ -3114,7 +3112,7 @@ s7_do_ldst_insn (char *str)
str++;
s7_skip_whitespace (str);
- if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
+ if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == s7_FAIL)
return;
/* Conflicts can occur on stores as well as loads. */
@@ -3132,8 +3130,8 @@ s7_do_ldst_insn (char *str)
/* ld/sw rD, [rA]+, simm12. */
if (s7_skip_past_comma (&str) == s7_SUCCESS)
{
- if ((s7_exp_ldst_offset (&str, 3, _SIMM12) == (int) s7_FAIL)
- || (s7_end_of_line (str) == (int) s7_FAIL))
+ if ((s7_exp_ldst_offset (&str, 3, _SIMM12) == s7_FAIL)
+ || (s7_end_of_line (str) == s7_FAIL))
return;
if (conflict_reg)
@@ -3185,7 +3183,7 @@ s7_do_ldst_insn (char *str)
else
{
s7_SET_INSN_ERROR (NULL);
- if (s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_end_of_line (str) == s7_FAIL)
{
return;
}
@@ -3204,7 +3202,7 @@ s7_do_ldst_insn (char *str)
/* ld/sw rD, [rA] convert to ld/sw rD, [rA, simm15]. */
else
{
- if (s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_end_of_line (str) == s7_FAIL)
return;
ldst_idx = s7_inst.instruction & OPC_PSEUDOLDST_MASK;
@@ -3261,13 +3259,13 @@ s7_do_ldst_insn (char *str)
/* ld/sw rD, [rA, simm15] ld/sw rD, [rA, simm12]+. */
else
{
- if (s7_skip_past_comma (&str) == (int) s7_FAIL)
+ if (s7_skip_past_comma (&str) == s7_FAIL)
{
s7_inst.error = _("pre-indexed expression expected");
return;
}
- if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL)
+ if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL)
return;
s7_skip_whitespace (str);
@@ -3299,7 +3297,7 @@ s7_do_ldst_insn (char *str)
}
}
- if (s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_end_of_line (str) == s7_FAIL)
return;
if (s7_inst.reloc.exp.X_op == O_constant)
@@ -3338,7 +3336,7 @@ s7_do_ldst_insn (char *str)
}
value = s7_validate_immediate (s7_inst.reloc.exp.X_add_number, data_type, hex_p);
- if (value == (int) s7_FAIL)
+ if (value == s7_FAIL)
{
if (data_type < 30)
sprintf (s7_err_msg,
@@ -3608,7 +3606,7 @@ s7_do_cache (char *str)
{
s7_skip_whitespace (str);
- if ((s7_data_op2 (&str, 20, _IMM5) == (int) s7_FAIL) || (s7_skip_past_comma (&str) == (int) s7_FAIL))
+ if ((s7_data_op2 (&str, 20, _IMM5) == s7_FAIL) || (s7_skip_past_comma (&str) == s7_FAIL))
{
return;
}
@@ -3625,13 +3623,13 @@ s7_do_cache (char *str)
str++;
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL)
return;
s7_skip_whitespace (str);
/* cache op, [rA] */
- if (s7_skip_past_comma (&str) == (int) s7_FAIL)
+ if (s7_skip_past_comma (&str) == s7_FAIL)
{
s7_SET_INSN_ERROR (NULL);
if (*str != ']')
@@ -3644,7 +3642,7 @@ s7_do_cache (char *str)
/* cache op, [rA, simm15] */
else
{
- if (s7_exp_ldst_offset (&str, 0, _SIMM15) == (int) s7_FAIL)
+ if (s7_exp_ldst_offset (&str, 0, _SIMM15) == s7_FAIL)
{
return;
}
@@ -3657,7 +3655,7 @@ s7_do_cache (char *str)
}
}
- if (s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_end_of_line (str) == s7_FAIL)
return;
}
else
@@ -3674,21 +3672,21 @@ s7_do_crdcrscrsimm5 (char *str)
strbak = str;
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE_CR) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL
- || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE_CR) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE_CR) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL
+ || s7_reg_required_here (&str, 10, s7_REG_TYPE_SCORE_CR) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL)
{
str = strbak;
/* cop1 cop_code20. */
- if (s7_data_op2 (&str, 5, _IMM20) == (int) s7_FAIL)
+ if (s7_data_op2 (&str, 5, _IMM20) == s7_FAIL)
return;
}
else
{
- if (s7_data_op2 (&str, 5, _IMM5) == (int) s7_FAIL)
+ if (s7_data_op2 (&str, 5, _IMM5) == s7_FAIL)
return;
}
@@ -3701,8 +3699,8 @@ s7_do_ldst_cop (char *str)
{
s7_skip_whitespace (str);
- if ((s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) == (int) s7_FAIL)
- || (s7_skip_past_comma (&str) == (int) s7_FAIL))
+ if ((s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE_CR) == s7_FAIL)
+ || (s7_skip_past_comma (&str) == s7_FAIL))
return;
if (*str == '[')
@@ -3710,14 +3708,14 @@ s7_do_ldst_cop (char *str)
str++;
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL)
return;
s7_skip_whitespace (str);
if (*str++ != ']')
{
- if (s7_exp_ldst_offset (&str, 5, _IMM10_RSHIFT_2) == (int) s7_FAIL)
+ if (s7_exp_ldst_offset (&str, 5, _IMM10_RSHIFT_2) == s7_FAIL)
return;
s7_skip_whitespace (str);
@@ -3739,7 +3737,7 @@ s7_do16_ldst_insn (char *str)
{
s7_skip_whitespace (str);
- if ((s7_reglow_required_here (&str, 8) == (int) s7_FAIL) || (s7_skip_past_comma (&str) == (int) s7_FAIL))
+ if ((s7_reglow_required_here (&str, 8) == s7_FAIL) || (s7_skip_past_comma (&str) == s7_FAIL))
return;
if (*str == '[')
@@ -3749,13 +3747,13 @@ s7_do16_ldst_insn (char *str)
str++;
s7_skip_whitespace (str);
- if ((reg = s7_reglow_required_here (&str, 4)) == (int) s7_FAIL)
+ if ((reg = s7_reglow_required_here (&str, 4)) == s7_FAIL)
return;
s7_skip_whitespace (str);
if (*str++ == ']')
{
- if (s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_end_of_line (str) == s7_FAIL)
return;
else
{
@@ -3784,13 +3782,13 @@ s7_do16_ldst_imm_insn (char *str)
int reg_rd;
char *dataptr = NULL, *pp = NULL;
int cnt = 0;
- int assign_data = (int) s7_FAIL;
+ int assign_data = s7_FAIL;
unsigned int ldst_func;
s7_skip_whitespace (str);
- if (((reg_rd = s7_reglow_required_here (&str, 8)) == (int) s7_FAIL)
- || (s7_skip_past_comma (&str) == (int) s7_FAIL))
+ if (((reg_rd = s7_reglow_required_here (&str, 8)) == s7_FAIL)
+ || (s7_skip_past_comma (&str) == s7_FAIL))
return;
s7_skip_whitespace (str);
@@ -3818,7 +3816,7 @@ s7_do16_ldst_imm_insn (char *str)
else
assign_data = s7_exp_ldst_offset (&pp, 3, _IMM5);
- if ((assign_data == (int) s7_FAIL) || (s7_end_of_line (pp) == (int) s7_FAIL))
+ if ((assign_data == s7_FAIL) || (s7_end_of_line (pp) == s7_FAIL))
return;
else
{
@@ -3857,8 +3855,8 @@ s7_do16_push_pop (char *str)
int H_bit_mask = 0;
s7_skip_whitespace (str);
- if (((reg_rd = s7_reg_required_here (&str, 8, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
- || (s7_skip_past_comma (&str) == (int) s7_FAIL))
+ if (((reg_rd = s7_reg_required_here (&str, 8, s7_REG_TYPE_SCORE)) == s7_FAIL)
+ || (s7_skip_past_comma (&str) == s7_FAIL))
return;
if (reg_rd >= 16)
@@ -3875,7 +3873,7 @@ s7_do16_push_pop (char *str)
str++;
s7_skip_whitespace (str);
- if ((reg = s7_reg_required_here (&str, 4, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
+ if ((reg = s7_reg_required_here (&str, 4, s7_REG_TYPE_SCORE)) == s7_FAIL)
return;
else if (reg > 7)
{
@@ -3886,7 +3884,7 @@ s7_do16_push_pop (char *str)
}
s7_skip_whitespace (str);
- if ((*str++ != ']') || (s7_end_of_line (str) == (int) s7_FAIL))
+ if ((*str++ != ']') || (s7_end_of_line (str) == s7_FAIL))
{
if (!s7_inst.error)
s7_inst.error = _("missing ]");
@@ -3950,7 +3948,7 @@ s7_do_ldst_unalign (char *str)
str++;
s7_skip_whitespace (str);
- if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == (int) s7_FAIL)
+ if (s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE) == s7_FAIL)
return;
if (*str++ == ']')
@@ -3967,14 +3965,14 @@ s7_do_ldst_unalign (char *str)
return;
}
- if (s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_end_of_line (str) == s7_FAIL)
return;
}
/* lcw/lce/scb/sce rD, [rA]+. */
else
{
- if (((conflict_reg = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
- || (s7_skip_past_comma (&str) == (int) s7_FAIL))
+ if (((conflict_reg = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == s7_FAIL)
+ || (s7_skip_past_comma (&str) == s7_FAIL))
{
return;
}
@@ -3985,7 +3983,7 @@ s7_do_ldst_unalign (char *str)
int reg;
s7_skip_whitespace (str);
- if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
+ if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == s7_FAIL)
{
return;
}
@@ -4012,7 +4010,7 @@ s7_do_ldst_unalign (char *str)
return;
}
- if (s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_end_of_line (str) == s7_FAIL)
return;
}
else
@@ -4042,8 +4040,8 @@ s7_do_ldst_atomic (char *str)
s7_skip_whitespace (str);
- if ((s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == (int) s7_FAIL)
- || (s7_skip_past_comma (&str) == (int) s7_FAIL))
+ if ((s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE) == s7_FAIL)
+ || (s7_skip_past_comma (&str) == s7_FAIL))
{
return;
}
@@ -4056,7 +4054,7 @@ s7_do_ldst_atomic (char *str)
int reg;
s7_skip_whitespace (str);
- if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
+ if ((reg = s7_reg_required_here (&str, 15, s7_REG_TYPE_SCORE)) == s7_FAIL)
{
return;
}
@@ -4201,7 +4199,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
For an external symbol: lw rD, <sym>($gp)
(BFD_RELOC_SCORE_GOT15 or BFD_RELOC_SCORE_CALL15) */
sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
- if (s7_append_insn (tmp, false) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, false) == s7_FAIL)
return;
if (reg_rd == s7_PIC_CALL_REG)
@@ -4215,7 +4213,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
s7_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it));
sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
- if (s7_append_insn (tmp, false) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, false) == s7_FAIL)
return;
memcpy (&var_insts[1], &s7_inst, sizeof (struct s7_score_it));
@@ -4225,7 +4223,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
{
/* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */
sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
- if (s7_append_insn (tmp, true) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, true) == s7_FAIL)
return;
/* Insn 2 */
@@ -4234,7 +4232,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
/* Fix part
For an external symbol: addi rD, <constant> */
sprintf (tmp, "addi r%d, %d", reg_rd, (int) add_number);
- if (s7_append_insn (tmp, false) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, false) == s7_FAIL)
return;
memcpy (&fix_insts[0], &s7_inst, sizeof (struct s7_score_it));
@@ -4243,7 +4241,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
For a local symbol: addi rD, <sym>+<constant> (BFD_RELOC_GOT_LO16) */
sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd,
S_GET_NAME (add_symbol), (int) add_number);
- if (s7_append_insn (tmp, false) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, false) == s7_FAIL)
return;
memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it));
@@ -4256,7 +4254,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
/* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */
sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
- if (s7_append_insn (tmp, true) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, true) == s7_FAIL)
return;
/* Insn 2 */
@@ -4265,7 +4263,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
/* Fix part
For an external symbol: ldis r1, HI%<constant> */
sprintf (tmp, "ldis r1, %d", hi);
- if (s7_append_insn (tmp, false) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, false) == s7_FAIL)
return;
memcpy (&fix_insts[0], &s7_inst, sizeof (struct s7_score_it));
@@ -4278,7 +4276,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
hi += 1;
}
sprintf (tmp, "ldis_pic r1, %d", hi);
- if (s7_append_insn (tmp, false) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, false) == s7_FAIL)
return;
memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it));
@@ -4290,7 +4288,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
/* Fix part
For an external symbol: ori r1, LO%<constant> */
sprintf (tmp, "ori r1, %d", lo);
- if (s7_append_insn (tmp, false) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, false) == s7_FAIL)
return;
memcpy (&fix_insts[0], &s7_inst, sizeof (struct s7_score_it));
@@ -4298,7 +4296,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
/* Var part
For a local symbol: addi r1, <sym>+LO%<constant> (BFD_RELOC_GOT_LO16) */
sprintf (tmp, "addi_u_pic r1, %s + %d", S_GET_NAME (add_symbol), lo);
- if (s7_append_insn (tmp, false) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, false) == s7_FAIL)
return;
memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it));
@@ -4306,7 +4304,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
/* Insn 4: add rD, rD, r1 */
sprintf (tmp, "add r%d, r%d, r1", reg_rd, reg_rd);
- if (s7_append_insn (tmp, true) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, true) == s7_FAIL)
return;
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
@@ -4324,8 +4322,8 @@ s7_do_macro_la_rdi32 (char *str)
int reg_rd;
s7_skip_whitespace (str);
- if ((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL)
+ if ((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL)
{
return;
}
@@ -4335,13 +4333,13 @@ s7_do_macro_la_rdi32 (char *str)
char *keep_data = str;
/* Check immediate value. */
- if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL)
+ if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL)
{
s7_inst.error = _("expression error");
return;
}
else if ((s7_inst.reloc.exp.X_add_symbol == NULL)
- && (s7_validate_immediate (s7_inst.reloc.exp.X_add_number, _IMM32, 0) == (int) s7_FAIL))
+ && (s7_validate_immediate (s7_inst.reloc.exp.X_add_number, _IMM32, 0) == s7_FAIL))
{
s7_inst.error = _("value not in range [0, 0xffffffff]");
return;
@@ -4351,7 +4349,7 @@ s7_do_macro_la_rdi32 (char *str)
str = keep_data;
/* la rd, simm16. */
- if (s7_data_op2 (&str, 1, _SIMM16_LA) != (int) s7_FAIL)
+ if (s7_data_op2 (&str, 1, _SIMM16_LA) != s7_FAIL)
{
s7_end_of_line (str);
return;
@@ -4361,8 +4359,8 @@ s7_do_macro_la_rdi32 (char *str)
{
s7_SET_INSN_ERROR (NULL);
str = keep_data;
- if ((s7_data_op2 (&str, 1, _VALUE_HI16) == (int) s7_FAIL)
- || (s7_end_of_line (str) == (int) s7_FAIL))
+ if ((s7_data_op2 (&str, 1, _VALUE_HI16) == s7_FAIL)
+ || (s7_end_of_line (str) == s7_FAIL))
{
return;
}
@@ -4371,11 +4369,11 @@ s7_do_macro_la_rdi32 (char *str)
if ((s7_score_pic == s7_NO_PIC) || (!s7_inst.reloc.exp.X_add_symbol))
{
sprintf (append_str, "ld_i32hi r%d, %s", reg_rd, keep_data);
- if (s7_append_insn (append_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (append_str, true) == s7_FAIL)
return;
sprintf (append_str, "ld_i32lo r%d, %s", reg_rd, keep_data);
- if (s7_append_insn (append_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (append_str, true) == s7_FAIL)
return;
}
else
@@ -4399,8 +4397,8 @@ s7_do_macro_li_rdi32 (char *str)
int reg_rd;
s7_skip_whitespace (str);
- if ((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == (int) s7_FAIL
- || s7_skip_past_comma (&str) == (int) s7_FAIL)
+ if ((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == s7_FAIL
+ || s7_skip_past_comma (&str) == s7_FAIL)
{
return;
}
@@ -4409,7 +4407,7 @@ s7_do_macro_li_rdi32 (char *str)
char *keep_data = str;
/* Check immediate value. */
- if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL)
+ if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL)
{
s7_inst.error = _("expression error");
return;
@@ -4425,7 +4423,7 @@ s7_do_macro_li_rdi32 (char *str)
str = keep_data;
/* li rd, simm16. */
- if (s7_data_op2 (&str, 1, _SIMM16_LA) != (int) s7_FAIL)
+ if (s7_data_op2 (&str, 1, _SIMM16_LA) != s7_FAIL)
{
s7_end_of_line (str);
return;
@@ -4437,8 +4435,8 @@ s7_do_macro_li_rdi32 (char *str)
str = keep_data;
- if ((s7_data_op2 (&str, 1, _VALUE_HI16) == (int) s7_FAIL)
- || (s7_end_of_line (str) == (int) s7_FAIL))
+ if ((s7_data_op2 (&str, 1, _VALUE_HI16) == s7_FAIL)
+ || (s7_end_of_line (str) == s7_FAIL))
{
return;
}
@@ -4451,12 +4449,12 @@ s7_do_macro_li_rdi32 (char *str)
{
sprintf (append_str, "ld_i32hi r%d, %s", reg_rd, keep_data);
- if (s7_append_insn (append_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (append_str, true) == s7_FAIL)
return;
else
{
sprintf (append_str, "ld_i32lo r%d, %s", reg_rd, keep_data);
- if (s7_append_insn (append_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (append_str, true) == s7_FAIL)
return;
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
@@ -4484,15 +4482,15 @@ s7_do_macro_mul_rdrsrs (char *str)
strcpy (append_str, str);
backupstr = append_str;
s7_skip_whitespace (backupstr);
- if (((reg_rd = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
- || (s7_skip_past_comma (&backupstr) == (int) s7_FAIL)
- || ((reg_rs1 = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL))
+ if (((reg_rd = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == s7_FAIL)
+ || (s7_skip_past_comma (&backupstr) == s7_FAIL)
+ || ((reg_rs1 = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == s7_FAIL))
{
s7_inst.error = s7_BAD_ARGS;
return;
}
- if (s7_skip_past_comma (&backupstr) == (int) s7_FAIL)
+ if (s7_skip_past_comma (&backupstr) == s7_FAIL)
{
/* rem/remu rA, rB is error format. */
if (strcmp (s7_inst.name, "rem") == 0 || strcmp (s7_inst.name, "remu") == 0)
@@ -4509,8 +4507,8 @@ s7_do_macro_mul_rdrsrs (char *str)
else
{
s7_SET_INSN_ERROR (NULL);
- if (((reg_rs2 = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
- || (s7_end_of_line (backupstr) == (int) s7_FAIL))
+ if (((reg_rs2 = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == s7_FAIL)
+ || (s7_end_of_line (backupstr) == s7_FAIL))
{
return;
}
@@ -4535,11 +4533,11 @@ s7_do_macro_mul_rdrsrs (char *str)
}
/* Output mul/mulu or div/divu or rem/remu. */
- if (s7_append_insn (append_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (append_str, true) == s7_FAIL)
return;
/* Output mfcel or mfceh. */
- if (s7_append_insn (append_str1, true) == (int) s7_FAIL)
+ if (s7_append_insn (append_str1, true) == s7_FAIL)
return;
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
@@ -4565,11 +4563,11 @@ s7_exp_macro_ldst_abs (char *str)
strcpy (verifystr, str);
backupstr = verifystr;
s7_skip_whitespace (backupstr);
- if ((reg_rd = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
+ if ((reg_rd = s7_reg_required_here (&backupstr, -1, s7_REG_TYPE_SCORE)) == s7_FAIL)
return;
tmp = backupstr;
- if (s7_skip_past_comma (&backupstr) == (int) s7_FAIL)
+ if (s7_skip_past_comma (&backupstr) == s7_FAIL)
return;
backupstr = tmp;
@@ -4663,7 +4661,7 @@ s7_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
For an external symbol: lw rD, <sym>($gp)
(BFD_RELOC_SCORE_GOT15) */
sprintf (tmp, "lw_pic r1, %s", S_GET_NAME (add_symbol));
- if (s7_append_insn (tmp, false) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, false) == s7_FAIL)
return;
memcpy (&fix_insts[0], &s7_inst, sizeof (struct s7_score_it));
@@ -4675,7 +4673,7 @@ s7_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
s7_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it));
sprintf (tmp, "addi_s_pic r1, %s", S_GET_NAME (add_symbol));
- if (s7_append_insn (tmp, false) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, false) == s7_FAIL)
return;
memcpy (&var_insts[1], &s7_inst, sizeof (struct s7_score_it));
@@ -4683,7 +4681,7 @@ s7_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
/* Insn 2 or Insn 3: lw/st rD, [r1, constant] */
sprintf (tmp, "%s r%d, [r1, %d]", insn_name, reg_rd, add_number);
- if (s7_append_insn (tmp, true) == (int) s7_FAIL)
+ if (s7_append_insn (tmp, true) == s7_FAIL)
return;
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
@@ -4719,10 +4717,10 @@ s7_do_macro_ldst_label (char *str)
backup_str = verifystr;
s7_skip_whitespace (backup_str);
- if ((reg_rd = s7_reg_required_here (&backup_str, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
+ if ((reg_rd = s7_reg_required_here (&backup_str, -1, s7_REG_TYPE_SCORE)) == s7_FAIL)
return;
- if (s7_skip_past_comma (&backup_str) == (int) s7_FAIL)
+ if (s7_skip_past_comma (&backup_str) == s7_FAIL)
return;
label_str = backup_str;
@@ -4739,18 +4737,18 @@ s7_do_macro_ldst_label (char *str)
absolute_value = backup_str;
s7_inst.type = Rd_rvalueRs_SI15;
- if (s7_my_get_expression (&s7_inst.reloc.exp, &backup_str) == (int) s7_FAIL)
+ if (s7_my_get_expression (&s7_inst.reloc.exp, &backup_str) == s7_FAIL)
{
s7_inst.error = _("expression error");
return;
}
else if ((s7_inst.reloc.exp.X_add_symbol == NULL)
- && (s7_validate_immediate (s7_inst.reloc.exp.X_add_number, _VALUE, 0) == (int) s7_FAIL))
+ && (s7_validate_immediate (s7_inst.reloc.exp.X_add_number, _VALUE, 0) == s7_FAIL))
{
s7_inst.error = _("value not in range [0, 0x7fffffff]");
return;
}
- else if (s7_end_of_line (backup_str) == (int) s7_FAIL)
+ else if (s7_end_of_line (backup_str) == s7_FAIL)
{
s7_inst.error = _("end on line error");
return;
@@ -4768,8 +4766,8 @@ s7_do_macro_ldst_label (char *str)
/* Ld/st rD, label. */
s7_inst.type = Rd_rvalueRs_SI15;
backup_str = absolute_value;
- if ((s7_data_op2 (&backup_str, 1, _GP_IMM15) == (int) s7_FAIL)
- || (s7_end_of_line (backup_str) == (int) s7_FAIL))
+ if ((s7_data_op2 (&backup_str, 1, _GP_IMM15) == s7_FAIL)
+ || (s7_end_of_line (backup_str) == s7_FAIL))
{
return;
}
@@ -4827,7 +4825,7 @@ s7_do_macro_ldst_label (char *str)
ld/st rd, [r1, 0] */
for (i = 0; i < 3; i++)
{
- if (s7_append_insn (append_str[i], false) == (int) s7_FAIL)
+ if (s7_append_insn (append_str[i], false) == s7_FAIL)
return;
memcpy (&inst_expand[i], &s7_inst, sizeof (struct s7_score_it));
@@ -4905,10 +4903,10 @@ s7_do_lw_pic (char *str)
int reg_rd;
s7_skip_whitespace (str);
- if (((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
- || (s7_skip_past_comma (&str) == (int) s7_FAIL)
- || (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL)
- || (s7_end_of_line (str) == (int) s7_FAIL))
+ if (((reg_rd = s7_reg_required_here (&str, 20, s7_REG_TYPE_SCORE)) == s7_FAIL)
+ || (s7_skip_past_comma (&str) == s7_FAIL)
+ || (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL)
+ || (s7_end_of_line (str) == s7_FAIL))
{
return;
}
@@ -4942,7 +4940,7 @@ s7_do_empty (char *str)
return;
}
}
- if (s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_end_of_line (str) == s7_FAIL)
return;
if (s7_inst.relax_inst != 0x8000)
@@ -4964,8 +4962,8 @@ s7_do_jump (char *str)
char *save_in;
s7_skip_whitespace (str);
- if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
return;
if (s7_inst.reloc.exp.X_add_symbol == 0)
@@ -4992,8 +4990,8 @@ static void
s7_do16_jump (char *str)
{
s7_skip_whitespace (str);
- if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
{
return;
}
@@ -5018,8 +5016,8 @@ s7_do_branch (char *str)
{
unsigned long abs_value = 0;
- if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL)
+ if (s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL)
{
return;
}
@@ -5057,8 +5055,8 @@ s7_do_branch (char *str)
static void
s7_do16_branch (char *str)
{
- if ((s7_my_get_expression (&s7_inst.reloc.exp, &str) == (int) s7_FAIL
- || s7_end_of_line (str) == (int) s7_FAIL))
+ if ((s7_my_get_expression (&s7_inst.reloc.exp, &str) == s7_FAIL
+ || s7_end_of_line (str) == s7_FAIL))
{
;
}
@@ -5132,14 +5130,13 @@ static valueT
s7_md_chars_to_number (char *buf, int n)
{
valueT result = 0;
- unsigned char *where = (unsigned char *) buf;
if (target_big_endian)
{
while (n--)
{
result <<= 8;
- result |= (*where++ & 255);
+ result |= (*buf++ & 255);
}
}
else
@@ -5147,7 +5144,7 @@ s7_md_chars_to_number (char *buf, int n)
while (n--)
{
result <<= 8;
- result |= (where[n] & 255);
+ result |= (buf[n] & 255);
}
}
@@ -5254,7 +5251,7 @@ s7_b32_relax_to_b16 (fragS * fragp)
if (s == NULL)
frag_addr = 0;
else
- symbol_address = (addressT) symbol_get_frag (s)->fr_address;
+ symbol_address = symbol_get_frag (s)->fr_address;
value = s7_md_chars_to_number (fragp->fr_literal, s7_INSN_SIZE);
@@ -5393,7 +5390,7 @@ s7_s_change_sec (int sec)
switch (sec)
{
case 'r':
- seg = subseg_new (s7_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ());
+ seg = subseg_new (s7_RDATA_SECTION_NAME, get_absolute_expression ());
bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY
| SEC_RELOC | SEC_DATA));
if (strcmp (TARGET_OS, "elf") != 0)
@@ -5401,7 +5398,7 @@ s7_s_change_sec (int sec)
demand_empty_rest_of_line ();
break;
case 's':
- seg = subseg_new (".sdata", (subsegT) get_absolute_expression ());
+ seg = subseg_new (".sdata", get_absolute_expression ());
bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_RELOC
| SEC_DATA | SEC_SMALL_DATA));
if (strcmp (TARGET_OS, "elf") != 0)
@@ -5443,7 +5440,7 @@ s7_get_symbol (void)
symbolS *p;
c = get_symbol_name (&name);
- p = (symbolS *) symbol_find_or_make (name);
+ p = symbol_find_or_make (name);
(void) restore_line_pointer (c);
return p;
}
@@ -5657,13 +5654,13 @@ s7_s_score_end (int x ATTRIBUTE_UNUSED)
exp.X_add_number = 0;
emit_expr (&exp, 4);
fragp = frag_more (7 * 4);
- s7_number_to_chars (fragp, (valueT) s7_cur_proc_ptr->reg_mask, 4);
- s7_number_to_chars (fragp + 4, (valueT) s7_cur_proc_ptr->reg_offset, 4);
- s7_number_to_chars (fragp + 8, (valueT) s7_cur_proc_ptr->fpreg_mask, 4);
- s7_number_to_chars (fragp + 12, (valueT) s7_cur_proc_ptr->leaf, 4);
- s7_number_to_chars (fragp + 16, (valueT) s7_cur_proc_ptr->frame_offset, 4);
- s7_number_to_chars (fragp + 20, (valueT) s7_cur_proc_ptr->frame_reg, 4);
- s7_number_to_chars (fragp + 24, (valueT) s7_cur_proc_ptr->pc_reg, 4);
+ s7_number_to_chars (fragp, s7_cur_proc_ptr->reg_mask, 4);
+ s7_number_to_chars (fragp + 4, s7_cur_proc_ptr->reg_offset, 4);
+ s7_number_to_chars (fragp + 8, s7_cur_proc_ptr->fpreg_mask, 4);
+ s7_number_to_chars (fragp + 12, s7_cur_proc_ptr->leaf, 4);
+ s7_number_to_chars (fragp + 16, s7_cur_proc_ptr->frame_offset, 4);
+ s7_number_to_chars (fragp + 20, s7_cur_proc_ptr->frame_reg, 4);
+ s7_number_to_chars (fragp + 24, s7_cur_proc_ptr->pc_reg, 4);
subseg_set (saved_seg, saved_subseg);
}
@@ -5681,7 +5678,7 @@ s7_s_score_set (int x ATTRIBUTE_UNUSED)
while (!is_end_of_stmt (*input_line_pointer))
{
- name[i] = (char) * input_line_pointer;
+ name[i] = *input_line_pointer;
i++;
++input_line_pointer;
}
@@ -5749,21 +5746,21 @@ s7_s_score_cpload (int ignore ATTRIBUTE_UNUSED)
return;
}
- if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
+ if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == s7_FAIL)
return;
demand_empty_rest_of_line ();
sprintf (insn_str, "ld_i32hi r%d, %s", s7_GP, GP_DISP_LABEL);
- if (s7_append_insn (insn_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (insn_str, true) == s7_FAIL)
return;
sprintf (insn_str, "ld_i32lo r%d, %s", s7_GP, GP_DISP_LABEL);
- if (s7_append_insn (insn_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (insn_str, true) == s7_FAIL)
return;
sprintf (insn_str, "add r%d, r%d, r%d", s7_GP, s7_GP, reg);
- if (s7_append_insn (insn_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (insn_str, true) == s7_FAIL)
return;
}
@@ -5785,8 +5782,8 @@ s7_s_score_cprestore (int ignore ATTRIBUTE_UNUSED)
return;
}
- if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL
- || s7_skip_past_comma (&input_line_pointer) == (int) s7_FAIL)
+ if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == s7_FAIL
+ || s7_skip_past_comma (&input_line_pointer) == s7_FAIL)
{
return;
}
@@ -5796,7 +5793,7 @@ s7_s_score_cprestore (int ignore ATTRIBUTE_UNUSED)
if (cprestore_offset <= 0x3fff)
{
sprintf (insn_str, "sw r%d, [r%d, %d]", s7_GP, reg, cprestore_offset);
- if (s7_append_insn (insn_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (insn_str, true) == s7_FAIL)
return;
}
else
@@ -5807,15 +5804,15 @@ s7_s_score_cprestore (int ignore ATTRIBUTE_UNUSED)
s7_nor1 = 0;
sprintf (insn_str, "li r1, %d", cprestore_offset);
- if (s7_append_insn (insn_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (insn_str, true) == s7_FAIL)
return;
sprintf (insn_str, "add r1, r1, r%d", reg);
- if (s7_append_insn (insn_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (insn_str, true) == s7_FAIL)
return;
sprintf (insn_str, "sw r%d, [r1]", s7_GP);
- if (s7_append_insn (insn_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (insn_str, true) == s7_FAIL)
return;
s7_nor1 = r1_bak;
@@ -5846,7 +5843,7 @@ s7_s_score_gpword (int ignore ATTRIBUTE_UNUSED)
ignore_rest_of_line ();
}
p = frag_more (4);
- s7_number_to_chars (p, (valueT) 0, 4);
+ s7_number_to_chars (p, 0, 4);
fix_new_exp (frag_now, p - frag_now->fr_literal, 4, &ex, false, BFD_RELOC_GPREL32);
demand_empty_rest_of_line ();
}
@@ -5867,7 +5864,7 @@ s7_s_score_cpadd (int ignore ATTRIBUTE_UNUSED)
return;
}
- if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == (int) s7_FAIL)
+ if ((reg = s7_reg_required_here (&input_line_pointer, -1, s7_REG_TYPE_SCORE)) == s7_FAIL)
{
return;
}
@@ -5875,7 +5872,7 @@ s7_s_score_cpadd (int ignore ATTRIBUTE_UNUSED)
/* Add $gp to the register named as an argument. */
sprintf (insn_str, "add r%d, r%d, r%d", reg, reg, s7_GP);
- if (s7_append_insn (insn_str, true) == (int) s7_FAIL)
+ if (s7_append_insn (insn_str, true) == s7_FAIL)
return;
}
@@ -6038,7 +6035,7 @@ s7_s_score_lcomm (int bytes_p)
symbol_get_frag (symbolP)->fr_symbol = NULL;
symbol_set_frag (symbolP, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, (offsetT) temp, NULL);
+ pfrag = frag_var (rs_org, 1, 1, 0, symbolP, temp, NULL);
*pfrag = 0;
@@ -6083,7 +6080,7 @@ s7_begin (void)
s7_build_dependency_insn_hsh ();
- for (i = (int) REG_TYPE_FIRST; i < (int) s7_REG_TYPE_MAX; i++)
+ for (i = REG_TYPE_FIRST; i < s7_REG_TYPE_MAX; i++)
s7_build_reg_hsh (s7_all_reg_maps + i);
/* Initialize dependency vector. */
@@ -6092,7 +6089,7 @@ s7_begin (void)
bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0);
seg = now_seg;
subseg = now_subseg;
- s7_pdr_seg = subseg_new (".pdr", (subsegT) 0);
+ s7_pdr_seg = subseg_new (".pdr", 0);
bfd_set_section_flags (s7_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
bfd_set_section_alignment (s7_pdr_seg, 2);
subseg_set (seg, subseg);
@@ -6186,19 +6183,19 @@ s7_atof (int type, char *litP, int *sizeP)
if (target_big_endian)
{
for (i = 0; i < prec; i++)
- {
- s7_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
+ {
+ s7_number_to_chars (litP, words[i], 2);
+ litP += 2;
+ }
}
else
{
for (i = 0; i < prec; i += 2)
- {
- s7_number_to_chars (litP, (valueT) words[i + 1], 2);
- s7_number_to_chars (litP + 2, (valueT) words[i], 2);
- litP += 4;
- }
+ {
+ s7_number_to_chars (litP, words[i + 1], 2);
+ s7_number_to_chars (litP + 2, words[i], 2);
+ litP += 4;
+ }
}
return 0;
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index db11939..551d8e8 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -445,7 +445,7 @@ sh_elf_cons (int nbytes)
do
{
expression (&exp);
- emit_expr (&exp, (unsigned int) nbytes);
+ emit_expr (&exp, nbytes);
}
while (*input_line_pointer++ == ',');
@@ -544,6 +544,7 @@ sh_optimize_expr (expressionS *l, operatorT op, expressionS *r)
add_to_result (l, symval_diff, symval_diff < 0);
l->X_op = O_constant;
l->X_add_symbol = 0;
+ l->X_unsigned = 0;
return 1;
}
return 0;
@@ -604,7 +605,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
if (l1 == '1')
{
if (src[2] >= '0' && src[2] <= '5'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_REG_N;
*reg = 10 + src[2] - '0';
@@ -612,26 +613,26 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
}
if (l1 >= '0' && l1 <= '9'
- && ! IDENT_CHAR ((unsigned char) src[2]))
+ && ! IDENT_CHAR (src[2]))
{
*mode = A_REG_N;
*reg = (l1 - '0');
return 2;
}
if (l1 >= '0' && l1 <= '7' && strncasecmp (&src[2], "_bank", 5) == 0
- && ! IDENT_CHAR ((unsigned char) src[7]))
+ && ! IDENT_CHAR (src[7]))
{
*mode = A_REG_B;
*reg = (l1 - '0');
return 7;
}
- if (l1 == 'e' && ! IDENT_CHAR ((unsigned char) src[2]))
+ if (l1 == 'e' && ! IDENT_CHAR (src[2]))
{
*mode = A_RE;
return 2;
}
- if (l1 == 's' && ! IDENT_CHAR ((unsigned char) src[2]))
+ if (l1 == 's' && ! IDENT_CHAR (src[2]))
{
*mode = A_RS;
return 2;
@@ -642,13 +643,13 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
{
if (l1 == '0')
{
- if (! IDENT_CHAR ((unsigned char) src[2]))
+ if (! IDENT_CHAR (src[2]))
{
*mode = DSP_REG_N;
*reg = A_A0_NUM;
return 2;
}
- if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
+ if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR (src[3]))
{
*mode = DSP_REG_N;
*reg = A_A0G_NUM;
@@ -657,13 +658,13 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
if (l1 == '1')
{
- if (! IDENT_CHAR ((unsigned char) src[2]))
+ if (! IDENT_CHAR (src[2]))
{
*mode = DSP_REG_N;
*reg = A_A1_NUM;
return 2;
}
- if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
+ if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR (src[3]))
{
*mode = DSP_REG_N;
*reg = A_A1G_NUM;
@@ -672,21 +673,21 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
if (l1 == 'x' && src[2] >= '0' && src[2] <= '1'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_REG_N;
*reg = 4 + (l1 - '0');
return 3;
}
if (l1 == 'y' && src[2] >= '0' && src[2] <= '1'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_REG_N;
*reg = 6 + (l1 - '0');
return 3;
}
if (l1 == 's' && src[2] >= '0' && src[2] <= '3'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
int n = l1 - '0';
@@ -696,7 +697,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
}
- if (l0 == 'i' && l1 && ! IDENT_CHAR ((unsigned char) src[2]))
+ if (l0 == 'i' && l1 && ! IDENT_CHAR (src[2]))
{
if (l1 == 's')
{
@@ -719,7 +720,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
if (l0 == 'x' && l1 >= '0' && l1 <= '1'
- && ! IDENT_CHAR ((unsigned char) src[2]))
+ && ! IDENT_CHAR (src[2]))
{
*mode = DSP_REG_N;
*reg = A_X0_NUM + l1 - '0';
@@ -727,7 +728,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
if (l0 == 'y' && l1 >= '0' && l1 <= '1'
- && ! IDENT_CHAR ((unsigned char) src[2]))
+ && ! IDENT_CHAR (src[2]))
{
*mode = DSP_REG_N;
*reg = A_Y0_NUM + l1 - '0';
@@ -735,7 +736,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
if (l0 == 'm' && l1 >= '0' && l1 <= '1'
- && ! IDENT_CHAR ((unsigned char) src[2]))
+ && ! IDENT_CHAR (src[2]))
{
*mode = DSP_REG_N;
*reg = l1 == '0' ? A_M0_NUM : A_M1_NUM;
@@ -744,59 +745,59 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
if (l0 == 's'
&& l1 == 's'
- && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3]))
+ && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR (src[3]))
{
*mode = A_SSR;
return 3;
}
if (l0 == 's' && l1 == 'p' && TOLOWER (src[2]) == 'c'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_SPC;
return 3;
}
if (l0 == 's' && l1 == 'g' && TOLOWER (src[2]) == 'r'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_SGR;
return 3;
}
if (l0 == 'd' && l1 == 's' && TOLOWER (src[2]) == 'r'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_DSR;
return 3;
}
if (l0 == 'd' && l1 == 'b' && TOLOWER (src[2]) == 'r'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_DBR;
return 3;
}
- if (l0 == 's' && l1 == 'r' && ! IDENT_CHAR ((unsigned char) src[2]))
+ if (l0 == 's' && l1 == 'r' && ! IDENT_CHAR (src[2]))
{
*mode = A_SR;
return 2;
}
- if (l0 == 's' && l1 == 'p' && ! IDENT_CHAR ((unsigned char) src[2]))
+ if (l0 == 's' && l1 == 'p' && ! IDENT_CHAR (src[2]))
{
*mode = A_REG_N;
*reg = 15;
return 2;
}
- if (l0 == 'p' && l1 == 'r' && ! IDENT_CHAR ((unsigned char) src[2]))
+ if (l0 == 'p' && l1 == 'r' && ! IDENT_CHAR (src[2]))
{
*mode = A_PR;
return 2;
}
- if (l0 == 'p' && l1 == 'c' && ! IDENT_CHAR ((unsigned char) src[2]))
+ if (l0 == 'p' && l1 == 'c' && ! IDENT_CHAR (src[2]))
{
/* Don't use A_DISP_PC here - that would accept stuff like 'mova pc,r0'
and use an uninitialized immediate. */
@@ -804,26 +805,26 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
return 2;
}
if (l0 == 'g' && l1 == 'b' && TOLOWER (src[2]) == 'r'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_GBR;
return 3;
}
if (l0 == 'v' && l1 == 'b' && TOLOWER (src[2]) == 'r'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_VBR;
return 3;
}
if (l0 == 't' && l1 == 'b' && TOLOWER (src[2]) == 'r'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_TBR;
return 3;
}
if (l0 == 'm' && l1 == 'a' && TOLOWER (src[2]) == 'c'
- && ! IDENT_CHAR ((unsigned char) src[4]))
+ && ! IDENT_CHAR (src[4]))
{
if (TOLOWER (src[3]) == 'l')
{
@@ -837,7 +838,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
}
if (l0 == 'm' && l1 == 'o' && TOLOWER (src[2]) == 'd'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = A_MOD;
return 3;
@@ -847,7 +848,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
if (src[2] == '1')
{
if (src[3] >= '0' && src[3] <= '5'
- && ! IDENT_CHAR ((unsigned char) src[4]))
+ && ! IDENT_CHAR (src[4]))
{
*mode = F_REG_N;
*reg = 10 + src[3] - '0';
@@ -855,7 +856,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
}
if (src[2] >= '0' && src[2] <= '9'
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = F_REG_N;
*reg = (src[2] - '0');
@@ -867,7 +868,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
if (src[2] == '1')
{
if (src[3] >= '0' && src[3] <= '4' && ! ((src[3] - '0') & 1)
- && ! IDENT_CHAR ((unsigned char) src[4]))
+ && ! IDENT_CHAR (src[4]))
{
*mode = D_REG_N;
*reg = 10 + src[3] - '0';
@@ -875,7 +876,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
}
if (src[2] >= '0' && src[2] <= '8' && ! ((src[2] - '0') & 1)
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = D_REG_N;
*reg = (src[2] - '0');
@@ -887,7 +888,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
if (src[2] == '1')
{
if (src[3] >= '0' && src[3] <= '4' && ! ((src[3] - '0') & 1)
- && ! IDENT_CHAR ((unsigned char) src[4]))
+ && ! IDENT_CHAR (src[4]))
{
*mode = X_REG_N;
*reg = 11 + src[3] - '0';
@@ -895,7 +896,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
}
if (src[2] >= '0' && src[2] <= '8' && ! ((src[2] - '0') & 1)
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = X_REG_N;
*reg = (src[2] - '0') + 1;
@@ -904,14 +905,14 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
if (l0 == 'f' && l1 == 'v')
{
- if (src[2] == '1'&& src[3] == '2' && ! IDENT_CHAR ((unsigned char) src[4]))
+ if (src[2] == '1'&& src[3] == '2' && ! IDENT_CHAR (src[4]))
{
*mode = V_REG_N;
*reg = 12;
return 4;
}
if ((src[2] == '0' || src[2] == '4' || src[2] == '8')
- && ! IDENT_CHAR ((unsigned char) src[3]))
+ && ! IDENT_CHAR (src[3]))
{
*mode = V_REG_N;
*reg = (src[2] - '0');
@@ -920,7 +921,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
}
if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 'u'
&& TOLOWER (src[3]) == 'l'
- && ! IDENT_CHAR ((unsigned char) src[4]))
+ && ! IDENT_CHAR (src[4]))
{
*mode = FPUL_N;
return 4;
@@ -928,7 +929,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 's'
&& TOLOWER (src[3]) == 'c'
- && TOLOWER (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5]))
+ && TOLOWER (src[4]) == 'r' && ! IDENT_CHAR (src[5]))
{
*mode = FPSCR_N;
return 5;
@@ -936,7 +937,7 @@ parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
if (l0 == 'x' && l1 == 'm' && TOLOWER (src[2]) == 't'
&& TOLOWER (src[3]) == 'r'
- && TOLOWER (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5]))
+ && TOLOWER (src[4]) == 'x' && ! IDENT_CHAR (src[5]))
{
*mode = XMTRX_M4;
return 5;
@@ -2180,7 +2181,7 @@ find_cooked_opcode (char **str_p)
if (nlen == 0)
as_bad (_("can't find opcode "));
- return (sh_opcode_info *) str_hash_find (opcode_hash_control, name);
+ return str_hash_find (opcode_hash_control, name);
}
/* Assemble a parallel processing insn. */
@@ -2870,7 +2871,7 @@ struct sh_count_relocs
static void
sh_count_relocs (bfd *abfd ATTRIBUTE_UNUSED, segT sec, void *data)
{
- struct sh_count_relocs *info = (struct sh_count_relocs *) data;
+ struct sh_count_relocs *info = data;
segment_info_type *seginfo;
symbolS *sym;
fixS *fix;
@@ -3017,7 +3018,6 @@ md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, segT seg, fragS *fragP)
{
case C (COND_JUMP, COND8):
case C (COND_JUMP_DELAY, COND8):
- subseg_change (seg, 0);
fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
1, BFD_RELOC_SH_PCDISP8BY2);
fragP->fr_fix += 2;
@@ -3025,7 +3025,6 @@ md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, segT seg, fragS *fragP)
break;
case C (UNCOND_JUMP, UNCOND12):
- subseg_change (seg, 0);
fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
1, BFD_RELOC_SH_PCDISP12BY2);
fragP->fr_fix += 2;
@@ -3081,7 +3080,6 @@ md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, segT seg, fragS *fragP)
its delay-slot insn already makes the branch reach. */
/* Build a relocation to six / four bytes farther on. */
- subseg_change (seg, 0);
fix_new (fragP, fragP->fr_fix, 2, section_symbol (seg),
fragP->fr_address + fragP->fr_fix + (delay ? 4 : 6),
1, BFD_RELOC_SH_PCDISP8BY2);
@@ -3205,8 +3203,7 @@ sh_cons_align (int nbytes)
return;
}
- frag_var (rs_align_test, 1, 1, (relax_substateT) 0,
- (symbolS *) NULL, (offsetT) nalign, (char *) NULL);
+ frag_var (rs_align_test, 1, 1, 0, NULL, nalign, NULL);
record_alignment (now_seg, nalign);
}
@@ -3396,7 +3393,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
int lowbyte = target_big_endian ? 1 : 0;
int highbyte = target_big_endian ? 0 : 1;
- long val = (long) *valP;
+ long val = *valP;
long max, min;
int shift;
@@ -3703,8 +3700,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
if (val >= 0)
val >>= shift;
else
- val = ((val >> shift)
- | ((long) -1 & ~ ((long) -1 >> shift)));
+ val = (val >> shift) | (-1L & ~ (-1L >> shift));
}
/* Extend sign for 64-bit host. */
@@ -3816,7 +3812,7 @@ long
md_pcrel_from_section (fixS *fixP, segT sec)
{
if (! sh_local_pcrel (fixP)
- && fixP->fx_addsy != (symbolS *) NULL
+ && fixP->fx_addsy != NULL
&& (generic_force_reloc (fixP)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
{
diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h
index fb1e4b8..1ed0f5e 100644
--- a/gas/config/tc-sh.h
+++ b/gas/config/tc-sh.h
@@ -56,7 +56,7 @@ extern int sh_optimize_expr (expressionS *, operatorT, expressionS *);
#define HANDLE_ALIGN(sec, frag) sh_handle_align (frag)
extern void sh_handle_align (fragS *);
-#define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (1 + 2)
/* We need to force out some relocations when relaxing. */
#define TC_FORCE_RELOCATION(fix) sh_force_relocation (fix)
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index e303169..0dd9205 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -805,8 +805,8 @@ struct priv_reg_entry v9a_asr_table[] =
static int
cmp_reg_entry (const void *parg, const void *qarg)
{
- const struct priv_reg_entry *p = (const struct priv_reg_entry *) parg;
- const struct priv_reg_entry *q = (const struct priv_reg_entry *) qarg;
+ const struct priv_reg_entry *p = parg;
+ const struct priv_reg_entry *q = qarg;
if (p->name == q->name)
return 0;
@@ -921,8 +921,8 @@ struct perc_entry perc_table[NUM_PERC_ENTRIES];
static int
cmp_perc_entry (const void *parg, const void *qarg)
{
- const struct perc_entry *p = (const struct perc_entry *) parg;
- const struct perc_entry *q = (const struct perc_entry *) qarg;
+ const struct perc_entry *p = parg;
+ const struct perc_entry *q = qarg;
if (p->name == q->name)
return 0;
@@ -979,9 +979,9 @@ md_begin (void)
{
const struct sparc_opcode *insn;
const char *name = ((sparc_arch_size == 32)
- ? native_op_table[i].name32
- : native_op_table[i].name64);
- insn = (struct sparc_opcode *) str_hash_find (op_hash, name);
+ ? native_op_table[i].name32
+ : native_op_table[i].name64);
+ insn = str_hash_find (op_hash, name);
if (insn == NULL)
{
as_bad (_("Internal error: can't find opcode `%s' for `%s'\n"),
@@ -1254,7 +1254,7 @@ synthetize_setuw (const struct sparc_opcode *insn)
&& (the_insn.exp.X_add_number < -(offsetT) U0x80000000
|| the_insn.exp.X_add_number > (offsetT) U0xffffffff))
as_warn (_("set: number not in -2147483648..4294967295 range"));
- the_insn.exp.X_add_number = (int) the_insn.exp.X_add_number;
+ the_insn.exp.X_add_number = (int32_t) the_insn.exp.X_add_number;
}
}
@@ -1756,7 +1756,7 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
*pinsn = NULL;
return special_case;
}
- insn = (struct sparc_opcode *) str_hash_find (op_hash, str);
+ insn = str_hash_find (op_hash, str);
*pinsn = insn;
if (insn == NULL)
{
@@ -3402,9 +3402,9 @@ output_insn (const struct sparc_opcode *insn, struct sparc_it *theinsn)
/* Put out the opcode. */
if (INSN_BIG_ENDIAN)
- number_to_chars_bigendian (toP, (valueT) theinsn->opcode, 4);
+ number_to_chars_bigendian (toP, theinsn->opcode, 4);
else
- number_to_chars_littleendian (toP, (valueT) theinsn->opcode, 4);
+ number_to_chars_littleendian (toP, theinsn->opcode, 4);
/* Put out the symbol-dependent stuff. */
if (theinsn->reloc != BFD_RELOC_NONE)
@@ -3460,7 +3460,7 @@ void
md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED)
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
- offsetT val = * (offsetT *) valP;
+ offsetT val = *valP;
long insn;
gas_assert (fixP->fx_r_type < BFD_RELOC_UNUSED);
@@ -3544,9 +3544,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED)
/* It's a relocation against an instruction. */
if (INSN_BIG_ENDIAN)
- insn = bfd_getb32 ((unsigned char *) buf);
+ insn = bfd_getb32 (buf);
else
- insn = bfd_getl32 ((unsigned char *) buf);
+ insn = bfd_getl32 (buf);
switch (fixP->fx_r_type)
{
@@ -3588,9 +3588,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED)
then we can optimize if the call destination is near
by changing the call into a branch always. */
if (INSN_BIG_ENDIAN)
- delay = bfd_getb32 ((unsigned char *) buf + 4);
+ delay = bfd_getb32 (buf + 4);
else
- delay = bfd_getl32 ((unsigned char *) buf + 4);
+ delay = bfd_getl32 (buf + 4);
if ((insn & OP (~0)) != OP (1) || (delay & OP (~0)) != OP (2))
break;
if ((delay & OP3 (~0)) != OP3 (0x3d) /* Restore. */
@@ -3624,9 +3624,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED)
int reg;
if (INSN_BIG_ENDIAN)
- setter = bfd_getb32 ((unsigned char *) buf - 4);
+ setter = bfd_getb32 (buf - 4);
else
- setter = bfd_getl32 ((unsigned char *) buf - 4);
+ setter = bfd_getl32 (buf - 4);
if ((setter & (0xffffffff ^ RD (~0)))
!= (INSN_OR | RS1 (O7) | RS2 (G0)))
break;
@@ -3643,9 +3643,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED)
break;
if (INSN_BIG_ENDIAN)
- bfd_putb32 (INSN_NOP, (unsigned char *) buf + 4);
+ bfd_putb32 (INSN_NOP, buf + 4);
else
- bfd_putl32 (INSN_NOP, (unsigned char *) buf + 4);
+ bfd_putl32 (INSN_NOP, buf + 4);
}
}
break;
@@ -3820,9 +3820,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED)
}
if (INSN_BIG_ENDIAN)
- bfd_putb32 (insn, (unsigned char *) buf);
+ bfd_putb32 (insn, buf);
else
- bfd_putl32 (insn, (unsigned char *) buf);
+ bfd_putl32 (insn, buf);
}
/* Are we finished with this relocation now? */
@@ -4219,8 +4219,7 @@ s_reserve (int ignore ATTRIBUTE_UNUSED)
symbol_get_frag (symbolP)->fr_symbol = NULL;
symbol_set_frag (symbolP, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- (offsetT) size, (char *) 0);
+ pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
*pfrag = 0;
S_SET_SEGMENT (symbolP, bss_section);
@@ -4336,8 +4335,7 @@ s_common (int ignore ATTRIBUTE_UNUSED)
if (S_GET_SEGMENT (symbolP) == bss_section)
symbol_get_frag (symbolP)->fr_symbol = 0;
symbol_set_frag (symbolP, frag_now);
- p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- (offsetT) size, (char *) 0);
+ p = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
*p = 0;
S_SET_SEGMENT (symbolP, bss_section);
S_CLEAR_EXTERNAL (symbolP);
@@ -4347,7 +4345,7 @@ s_common (int ignore ATTRIBUTE_UNUSED)
else
{
allocate_common:
- S_SET_VALUE (symbolP, (valueT) size);
+ S_SET_VALUE (symbolP, size);
S_SET_ALIGN (symbolP, temp);
S_SET_SIZE (symbolP, size);
S_SET_EXTERNAL (symbolP);
@@ -4553,7 +4551,7 @@ s_register (int ignore ATTRIBUTE_UNUSED)
if (! (flags & (BSF_GLOBAL|BSF_LOCAL|BSF_WEAK)))
flags |= BSF_GLOBAL;
symbol_get_bfdsym (globals[reg])->flags = flags;
- S_SET_VALUE (globals[reg], (valueT) reg);
+ S_SET_VALUE (globals[reg], reg);
S_SET_ALIGN (globals[reg], reg);
S_SET_SIZE (globals[reg], 0);
/* Although we actually want undefined_section here,
@@ -4635,8 +4633,7 @@ sparc_cons_align (int nbytes)
return;
}
- frag_var (rs_align_test, 1, 1, (relax_substateT) 0,
- (symbolS *) NULL, (offsetT) nalign, (char *) NULL);
+ frag_var (rs_align_test, 1, 1, 0, NULL, nalign, NULL);
record_alignment (now_seg, nalign);
}
@@ -4937,7 +4934,7 @@ cons_fix_new_sparc (fragS *frag,
}
}
- fix_new_exp (frag, where, (int) nbytes, exp, 0, r);
+ fix_new_exp (frag, where, nbytes, exp, 0, r);
}
void
diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h
index b87212f..cfb89e0 100644
--- a/gas/config/tc-sparc.h
+++ b/gas/config/tc-sparc.h
@@ -78,7 +78,7 @@ extern void sparc_cons_align (int);
#define HANDLE_ALIGN(sec, fragp) sparc_handle_align (fragp)
extern void sparc_handle_align (struct frag *);
-#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (3 + 4 + 4)
#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
@@ -178,4 +178,4 @@ extern int sparc_cie_data_alignment;
this, BFD_RELOC_32_PCREL will be emitted directly instead. */
#define CFI_DIFF_EXPR_OK 0
-#endif
+#endif /* TC_SPARC */
diff --git a/gas/config/tc-spu.c b/gas/config/tc-spu.c
index 335fffc..5da4e00 100644
--- a/gas/config/tc-spu.c
+++ b/gas/config/tc-spu.c
@@ -273,7 +273,7 @@ md_assemble (char *op)
/* try to find the instruction in the hash table */
- if ((format = (struct spu_opcode *) str_hash_find (op_hash, op)) == NULL)
+ if ((format = str_hash_find (op_hash, op)) == NULL)
{
as_bad (_("Invalid mnemonic '%s'"), op);
return;
@@ -298,7 +298,7 @@ md_assemble (char *op)
insn.reloc[i] = BFD_RELOC_NONE;
}
insn.opcode = format->opcode;
- insn.tag = (enum spu_insns) (format - spu_opcodes);
+ insn.tag = format - spu_opcodes;
syntax_error_arg = 0;
syntax_error_param = 0;
@@ -569,7 +569,7 @@ get_reg (const char *param, struct spu_insn *insn, int arg, int accept_expr)
char *save_ptr;
expressionS ex;
save_ptr = input_line_pointer;
- input_line_pointer = (char *)param;
+ input_line_pointer = (char *) param;
expression (&ex);
param = input_line_pointer;
input_line_pointer = save_ptr;
@@ -721,16 +721,11 @@ md_create_short_jump (char *ptr,
fragS *frag,
symbolS *to_symbol)
{
- ptr[0] = (char) 0xc0;
+ ptr[0] = 0xc0;
ptr[1] = 0x00;
ptr[2] = 0x00;
ptr[3] = 0x00;
- fix_new (frag,
- ptr - frag->fr_literal,
- 4,
- to_symbol,
- (offsetT) 0,
- 0,
+ fix_new (frag, ptr - frag->fr_literal, 4, to_symbol, 0, 0,
BFD_RELOC_SPU_PCREL16);
}
@@ -743,16 +738,11 @@ md_create_long_jump (char *ptr,
fragS *frag,
symbolS *to_symbol)
{
- ptr[0] = (char) 0xc0;
+ ptr[0] = 0xc0;
ptr[1] = 0x00;
ptr[2] = 0x00;
ptr[3] = 0x00;
- fix_new (frag,
- ptr - frag->fr_literal,
- 4,
- to_symbol,
- (offsetT) 0,
- 0,
+ fix_new (frag, ptr - frag->fr_literal, 4, to_symbol, 0, 0,
BFD_RELOC_SPU_PCREL16);
}
#endif
@@ -872,7 +862,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("reloc %d not supported by object file format"),
@@ -950,7 +940,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
valueT val = *valP;
char *place = fixP->fx_where + fixP->fx_frag->fr_literal;
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
{
/* We can't actually support subtracting a symbol. */
as_bad_subtract (fixP);
diff --git a/gas/config/tc-spu.h b/gas/config/tc-spu.h
index 4c16485..7089615 100644
--- a/gas/config/tc-spu.h
+++ b/gas/config/tc-spu.h
@@ -104,6 +104,6 @@ extern symbolS *section_symbol (asection *);
extern void spu_handle_align (fragS *);
#define HANDLE_ALIGN(sec, frag) spu_handle_align (frag)
-#define MAX_MEM_FOR_RS_ALIGN_CODE (7 + 8)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (7 + 8)
#endif /* TC_SPU */
diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c
index 1da1618..2c80f97 100644
--- a/gas/config/tc-tic30.c
+++ b/gas/config/tc-tic30.c
@@ -516,7 +516,7 @@ tic30_operand (char *token)
return NULL;
}
- ind_addr_op = (ind_addr_type *) str_hash_find (ind_hash, ind_buffer);
+ ind_addr_op = str_hash_find (ind_hash, ind_buffer);
if (ind_addr_op)
{
debug ("Found indirect reference: %s\n", ind_addr_op->syntax);
@@ -555,7 +555,7 @@ tic30_operand (char *token)
}
else
{
- reg *regop = (reg *) str_hash_find (reg_hash, token);
+ reg *regop = str_hash_find (reg_hash, token);
if (regop)
{
@@ -598,7 +598,7 @@ tic30_operand (char *token)
current_op->immediate.s_number
= current_op->immediate.imm_expr.X_add_number;
current_op->immediate.u_number
- = (unsigned int) current_op->immediate.imm_expr.X_add_number;
+ = current_op->immediate.imm_expr.X_add_number;
current_op->immediate.resolved = 1;
}
}
@@ -610,8 +610,8 @@ tic30_operand (char *token)
current_op->immediate.decimal_found = 1;
current_op->immediate.label = xstrdup (token);
current_op->immediate.f_number = (float) atof (token);
- current_op->immediate.s_number = (int) atoi (token);
- current_op->immediate.u_number = (unsigned int) atoi (token);
+ current_op->immediate.s_number = atoi (token);
+ current_op->immediate.u_number = atoi (token);
current_op->immediate.resolved = 1;
}
current_op->op_type = Disp | Abs24 | Imm16 | Imm24;
@@ -652,7 +652,7 @@ tic30_parallel_insn (char *token)
/* Find instruction. */
save_char = *current_posn;
*current_posn = '\0';
- p_opcode = (partemplate *) str_hash_find (parop_hash, token);
+ p_opcode = str_hash_find (parop_hash, token);
if (p_opcode)
{
debug ("Found instruction %s\n", p_opcode->name);
@@ -697,7 +697,7 @@ tic30_parallel_insn (char *token)
debug ("first_opcode = %s\n", first_opcode);
debug ("second_opcode = %s\n", second_opcode);
sprintf (token, "q_%s_%s", second_opcode, first_opcode);
- p_opcode = (partemplate *) str_hash_find (parop_hash, token);
+ p_opcode = str_hash_find (parop_hash, token);
if (p_opcode)
{
@@ -1061,7 +1061,7 @@ tic30_parallel_insn (char *token)
char *p;
p = frag_more (INSN_SIZE);
- md_number_to_chars (p, (valueT) p_insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, p_insn.opcode, INSN_SIZE);
}
{
@@ -1151,7 +1151,7 @@ symbolS *
md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
{
debug ("In md_undefined_symbol()\n");
- return (symbolS *) 0;
+ return NULL;
}
valueT
@@ -1279,7 +1279,7 @@ md_atof (int what_statement_type,
if (mant == 0)
{
mant |= 0x00800000;
- exp = (long) exp - 0x01000000;
+ exp = exp - 0x01000000;
}
}
tmsfloat = exp | mant;
@@ -1443,7 +1443,7 @@ md_assemble (char *line)
/* Find instruction. */
save_char = *current_posn;
*current_posn = '\0';
- op = (insn_template *) str_hash_find (op_hash, token_start);
+ op = str_hash_find (op_hash, token_start);
if (op)
{
debug ("Found instruction %s\n", op->name);
@@ -1672,7 +1672,7 @@ md_assemble (char *line)
insn.opcode |= insn.addressing_mode;
p = frag_more (INSN_SIZE);
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else
{
@@ -1723,12 +1723,12 @@ md_assemble (char *line)
into instruction word, and output. */
insn.opcode |=
(insn.operand_type[am_insn]->direct.address & 0x0000FFFF);
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else
{
/* Unresolved direct addressing mode instruction. */
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal), 2,
& insn.operand_type[am_insn]->direct.direct_expr,
0, 0);
@@ -1748,7 +1748,7 @@ md_assemble (char *line)
{
case Imm_Float:
debug ("Floating point first operand\n");
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
keeploc = input_line_pointer;
input_line_pointer =
@@ -1771,7 +1771,7 @@ md_assemble (char *line)
as_warn (_("only lower 16-bits of first operand are used"));
insn.opcode |=
(insn.operand_type[0]->immediate.u_number & 0x0000FFFFL);
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
break;
case Imm_SInt:
@@ -1788,7 +1788,7 @@ md_assemble (char *line)
}
insn.opcode |=
(insn.operand_type[0]->immediate.s_number & 0x0000FFFFL);
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
break;
}
}
@@ -1797,7 +1797,7 @@ md_assemble (char *line)
/* Unresolved immediate label. */
if (insn.operands > 1)
insn.opcode |= (insn.operand_type[1]->reg.opcode << 16);
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal), 2,
& insn.operand_type[0]->immediate.imm_expr,
0, 0);
@@ -1814,7 +1814,7 @@ md_assemble (char *line)
{
insn.opcode |= (insn.operand_type[0]->reg.opcode);
insn.opcode |= PC_Register;
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else
{
@@ -1823,11 +1823,11 @@ md_assemble (char *line)
{
insn.opcode |=
(insn.operand_type[0]->immediate.s_number & 0x0000FFFF);
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else
{
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal),
2, & insn.operand_type[0]->immediate.imm_expr,
1, 0);
@@ -1842,7 +1842,7 @@ md_assemble (char *line)
{
insn.opcode |= (insn.operand_type[1]->reg.opcode);
insn.opcode |= PC_Register;
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else if (insn.operand_type[1]->immediate.resolved == 1)
{
@@ -1859,12 +1859,12 @@ md_assemble (char *line)
}
insn.opcode |= (insn.operand_type[1]->immediate.s_number);
insn.opcode |= PC_Relative;
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else
{
insn.opcode |= PC_Relative;
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
fix_new_exp (frag_now, p + 2 - frag_now->fr_literal, 2,
& insn.operand_type[1]->immediate.imm_expr,
1, 0);
@@ -1882,14 +1882,14 @@ md_assemble (char *line)
as_bad (_("interrupt vector for trap instruction out of range"));
return;
}
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else if (insn.tm->opcode_modifier == StackOp
|| insn.tm->opcode_modifier == Rotate)
{
/* Push, Pop and Rotate instructions. */
insn.opcode |= (insn.operand_type[0]->reg.opcode << 16);
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else if ((insn.tm->operand_types[0] & (Abs24 | Direct))
== (Abs24 | Direct))
@@ -1903,13 +1903,13 @@ md_assemble (char *line)
/* Direct addressing uses lower 8 bits of direct address. */
insn.opcode |=
(insn.operand_type[0]->direct.address & 0x00FF0000) >> 16;
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else
{
fixS *fix;
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
fix = fix_new_exp (frag_now, p + 3 - (frag_now->fr_literal),
1, &insn.operand_type[0]->direct.direct_expr, 0, 0);
/* Ensure that the assembler doesn't complain
@@ -1929,12 +1929,12 @@ md_assemble (char *line)
}
insn.opcode |=
((insn.operand_type[0]->immediate.u_number & 0x00FF0000) >> 16);
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else
{
fixS *fix;
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
fix = fix_new_exp (frag_now, p + 3 - (frag_now->fr_literal),
1, &insn.operand_type[0]->immediate.imm_expr,
0, 0);
@@ -1951,22 +1951,22 @@ md_assemble (char *line)
as_warn (_("first operand is too large for a 24-bit displacement"));
insn.opcode |=
(insn.operand_type[0]->immediate.u_number & 0x00FFFFFF);
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
else
{
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
fix_new_exp (frag_now, p + 1 - (frag_now->fr_literal), 3,
& insn.operand_type[0]->immediate.imm_expr, 0, 0);
}
}
else if (insn.tm->operand_types[0] & NotReq)
/* Check for NOP instruction without arguments. */
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
else if (insn.tm->operands == 0)
/* Check for instructions without operands. */
- md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+ md_number_to_chars (p, insn.opcode, INSN_SIZE);
}
debug ("Addressing mode: %08X\n", insn.addressing_mode);
{
diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c
index 97a088c..3a3123c 100644
--- a/gas/config/tc-tic4x.c
+++ b/gas/config/tc-tic4x.c
@@ -695,9 +695,7 @@ tic4x_seg_alloc (char *name ATTRIBUTE_UNUSED,
{
char *p;
- p = frag_var (rs_fill, 1, 1, (relax_substateT) 0,
- (symbolS *) symbolP,
- size * OCTETS_PER_BYTE, (char *) 0);
+ p = frag_var (rs_fill, 1, 1, 0, symbolP, size * OCTETS_PER_BYTE, NULL);
*p = 0;
}
}
@@ -772,8 +770,7 @@ tic4x_bss (int x ATTRIBUTE_UNUSED)
symbol_set_frag (symbolP, frag_now);
- p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- size * OCTETS_PER_BYTE, (char *) 0);
+ p = frag_var (rs_org, 1, 1, 0, symbolP, size * OCTETS_PER_BYTE, NULL);
*p = 0; /* Fill char. */
S_SET_SEGMENT (symbolP, bss_section);
@@ -2450,8 +2447,7 @@ md_assemble (char *str)
if (insn->in_use)
{
- if ((insn->inst = (struct tic4x_inst *)
- str_hash_find (tic4x_op_hash, insn->name)) == NULL)
+ if ((insn->inst = str_hash_find (tic4x_op_hash, insn->name)) == NULL)
{
as_bad (_("Unknown opcode `%s'."), insn->name);
insn->parallel = 0;
@@ -2585,15 +2581,13 @@ md_atof (int type, char *litP, int *sizeP)
for (wordP = words; wordP<(words+prec) ; wordP+=2)
{
if (wordP < (words + prec - 1)) /* Dump wordP[1] (if we have one). */
- {
- md_number_to_chars (litP, (valueT) (wordP[1]),
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
+ {
+ md_number_to_chars (litP, wordP[1], sizeof (LITTLENUM_TYPE));
+ litP += sizeof (LITTLENUM_TYPE);
+ }
/* Dump wordP[0] */
- md_number_to_chars (litP, (valueT) (wordP[0]),
- sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, wordP[0], sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
return NULL;
@@ -2820,7 +2814,7 @@ md_undefined_symbol (char *name)
char *s = name + 1;
int lab = 0;
- while (ISDIGIT ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
lab = lab * 10 + *s - '0';
s++;
@@ -3004,7 +2998,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixP)
reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
reloc->address /= OCTETS_PER_BYTE;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Reloc %d not supported by object file format"),
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index cda4f49..515b843 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -478,7 +478,7 @@ tic54x_bss (int x ATTRIBUTE_UNUSED)
char c;
char *name;
char *p;
- int words;
+ offsetT words;
segT current_seg;
subsegT current_subseg;
symbolS *symbolP;
@@ -504,7 +504,7 @@ tic54x_bss (int x ATTRIBUTE_UNUSED)
words = get_absolute_expression ();
if (words < 0)
{
- as_bad (_(".bss size %d < 0!"), words);
+ as_bad (_(".bss size %d < 0!"), (int) words);
ignore_rest_of_line ();
return;
}
@@ -533,11 +533,10 @@ tic54x_bss (int x ATTRIBUTE_UNUSED)
symbolP = symbol_find_or_make (name);
if (S_GET_SEGMENT (symbolP) == bss_section)
- symbol_get_frag (symbolP)->fr_symbol = (symbolS *) NULL;
+ symbol_get_frag (symbolP)->fr_symbol = NULL;
symbol_set_frag (symbolP, frag_now);
- p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- (offsetT) (words * OCTETS_PER_BYTE), (char *) 0);
+ p = frag_var (rs_org, 1, 1, 0, symbolP, words * OCTETS_PER_BYTE, NULL);
*p = 0; /* Fill char. */
S_SET_SEGMENT (symbolP, bss_section);
@@ -574,11 +573,11 @@ stag_add_field_symbols (struct stag *stag,
/* Construct a symbol for every field contained within this structure
including fields within structure fields. */
- prefix = concat (path, *path ? "." : "", NULL);
+ prefix = concat (path, *path ? "." : "", (const char *) NULL);
while (field != NULL)
{
- char *name = concat (prefix, field->name, NULL);
+ char *name = concat (prefix, field->name, (const char *) NULL);
char *freename = name;
if (rootsym == NULL)
@@ -594,7 +593,8 @@ stag_add_field_symbols (struct stag *stag,
{
subsym_ent_t *ent = xmalloc (sizeof (*ent));
ent->u.s = concat (S_GET_NAME (rootsym), "+", root_stag_name,
- name + strlen (S_GET_NAME (rootsym)), NULL);
+ name + strlen (S_GET_NAME (rootsym)),
+ (const char *) NULL);
ent->freekey = 1;
ent->freeval = 1;
ent->isproc = 0;
@@ -801,7 +801,7 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED)
{
char *name;
int c = get_symbol_name (&name);
- struct stag *stag = (struct stag *) str_hash_find (stag_hash, name);
+ struct stag *stag = str_hash_find (stag_hash, name);
if (!stag)
{
@@ -860,7 +860,7 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED)
static void
tic54x_struct_field (int type)
{
- int size;
+ unsigned int size;
int count = 1;
int new_bitfield_offset = 0;
int field_align = current_stag->current_bitfield_offset != 0;
@@ -964,12 +964,12 @@ tic54x_struct_field (int type)
if (current_stag->is_union)
{
/* Note we treat the element as if it were an array of COUNT. */
- if (current_stag->size < (unsigned) size * count)
+ if (current_stag->size < size * count)
current_stag->size = size * count;
}
else
{
- abs_section_offset += (unsigned) size * count;
+ abs_section_offset += size * count;
current_stag->current_bitfield_offset = new_bitfield_offset;
}
line_label = NULL;
@@ -1149,7 +1149,7 @@ tic54x_global (int type)
static void
free_subsym_ent (void *ent)
{
- string_tuple_t *tuple = (string_tuple_t *) ent;
+ string_tuple_t *tuple = ent;
subsym_ent_t *val = (void *) tuple->value;
if (val->freekey)
free ((void *) tuple->key);
@@ -1169,7 +1169,7 @@ subsym_htab_create (void)
static void
free_local_label_ent (void *ent)
{
- string_tuple_t *tuple = (string_tuple_t *) ent;
+ string_tuple_t *tuple = ent;
free ((void *) tuple->key);
free ((void *) tuple->value);
free (ent);
@@ -1295,10 +1295,8 @@ tic54x_space (int arg)
bi->seg = now_seg;
bi->type = bes;
bi->sym = label;
- p = frag_var (rs_machine_dependent,
- 65536 * 2, 1, (relax_substateT) 0,
- make_expr_symbol (&expn), (offsetT) 0,
- (char *) bi);
+ p = frag_var (rs_machine_dependent, 65536 * 2, 1, 0,
+ make_expr_symbol (&expn), 0, (char *) bi);
if (p)
*p = 0;
@@ -1362,9 +1360,7 @@ tic54x_space (int arg)
}
if (!need_pass_2)
- p = frag_var (rs_fill, 1, 1,
- (relax_substateT) 0, (symbolS *) 0,
- (offsetT) octets, (char *) 0);
+ p = frag_var (rs_fill, 1, 1, 0, NULL, octets, NULL);
/* Make note of how many bits of this word we've allocated so far. */
frag_now->tc_frag_data = bit_offset;
@@ -1470,9 +1466,7 @@ tic54x_usect (int x ATTRIBUTE_UNUSED)
seg_info (seg)->bss = 1; /* Uninitialized data. */
- p = frag_var (rs_fill, 1, 1,
- (relax_substateT) 0, (symbolS *) line_label,
- size * OCTETS_PER_BYTE, (char *) 0);
+ p = frag_var (rs_fill, 1, 1, 0, line_label, size * OCTETS_PER_BYTE, NULL);
*p = 0;
if (blocking_flag)
@@ -1808,10 +1802,8 @@ tic54x_field (int ignore ATTRIBUTE_UNUSED)
bi->seg = now_seg;
bi->type = TYPE_FIELD;
bi->value = value;
- p = frag_var (rs_machine_dependent,
- 4, 1, (relax_substateT) 0,
- make_expr_symbol (&size_exp), (offsetT) 0,
- (char *) bi);
+ p = frag_var (rs_machine_dependent, 4, 1, 0,
+ make_expr_symbol (&size_exp), 0, (char *) bi);
goto getout;
}
else if (bit_offset == 0 || bit_offset + size > 16)
@@ -1839,7 +1831,7 @@ tic54x_field (int ignore ATTRIBUTE_UNUSED)
/* OR in existing value. */
if (alloc_frag->tc_frag_data)
- value |= ((unsigned short) p[1] << 8) | p[0];
+ value |= ((uint16_t) p[1] << 8) | p[0];
md_number_to_chars (p, value, 2);
alloc_frag->tc_frag_data += size;
if (alloc_frag->tc_frag_data == 16)
@@ -2379,7 +2371,7 @@ tic54x_mlib (int ignore ATTRIBUTE_UNUSED)
/* Write to a temporary file, then use s_include to include it
a bit of a hack. */
ftmp = fopen (fname, "w+b");
- fwrite ((void *) buf, size, 1, ftmp);
+ fwrite (buf, size, 1, ftmp);
if (size == 0 || buf[size - 1] != '\n')
fwrite ("\n", 1, 1, ftmp);
fclose (ftmp);
@@ -2733,7 +2725,7 @@ subsym_isreg (char *a, char *ignore ATTRIBUTE_UNUSED)
static int
subsym_structsz (char *name, char *ignore ATTRIBUTE_UNUSED)
{
- struct stag *stag = (struct stag *) str_hash_find (stag_hash, name);
+ struct stag *stag = str_hash_find (stag_hash, name);
if (stag)
return stag->size;
@@ -3667,7 +3659,7 @@ encode_integer (tic54x_insn *insn,
static int
encode_condition (tic54x_insn *insn, struct opstruct *operand)
{
- tic54x_symbol *cc = (tic54x_symbol *) str_hash_find (cc_hash, operand->buf);
+ tic54x_symbol *cc = str_hash_find (cc_hash, operand->buf);
if (!cc)
{
as_bad (_("Unrecognized condition code \"%s\""), operand->buf);
@@ -3727,7 +3719,7 @@ encode_condition (tic54x_insn *insn, struct opstruct *operand)
static int
encode_cc3 (tic54x_insn *insn, struct opstruct *operand)
{
- tic54x_symbol *cc3 = (tic54x_symbol *) str_hash_find (cc3_hash, operand->buf);
+ tic54x_symbol *cc3 = str_hash_find (cc3_hash, operand->buf);
int value = cc3 ? cc3->value : operand->exp.X_add_number << 8;
if ((value & 0x0300) != value)
@@ -3756,7 +3748,7 @@ encode_arx (tic54x_insn *insn, struct opstruct *operand)
static int
encode_cc2 (tic54x_insn *insn, struct opstruct *operand)
{
- tic54x_symbol *cc2 = (tic54x_symbol *) str_hash_find (cc2_hash, operand->buf);
+ tic54x_symbol *cc2 = str_hash_find (cc2_hash, operand->buf);
if (!cc2)
{
@@ -3915,8 +3907,7 @@ encode_operand (tic54x_insn *insn, enum optype type, struct opstruct *operand)
0, 65535, 0xFFFF);
case OP_SBIT:
{
- tic54x_symbol *sbit = (tic54x_symbol *)
- str_hash_find (sbit_hash, operand->buf);
+ tic54x_symbol *sbit = str_hash_find (sbit_hash, operand->buf);
int value = is_absolute (operand) ?
operand->exp.X_add_number : (sbit ? sbit->value : -1);
int reg = 0;
@@ -3946,16 +3937,14 @@ encode_operand (tic54x_insn *insn, enum optype type, struct opstruct *operand)
if (strcasecmp (operand->buf, "st0") == 0
|| strcasecmp (operand->buf, "st1") == 0)
{
- insn->opcode[0].word |=
- ((unsigned short) (operand->buf[2] - '0')) << 9;
+ insn->opcode[0].word |= ((uint16_t) (operand->buf[2] - '0')) << 9;
return 1;
}
else if (operand->exp.X_op == O_constant
&& (operand->exp.X_add_number == 0
|| operand->exp.X_add_number == 1))
{
- insn->opcode[0].word |=
- ((unsigned short) (operand->exp.X_add_number)) << 9;
+ insn->opcode[0].word |= ((uint16_t) (operand->exp.X_add_number)) << 9;
return 1;
}
as_bad (_("Invalid status register \"%s\""), operand->buf);
@@ -4010,7 +3999,7 @@ emit_insn (tic54x_insn *insn)
char *p = frag_more (size);
if (size == 2)
- md_number_to_chars (p, (valueT) insn->opcode[i].word, 2);
+ md_number_to_chars (p, insn->opcode[i].word, 2);
else
md_number_to_chars (p, (valueT) insn->opcode[i].word << 16, 4);
@@ -4170,7 +4159,7 @@ optimize_insn (tic54x_insn *insn)
static int
tic54x_parse_insn (tic54x_insn *insn, char *line)
{
- insn->tm = (insn_template *) str_hash_find (op_hash, insn->mnemonic);
+ insn->tm = str_hash_find (op_hash, insn->mnemonic);
if (!insn->tm)
{
as_bad (_("Unrecognized instruction \"%s\""), insn->mnemonic);
@@ -4193,8 +4182,7 @@ tic54x_parse_insn (tic54x_insn *insn, char *line)
/* SUCCESS! now try some optimizations. */
if (optimize_insn (insn))
{
- insn->tm = (insn_template *) str_hash_find (op_hash,
- insn->mnemonic);
+ insn->tm = str_hash_find (op_hash, insn->mnemonic);
continue;
}
@@ -4229,7 +4217,7 @@ next_line_shows_parallel (char *next_line)
static int
tic54x_parse_parallel_insn_firstline (tic54x_insn *insn, char *line)
{
- insn->tm = (insn_template *) str_hash_find (parop_hash, insn->mnemonic);
+ insn->tm = str_hash_find (parop_hash, insn->mnemonic);
if (!insn->tm)
{
as_bad (_("Unrecognized parallel instruction \"%s\""),
@@ -5054,13 +5042,13 @@ tic54x_undefined_symbol (char *name)
tic54x_symbol *sym;
/* Not sure how to handle predefined symbols. */
- if ((sym = (tic54x_symbol *) str_hash_find (cc_hash, name)) != NULL
- || (sym = (tic54x_symbol *) str_hash_find (cc2_hash, name)) != NULL
- || (sym = (tic54x_symbol *) str_hash_find (cc3_hash, name)) != NULL
+ if ((sym = str_hash_find (cc_hash, name)) != NULL
+ || (sym = str_hash_find (cc2_hash, name)) != NULL
+ || (sym = str_hash_find (cc3_hash, name)) != NULL
|| str_hash_find (misc_symbol_hash, name) != NULL
- || (sym = (tic54x_symbol *) str_hash_find (sbit_hash, name)) != NULL
- || (sym = (tic54x_symbol *) str_hash_find (reg_hash, name)) != NULL
- || (sym = (tic54x_symbol *) str_hash_find (mmreg_hash, name)) != NULL
+ || (sym = str_hash_find (sbit_hash, name)) != NULL
+ || (sym = str_hash_find (reg_hash, name)) != NULL
+ || (sym = str_hash_find (mmreg_hash, name)) != NULL
|| !strcasecmp (name, "a")
|| !strcasecmp (name, "b"))
{
@@ -5279,7 +5267,7 @@ tic54x_relax_frag (fragS *frag, long stretch ATTRIBUTE_UNUSED)
valueT value = bi->value;
value <<= available - size;
- value |= ((unsigned short) p[1] << 8) | p[0];
+ value |= ((uint16_t) p[1] << 8) | p[0];
md_number_to_chars (p, value, 2);
if ((prev_frag->tc_frag_data += size) == 16)
prev_frag->tc_frag_data = 0;
diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c
index aeb2239..7862236 100644
--- a/gas/config/tc-tic6x.c
+++ b/gas/config/tc-tic6x.c
@@ -659,8 +659,7 @@ s_tic6x_scomm (int ignore ATTRIBUTE_UNUSED)
symbol_set_frag (symbolP, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size,
- (char *) 0);
+ pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
*pfrag = 0;
S_SET_SIZE (symbolP, size);
S_SET_SEGMENT (symbolP, sbss_section);
@@ -669,7 +668,7 @@ s_tic6x_scomm (int ignore ATTRIBUTE_UNUSED)
}
else
{
- S_SET_VALUE (symbolP, (valueT) size);
+ S_SET_VALUE (symbolP, size);
S_SET_ALIGN (symbolP, 1 << align2);
S_SET_EXTERNAL (symbolP);
S_SET_SEGMENT (symbolP, &scom_section);
@@ -3084,14 +3083,13 @@ static valueT
md_chars_to_number (char *buf, int n)
{
valueT result = 0;
- unsigned char *p = (unsigned char *) buf;
if (target_big_endian)
{
while (n--)
{
result <<= 8;
- result |= (*p++ & 0xff);
+ result |= (*buf++ & 0xff);
}
}
else
@@ -3099,7 +3097,7 @@ md_chars_to_number (char *buf, int n)
while (n--)
{
result <<= 8;
- result |= (p[n] & 0xff);
+ result |= (buf[n] & 0xff);
}
}
@@ -3527,7 +3525,7 @@ md_assemble (char *str)
bool found_match = false;
for (i = 0; i < TIC6X_NUM_PREFER; i++)
- opc_rank[i] = (unsigned int) -1;
+ opc_rank[i] = -1u;
min_rank = TIC6X_NUM_PREFER - 1;
max_rank = 0;
@@ -3576,7 +3574,7 @@ md_assemble (char *str)
if (rank > max_rank)
max_rank = rank;
- if (opc_rank[rank] == (unsigned int) -1)
+ if (opc_rank[rank] == -1u)
opc_rank[rank] = i;
else
/* The opcode table should provide a total ordering
@@ -3607,7 +3605,7 @@ md_assemble (char *str)
{
fix_needed = false;
- if (opc_rank[try_rank] == (unsigned int) -1)
+ if (opc_rank[try_rank] == -1u)
continue;
opcode_value = tic6x_try_encode (opcm[opc_rank[try_rank]], operands,
@@ -4468,7 +4466,7 @@ tic6x_pcrel_from_section (fixS *fixp, segT sec)
&& (!S_IS_DEFINED (fixp->fx_addsy)
|| S_GET_SEGMENT (fixp->fx_addsy) != sec))
return 0;
- return (fixp->fx_where + fixp->fx_frag->fr_address) & ~(long) 0x1f;
+ return (fixp->fx_where + fixp->fx_frag->fr_address) & ~0x1fULL;
}
/* Round up a section size to the appropriate boundary. */
diff --git a/gas/config/tc-tic6x.h b/gas/config/tc-tic6x.h
index 55f2b2c..5859333 100644
--- a/gas/config/tc-tic6x.h
+++ b/gas/config/tc-tic6x.h
@@ -18,7 +18,9 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#ifndef TC_TIC6X
#define TC_TIC6X 1
+
#define TARGET_BYTES_BIG_ENDIAN 0
#define WORKING_DOT_WORD
#define DOUBLEBAR_PARALLEL
@@ -225,3 +227,5 @@ struct fde_entry;
void tic6x_cfi_endproc (struct fde_entry *fde);
#define tc_cfi_section_name ".c6xabi.exidx"
+
+#endif /* TC_TIC6X */
diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c
index 26612ac..84daf05 100644
--- a/gas/config/tc-tilegx.c
+++ b/gas/config/tc-tilegx.c
@@ -275,7 +275,7 @@ md_begin (void)
/* Initialize special operator hash table. */
special_operator_hash = str_htab_create ();
#define INSERT_SPECIAL_OP(name) \
- str_hash_insert (special_operator_hash, #name, (void *) O_##name, 0)
+ str_hash_insert_int (special_operator_hash, #name, O_##name, 0)
INSERT_SPECIAL_OP (hw0);
INSERT_SPECIAL_OP (hw1);
@@ -285,7 +285,7 @@ md_begin (void)
INSERT_SPECIAL_OP (hw1_last);
INSERT_SPECIAL_OP (hw2_last);
/* hw3_last is a convenience alias for the equivalent hw3. */
- str_hash_insert (special_operator_hash, "hw3_last", (void *) O_hw3, 0);
+ str_hash_insert_int (special_operator_hash, "hw3_last", O_hw3, 0);
INSERT_SPECIAL_OP (hw0_got);
INSERT_SPECIAL_OP (hw0_last_got);
INSERT_SPECIAL_OP (hw1_last_got);
@@ -329,14 +329,14 @@ md_begin (void)
{
char buf[64];
- str_hash_insert (main_reg_hash, tilegx_register_names[i],
- (void *) (long) (i | CANONICAL_REG_NAME_FLAG), 0);
+ str_hash_insert_int (main_reg_hash, tilegx_register_names[i],
+ i | CANONICAL_REG_NAME_FLAG, 0);
/* See if we should insert a noncanonical alias, like r63. */
sprintf (buf, "r%d", i);
if (strcmp (buf, tilegx_register_names[i]) != 0)
- str_hash_insert (main_reg_hash, xstrdup (buf),
- (void *) (long) (i | NONCANONICAL_REG_NAME_FLAG), 0);
+ str_hash_insert_int (main_reg_hash, xstrdup (buf),
+ i | NONCANONICAL_REG_NAME_FLAG, 0);
}
}
@@ -441,25 +441,25 @@ apply_special_operator (operatorT op, offsetT num, const char *file,
check_shift = 0;
/* Fall through. */
case O_hw0:
- ret = (signed short)num;
+ ret = (int16_t) num;
break;
case O_hw1_last:
check_shift = 16;
/* Fall through. */
case O_hw1:
- ret = (signed short)(num >> 16);
+ ret = (int16_t) (num >> 16);
break;
case O_hw2_last:
check_shift = 32;
/* Fall through. */
case O_hw2:
- ret = (signed short)(num >> 32);
+ ret = (int16_t) (num >> 32);
break;
case O_hw3:
- ret = (signed short)(num >> 48);
+ ret = (int16_t) (num >> 48);
break;
default:
@@ -959,10 +959,8 @@ tilegx_flush_bundle (void)
/* Figure out what pipe the fnop must be in via arithmetic.
* p0 + p1 + p2 must sum to the sum of TILEGX_PIPELINE_Y[012]. */
current_bundle[0].pipe =
- (tilegx_pipeline)((TILEGX_PIPELINE_Y0
- + TILEGX_PIPELINE_Y1
- + TILEGX_PIPELINE_Y2) -
- (current_bundle[1].pipe + current_bundle[2].pipe));
+ (TILEGX_PIPELINE_Y0 + TILEGX_PIPELINE_Y1 + TILEGX_PIPELINE_Y2
+ - current_bundle[1].pipe - current_bundle[2].pipe);
}
check_illegal_reg_writes ();
@@ -1027,10 +1025,10 @@ tilegx_parse_name (char *name, expressionS *e, char *nextcharP)
else
{
/* Look up the operator in our table. */
- void* val = str_hash_find (special_operator_hash, name);
- if (val == 0)
+ int opint = str_hash_find_int (special_operator_hash, name);
+ if (opint < 0)
return 0;
- op = (operatorT)(long)val;
+ op = opint;
}
/* Restore old '(' and skip it. */
@@ -1083,23 +1081,17 @@ 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);
- terminating_char = get_symbol_name (&regname);
+ char *regname;
+ char terminating_char = get_symbol_name (&regname);
- pval = str_hash_find (main_reg_hash, regname);
- if (pval == NULL)
+ int regno_and_flags = str_hash_find_int (main_reg_hash, regname);
+ if (regno_and_flags < 0)
as_bad (_("Expected register, got '%s'."), regname);
- regno_and_flags = (int)(size_t)pval;
- regno = EXTRACT_REGNO(regno_and_flags);
+ int regno = EXTRACT_REGNO(regno_and_flags);
if ((regno_and_flags & NONCANONICAL_REG_NAME_FLAG)
&& require_canonical_reg_names)
@@ -1357,7 +1349,7 @@ md_atof (int type, char *litP, int *sizeP)
the bigendian 386. */
for (wordP = words + prec - 1; prec--;)
{
- md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, *wordP--, sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
return 0;
@@ -1473,7 +1465,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
return;
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
{
/* We can't actually support subtracting a symbol. */
as_bad_subtract (fixP);
@@ -1684,7 +1676,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
ORing in values is OK since we know the existing bits for
this operand are zero. */
for (; bits != 0; bits >>= 8)
- *p++ |= (char)bits;
+ *p++ |= bits;
}
else
{
diff --git a/gas/config/tc-tilegx.h b/gas/config/tc-tilegx.h
index 06db441..e3789e4 100644
--- a/gas/config/tc-tilegx.h
+++ b/gas/config/tc-tilegx.h
@@ -42,7 +42,7 @@ extern const char * tilegx_target_format (void);
#define HANDLE_ALIGN(sec, fragp) tilegx_handle_align (fragp)
extern void tilegx_handle_align (struct frag *);
-#define MAX_MEM_FOR_RS_ALIGN_CODE (7 + 8)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (7 + 8)
struct tilegx_operand;
#define TC_FIX_TYPE const struct tilegx_operand *
diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c
index a7c599d..8c90217 100644
--- a/gas/config/tc-tilepro.c
+++ b/gas/config/tc-tilepro.c
@@ -218,7 +218,7 @@ md_begin (void)
/* Initialize special operator hash table. */
special_operator_hash = str_htab_create ();
#define INSERT_SPECIAL_OP(name) \
- str_hash_insert (special_operator_hash, #name, (void *) O_##name, 0)
+ str_hash_insert_int (special_operator_hash, #name, O_##name, 0)
INSERT_SPECIAL_OP(lo16);
INSERT_SPECIAL_OP(hi16);
@@ -265,29 +265,29 @@ md_begin (void)
{
char buf[64];
- str_hash_insert (main_reg_hash, tilepro_register_names[i],
- (void *) (long) (i | CANONICAL_REG_NAME_FLAG), 0);
+ str_hash_insert_int (main_reg_hash, tilepro_register_names[i],
+ i | CANONICAL_REG_NAME_FLAG, 0);
/* See if we should insert a noncanonical alias, like r63. */
sprintf (buf, "r%d", i);
if (strcmp (buf, tilepro_register_names[i]) != 0)
- str_hash_insert (main_reg_hash, xstrdup (buf),
- (void *) (long) (i | NONCANONICAL_REG_NAME_FLAG), 0);
+ str_hash_insert_int (main_reg_hash, xstrdup (buf),
+ i | NONCANONICAL_REG_NAME_FLAG, 0);
}
/* Insert obsolete backwards-compatibility register names. */
- str_hash_insert (main_reg_hash, "io0",
- (void *) (long) (TREG_IDN0 | CANONICAL_REG_NAME_FLAG), 0);
- str_hash_insert (main_reg_hash, "io1",
- (void *) (long) (TREG_IDN1 | CANONICAL_REG_NAME_FLAG), 0);
- str_hash_insert (main_reg_hash, "us0",
- (void *) (long) (TREG_UDN0 | CANONICAL_REG_NAME_FLAG), 0);
- str_hash_insert (main_reg_hash, "us1",
- (void *) (long) (TREG_UDN1 | CANONICAL_REG_NAME_FLAG), 0);
- str_hash_insert (main_reg_hash, "us2",
- (void *) (long) (TREG_UDN2 | CANONICAL_REG_NAME_FLAG), 0);
- str_hash_insert (main_reg_hash, "us3",
- (void *) (long) (TREG_UDN3 | CANONICAL_REG_NAME_FLAG), 0);
+ str_hash_insert_int (main_reg_hash, "io0",
+ TREG_IDN0 | CANONICAL_REG_NAME_FLAG, 0);
+ str_hash_insert_int (main_reg_hash, "io1",
+ TREG_IDN1 | CANONICAL_REG_NAME_FLAG, 0);
+ str_hash_insert_int (main_reg_hash, "us0",
+ TREG_UDN0 | CANONICAL_REG_NAME_FLAG, 0);
+ str_hash_insert_int (main_reg_hash, "us1",
+ TREG_UDN1 | CANONICAL_REG_NAME_FLAG, 0);
+ str_hash_insert_int (main_reg_hash, "us2",
+ TREG_UDN2 | CANONICAL_REG_NAME_FLAG, 0);
+ str_hash_insert_int (main_reg_hash, "us3",
+ TREG_UDN3 | CANONICAL_REG_NAME_FLAG, 0);
}
@@ -387,13 +387,13 @@ apply_special_operator (operatorT op, int num)
switch (op)
{
case O_lo16:
- return (signed short)num;
+ return (int16_t) num;
case O_hi16:
- return (signed short)(num >> 16);
+ return (int16_t) (num >> 16);
case O_ha16:
- return (signed short)((num + 0x8000) >> 16);
+ return (int16_t) ((num + 0x8000) >> 16);
default:
abort ();
@@ -846,10 +846,8 @@ tilepro_flush_bundle (void)
/* Figure out what pipe the fnop must be in via arithmetic.
* p0 + p1 + p2 must sum to the sum of TILEPRO_PIPELINE_Y[012]. */
current_bundle[0].pipe =
- (tilepro_pipeline)((TILEPRO_PIPELINE_Y0
- + TILEPRO_PIPELINE_Y1
- + TILEPRO_PIPELINE_Y2) -
- (current_bundle[1].pipe + current_bundle[2].pipe));
+ (TILEPRO_PIPELINE_Y0 + TILEPRO_PIPELINE_Y1 + TILEPRO_PIPELINE_Y2
+ - current_bundle[1].pipe - current_bundle[2].pipe);
}
check_illegal_reg_writes ();
@@ -878,8 +876,8 @@ tilepro_flush_bundle (void)
f);
}
- number_to_chars_littleendian (f, (unsigned int)bits, 4);
- number_to_chars_littleendian (f + 4, (unsigned int)(bits >> 32), 4);
+ number_to_chars_littleendian (f, bits, 4);
+ number_to_chars_littleendian (f + 4, bits >> 32, 4);
current_bundle_index = 0;
/* Emit DWARF2 debugging information. */
@@ -915,10 +913,10 @@ tilepro_parse_name (char *name, expressionS *e, char *nextcharP)
else
{
/* Look up the operator in our table. */
- void *val = str_hash_find (special_operator_hash, name);
- if (val == 0)
+ int opint = str_hash_find_int (special_operator_hash, name);
+ if (opint < 0)
return 0;
- op = (operatorT)(long)val;
+ op = opint;
}
/* Restore old '(' and skip it. */
@@ -977,12 +975,10 @@ parse_reg_expression (expressionS* expression)
char *regname;
char terminating_char = get_symbol_name (&regname);
- void* pval = str_hash_find (main_reg_hash, regname);
-
- if (pval == NULL)
+ int regno_and_flags = str_hash_find_int (main_reg_hash, regname);
+ if (regno_and_flags < 0)
as_bad (_("Expected register, got '%s'."), regname);
- int regno_and_flags = (int)(size_t)pval;
int regno = EXTRACT_REGNO(regno_and_flags);
if ((regno_and_flags & NONCANONICAL_REG_NAME_FLAG)
@@ -1229,7 +1225,7 @@ md_atof (int type, char *litP, int *sizeP)
the bigendian 386. */
for (wordP = words + prec - 1; prec--;)
{
- md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, *wordP--, sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
return 0;
diff --git a/gas/config/tc-tilepro.h b/gas/config/tc-tilepro.h
index 945d1ca..f985053 100644
--- a/gas/config/tc-tilepro.h
+++ b/gas/config/tc-tilepro.h
@@ -42,7 +42,7 @@
#define HANDLE_ALIGN(sec, fragp) tilepro_handle_align (fragp)
extern void tilepro_handle_align (struct frag *);
-#define MAX_MEM_FOR_RS_ALIGN_CODE (7 + 8)
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (7 + 8)
struct tilepro_operand;
#define TC_FIX_TYPE const struct tilepro_operand *
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index 0a48343..176910d 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -247,8 +247,7 @@ v850_offset (int ignore ATTRIBUTE_UNUSED)
char *pfrag;
int temp = get_absolute_expression ();
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, (symbolS *)0,
- (offsetT) temp, (char *) 0);
+ pfrag = frag_var (rs_org, 1, 1, 0, NULL, temp, NULL);
*pfrag = 0;
demand_empty_rest_of_line ();
@@ -345,15 +344,10 @@ v850_comm (int area)
int old_subsec;
char *pfrag;
int align;
- flagword applicable;
old_sec = now_seg;
old_subsec = now_subseg;
- applicable = bfd_applicable_section_flags (stdoutput);
-
- applicable &= SEC_ALLOC;
-
switch (area)
{
case SCOMMON_SECTION:
@@ -412,8 +406,7 @@ v850_comm (int area)
}
symbol_set_frag (symbolP, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- (offsetT) size, (char *) 0);
+ pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
*pfrag = 0;
S_SET_SIZE (symbolP, size);
@@ -1675,42 +1668,29 @@ md_atof (int type, char *litp, int *sizep)
void
md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
- asection *sec,
+ asection *sec ATTRIBUTE_UNUSED,
fragS *fragP)
{
- union u
- {
- bfd_reloc_code_real_type fx_r_type;
- char * fr_opcode;
- }
- opcode_converter;
- subseg_change (sec, 0);
-
- opcode_converter.fr_opcode = fragP->fr_opcode;
-
- subseg_change (sec, 0);
+ unsigned int opindex = (uintptr_t) fragP->fr_opcode;
if (fragP->fr_subtype == SUBYPTE_LOOP_16_22)
{
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
- fragP->fr_offset, 1,
- BFD_RELOC_UNUSED + opcode_converter.fx_r_type);
+ fragP->fr_offset, 1, BFD_RELOC_UNUSED + opindex);
fragP->fr_fix += 4;
}
else if (fragP->fr_subtype == SUBYPTE_LOOP_16_22 + 1)
{
- unsigned char * buffer =
- (unsigned char *) (fragP->fr_fix + &fragP->fr_literal[0]);
- int loop_reg = (buffer[0] & 0x1f);
+ char *buffer = fragP->fr_literal + fragP->fr_fix;
+ int loop_reg = buffer[0] & 0x1f;
/* Add -1.reg. */
- md_number_to_chars ((char *) buffer, 0x025f | (loop_reg << 11), 2);
+ md_number_to_chars (buffer, 0x025f | (loop_reg << 11), 2);
/* Now create the conditional branch + fixup to the final target. */
/* 0x000107ea = bne LBL(disp17). */
- md_number_to_chars ((char *) buffer + 2, 0x000107ea, 4);
+ md_number_to_chars (buffer + 2, 0x000107ea, 4);
fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol,
- fragP->fr_offset, 1,
- BFD_RELOC_V850_17_PCREL);
+ fragP->fr_offset, 1, BFD_RELOC_V850_17_PCREL);
fragP->fr_fix += 6;
}
/* In range conditional or unconditional branch. */
@@ -1727,8 +1707,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
{
fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol,
- fragP->fr_offset, 1,
- BFD_RELOC_UNUSED + opcode_converter.fx_r_type);
+ fragP->fr_offset, 1, BFD_RELOC_UNUSED + opindex);
fragP->fr_fix += 2;
}
/* V850e2r-v3 17bit conditional branch. */
@@ -1737,8 +1716,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22 + 1
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22_32 + 1)
{
- unsigned char *buffer =
- (unsigned char *) (fragP->fr_fix + &fragP->fr_literal[0]);
+ char *buffer = fragP->fr_literal + fragP->fr_fix;
buffer[0] &= 0x0f; /* Use condition. */
buffer[0] |= 0xe0;
@@ -1746,7 +1724,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
/* Now create the unconditional branch + fixup to the final
target. */
- md_number_to_chars ((char *) buffer + 2, 0x0001, 2);
+ md_number_to_chars (buffer + 2, 0x0001, 2);
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
fragP->fr_offset, 1, BFD_RELOC_V850_17_PCREL);
fragP->fr_fix += 4;
@@ -1757,8 +1735,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
|| fragP->fr_subtype == SUBYPTE_COND_9_17_22 + 2
|| fragP->fr_subtype == SUBYPTE_COND_9_17_22_32 + 2)
{
- unsigned char *buffer =
- (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
+ char *buffer = fragP->fr_literal + fragP->fr_fix;
/* Reverse the condition of the first branch. */
buffer[0] ^= 0x08;
@@ -1771,7 +1748,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
/* Now create the unconditional branch + fixup to the final
target. */
- md_number_to_chars ((char *) buffer + 2, 0x00000780, 4);
+ md_number_to_chars (buffer + 2, 0x00000780, 4);
fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol,
fragP->fr_offset, 1, BFD_RELOC_V850_22_PCREL);
fragP->fr_fix += 6;
@@ -1780,8 +1757,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
else if (fragP->fr_subtype == SUBYPTE_COND_9_22_32 + 2
|| fragP->fr_subtype == SUBYPTE_COND_9_17_22_32 + 3)
{
- unsigned char *buffer =
- (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
+ char *buffer = fragP->fr_literal + fragP->fr_fix;
/* Reverse the condition of the first branch. */
buffer[0] ^= 0x08;
@@ -1794,7 +1770,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
/* Now create the unconditional branch + fixup to the final
target. */
- md_number_to_chars ((char *) buffer + 2, 0x02e0, 2);
+ md_number_to_chars (buffer + 2, 0x02e0, 2);
fix_new (fragP, fragP->fr_fix + 4, 4, fragP->fr_symbol,
fragP->fr_offset + 2, 1, BFD_RELOC_V850_32_PCREL);
fragP->fr_fix += 8;
@@ -1822,8 +1798,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22 + 2
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22_32 + 2)
{
- unsigned char *buffer =
- (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
+ char *buffer = fragP->fr_literal + fragP->fr_fix;
/* bsa .+4 */
buffer[0] &= 0x8f;
@@ -1831,23 +1806,21 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
buffer[1] &= 0x07;
/* br .+6 */
- md_number_to_chars ((char *) buffer + 2, 0x05b5, 2);
+ md_number_to_chars (buffer + 2, 0x05b5, 2);
/* Now create the unconditional branch + fixup to the final
target. */
/* jr SYM */
- md_number_to_chars ((char *) buffer + 4, 0x00000780, 4);
+ md_number_to_chars (buffer + 4, 0x00000780, 4);
fix_new (fragP, fragP->fr_fix + 4, 4, fragP->fr_symbol,
- fragP->fr_offset, 1,
- BFD_RELOC_V850_22_PCREL);
+ fragP->fr_offset, 1, BFD_RELOC_V850_22_PCREL);
fragP->fr_fix += 8;
}
/* Out of range SA conditional branch. Emit a branch around a 32bit jump. */
else if (fragP->fr_subtype == SUBYPTE_SA_9_22_32 + 2
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22_32 + 3)
{
- unsigned char *buffer =
- (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
+ char *buffer = fragP->fr_literal + fragP->fr_fix;
/* bsa .+2 */
buffer[0] &= 0x8f;
@@ -1855,12 +1828,12 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
buffer[1] &= 0x07;
/* br .+8 */
- md_number_to_chars ((char *) buffer + 2, 0x05c5, 2);
+ md_number_to_chars (buffer + 2, 0x05c5, 2);
/* Now create the unconditional branch + fixup to the final
target. */
/* jr SYM */
- md_number_to_chars ((char *) buffer + 4, 0x02e0, 2);
+ md_number_to_chars (buffer + 4, 0x02e0, 2);
fix_new (fragP, fragP->fr_fix + 6, 4, fragP->fr_symbol,
fragP->fr_offset + 2, 1, BFD_RELOC_V850_32_PCREL);
@@ -1958,7 +1931,7 @@ md_begin (void)
{
if (strcmp (prev_name, op->name))
{
- prev_name = (char *) op->name;
+ prev_name = op->name;
str_hash_insert (v850_hash, op->name, op, 0);
}
op++;
@@ -2312,7 +2285,7 @@ md_assemble (char *str)
*s++ = '\0';
/* Find the first opcode with the proper name. */
- opcode = (struct v850_opcode *) str_hash_find (v850_hash, str);
+ opcode = str_hash_find (v850_hash, str);
if (opcode == NULL)
{
/* xgettext:c-format */
@@ -3070,7 +3043,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 6, 2, SUBYPTE_LOOP_16_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f+4, 0, 4);
}
@@ -3087,7 +3060,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 4, 2, SUBYPTE_UNCOND_9_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 2);
}
@@ -3096,7 +3069,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_UNCOND_9_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 4);
}
@@ -3113,7 +3086,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_SA_9_17_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
@@ -3122,7 +3095,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_COND_9_17_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 4);
}
@@ -3134,7 +3107,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_SA_9_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
@@ -3143,7 +3116,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_COND_9_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 4);
}
@@ -3158,7 +3131,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 10, 8, SUBYPTE_SA_9_17_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 8);
}
@@ -3167,7 +3140,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_COND_9_17_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
@@ -3179,7 +3152,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 10, 8, SUBYPTE_SA_9_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 8);
}
@@ -3188,7 +3161,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_COND_9_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *) (uintptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
@@ -3312,8 +3285,7 @@ md_assemble (char *str)
f - frag_now->fr_literal, 4,
& fixups[i].exp,
(operand->flags & V850_PCREL) != 0,
- (bfd_reloc_code_real_type) (fixups[i].opindex
- + (int) BFD_RELOC_UNUSED));
+ fixups[i].opindex + BFD_RELOC_UNUSED);
}
}
@@ -3396,7 +3368,7 @@ v850_pcrel_from_section (fixS *fixp, segT section)
/* If the symbol is undefined, or in a section other than our own,
or it is weak (in which case it may well be in another section,
then let the linker figure it out. */
- if (fixp->fx_addsy != (symbolS *) NULL
+ if (fixp->fx_addsy != NULL
&& (! S_IS_DEFINED (fixp->fx_addsy)
|| S_IS_WEAK (fixp->fx_addsy)
|| (S_GET_SEGMENT (fixp->fx_addsy) != section)))
@@ -3420,7 +3392,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
return;
}
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_addnumber = value,
fixP->fx_done = 1;
@@ -3430,7 +3402,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
else
{
value = fixP->fx_offset;
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
{
if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
value -= S_GET_VALUE (fixP->fx_subsy);
@@ -3441,14 +3413,14 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
fixP->fx_addnumber = value;
}
- if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
{
int opindex;
const struct v850_operand *operand;
unsigned long insn;
const char *errmsg = NULL;
- opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+ opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
operand = &v850_operands[opindex];
/* Fetch the instruction, insert the fully resolved operand
@@ -3459,9 +3431,9 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
where = fixP->fx_frag->fr_literal + fixP->fx_where;
if (fixP->fx_size > 2)
- insn = bfd_getl32 ((unsigned char *) where);
+ insn = bfd_getl32 (where);
else
- insn = bfd_getl16 ((unsigned char *) where);
+ insn = bfd_getl16 (where);
/* When inserting loop offsets a backwards displacement
is encoded as a positive value. */
@@ -3474,9 +3446,9 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
as_warn_where (fixP->fx_file, fixP->fx_line, "%s", errmsg);
if (fixP->fx_size > 2)
- bfd_putl32 ((bfd_vma) insn, (unsigned char *) where);
+ bfd_putl32 (insn, where);
else
- bfd_putl16 ((bfd_vma) insn, (unsigned char *) where);
+ bfd_putl16 (insn, where);
if (fixP->fx_done)
/* Nothing else to do here. */
@@ -3512,7 +3484,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
&& ((struct v850_operand *) fixP->tc_fix_data)->insert != NULL)
{
const char * message = NULL;
- struct v850_operand * operand = (struct v850_operand *) fixP->tc_fix_data;
+ struct v850_operand * operand = fixP->tc_fix_data;
unsigned long insn;
/* The variable "where" currently points at the exact point inside
@@ -3525,14 +3497,14 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
else if (fixP->fx_size == 1)
where -= 3;
- insn = bfd_getl32 ((unsigned char *) where);
+ insn = bfd_getl32 (where);
/* Use the operand's insertion procedure, if present, in order to
make sure that the value is correctly stored in the insn. */
insn = operand->insert (insn, (offsetT) value, & message);
/* Ignore message even if it is set. */
- bfd_putl32 ((bfd_vma) insn, (unsigned char *) where);
+ bfd_putl32 (insn, where);
}
else
{
@@ -3540,17 +3512,17 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
{
case BFD_RELOC_V850_32_ABS:
case BFD_RELOC_V850_32_PCREL:
- bfd_putl32 (value & 0xfffffffe, (unsigned char *) where);
+ bfd_putl32 (value & 0xfffffffe, where);
break;
case BFD_RELOC_32:
- bfd_putl32 (value, (unsigned char *) where);
+ bfd_putl32 (value, where);
break;
case BFD_RELOC_V850_23:
bfd_putl32 (((value & 0x7f) << 4) | ((value & 0x7fff80) << (16-7))
| (bfd_getl32 (where) & ~((0x7f << 4) | (0xffff << 16))),
- (unsigned char *) where);
+ where);
break;
case BFD_RELOC_16:
@@ -3561,7 +3533,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_V850_SDA_16_16_OFFSET:
case BFD_RELOC_V850_TDA_16_16_OFFSET:
case BFD_RELOC_V850_CALLT_16_16_OFFSET:
- bfd_putl16 (value & 0xffff, (unsigned char *) where);
+ bfd_putl16 (value & 0xffff, where);
break;
case BFD_RELOC_8:
@@ -3580,7 +3552,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_V850_16_PCREL:
bfd_putl16 ((-value & 0xfffe) | (bfd_getl16 (where + 2) & 0x0001),
- (unsigned char *) (where + 2));
+ where + 2);
break;
case BFD_RELOC_V850_22_PCREL:
@@ -3592,7 +3564,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_V850_LO16_S1:
case BFD_RELOC_V850_ZDA_15_16_OFFSET:
case BFD_RELOC_V850_SDA_15_16_OFFSET:
- bfd_putl16 (value & 0xfffe, (unsigned char *) where);
+ bfd_putl16 (value & 0xfffe, where);
break;
case BFD_RELOC_V850_16_SPLIT_OFFSET:
@@ -3748,7 +3720,7 @@ v850_md_finish (void)
/* Write the note type. */
p = frag_more (4);
- md_number_to_chars (p, (valueT) id, 4);
+ md_number_to_chars (p, id, 4);
/* Write the name field. */
p = frag_more (4);
diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c
index 0b39d98..1705380 100644
--- a/gas/config/tc-vax.c
+++ b/gas/config/tc-vax.c
@@ -278,7 +278,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
{
valueT value = * valueP;
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
if (fixP->fx_addsy == NULL)
@@ -332,8 +332,7 @@ bignum_copy (LITTLENUM_TYPE *in,
LITTLENUM_TYPE *p; /* -> most significant (non-zero) input
littlenum. */
- memcpy ((void *) out, (void *) in,
- (unsigned int) out_length << LITTLENUM_SHIFT);
+ memcpy (out, in, (unsigned int) out_length << LITTLENUM_SHIFT);
for (p = in + in_length - 1; p >= in; --p)
{
if (*p)
@@ -346,11 +345,10 @@ bignum_copy (LITTLENUM_TYPE *in,
}
else
{
- memcpy ((char *) out, (char *) in,
- (unsigned int) in_length << LITTLENUM_SHIFT);
+ memcpy (out, in, (unsigned int) in_length << LITTLENUM_SHIFT);
if (out_length > in_length)
- memset ((char *) (out + in_length), '\0',
+ memset (out + in_length, 0,
(unsigned int) (out_length - in_length) << LITTLENUM_SHIFT);
significant_littlenums_dropped = 0;
@@ -1882,7 +1880,7 @@ vip (struct vit *vitP, /* We build an exploded instruction here. */
/* Here with instring pointing to what better be an op-name, and p
pointing to character just past that.
We trust instring points to an op-name, with no whitespace. */
- vwP = (struct vot_wot *) str_hash_find (op_hash, instring);
+ vwP = str_hash_find (op_hash, instring);
/* Restore char after op-code. */
*p = c;
if (vwP == 0)
@@ -3356,7 +3354,7 @@ vax_cons_fix_new (fragS *frag, int where, unsigned int nbytes, expressionS *exp,
: nbytes == 2 ? BFD_RELOC_16
: BFD_RELOC_32);
- fix_new_exp (frag, where, (int) nbytes, exp, 0, r);
+ fix_new_exp (frag, where, nbytes, exp, 0, r);
}
const char *
diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c
index c00db12..01767f3 100644
--- a/gas/config/tc-visium.c
+++ b/gas/config/tc-visium.c
@@ -201,7 +201,7 @@ md_section_align (asection *seg, valueT addr)
{
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
void
@@ -412,10 +412,9 @@ relaxed_symbol_addr (fragS *fragp, long stretch)
if (f->fr_type == rs_align || f->fr_type == rs_align_code)
{
if (stretch < 0)
- stretch = - ((- stretch)
- & ~ ((1 << (int) f->fr_offset) - 1));
+ stretch = -(-stretch & ~((1ul << f->fr_offset) - 1));
else
- stretch &= ~ ((1 << (int) f->fr_offset) - 1);
+ stretch &= ~((1ul << f->fr_offset) - 1);
if (stretch == 0)
break;
}
@@ -493,7 +492,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED,
long
visium_pcrel_from_section (fixS *fixP, segT sec)
{
- if (fixP->fx_addsy != (symbolS *) NULL
+ if (fixP->fx_addsy != NULL
&& (!S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
{
@@ -555,30 +554,16 @@ visium_handle_align (fragS *fragP)
if (count == 0)
return;
- fragP->fr_var = 4;
-
if (count > 4 * nop_limit && count <= 131068)
{
- struct frag *rest;
-
- /* Make a branch, then follow with nops. Insert another
- frag to handle the nops. */
+ /* Make a branch, then follow with nops. */
md_number_to_chars (p, 0x78000000 + (count >> 2), 4);
visium_update_parity_bit (p);
-
- rest = xmalloc (SIZEOF_STRUCT_FRAG + 4);
- memcpy (rest, fragP, SIZEOF_STRUCT_FRAG);
- fragP->fr_next = rest;
- rest->fr_address += rest->fr_fix + 4;
- rest->fr_fix = 0;
- /* If we leave the next frag as rs_align_code we'll come here
- again, resulting in a bunch of branches rather than a
- branch followed by nops. */
- rest->fr_type = rs_align;
- p = rest->fr_literal;
+ p += 4;
+ fragP->fr_fix += 4;
}
- memset (p, 0, 4);
+ *p = 0;
}
/* Apply a fixS to the frags, now that we know the value it ought to
@@ -648,7 +633,7 @@ md_apply_fix (fixS * fixP, valueT * value, segT segment)
break;
default:
/* It's a relocation against an instruction. */
- insn = bfd_getb32 ((unsigned char *) buf);
+ insn = bfd_getb32 (buf);
switch (fixP->fx_r_type)
{
@@ -697,11 +682,11 @@ md_apply_fix (fixS * fixP, valueT * value, segT segment)
default:
as_bad_where (fixP->fx_file, fixP->fx_line,
"bad or unhandled relocation type: 0x%02x",
- fixP->fx_r_type);
+ (unsigned int) fixP->fx_r_type);
break;
}
- bfd_putb32 (insn, (unsigned char *) buf);
+ bfd_putb32 (insn, buf);
visium_update_parity_bit (buf);
break;
}
@@ -845,8 +830,7 @@ md_atof (int type, char *litP, int *sizeP)
{
for (i = 0; i < prec; i++)
{
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
}
@@ -854,8 +838,7 @@ md_atof (int type, char *litP, int *sizeP)
{
for (i = prec - 1; i >= 0; i--)
{
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
}
@@ -1389,9 +1372,8 @@ md_assemble (char *str0)
if (imm < 0 || imm > 31)
as_bad ("immediate value out of range");
- opcode |=
- (r1 << 10) | (r2 << 16) | (1 << 9) | ((imm & 0x1f) <<
- 4);
+ opcode |= ((r1 << 10) | (r2 << 16) | (1 << 9)
+ | ((imm & 0x1f) << 4));
}
else
{
@@ -1905,9 +1887,8 @@ md_assemble (char *str0)
if (finst < 0 || finst > 15)
as_bad ("finst out of range");
- opcode |=
- ((finst & 0xf) << 27) | (r1 << 10) | (r2 << 16) | (r3 <<
- 4);
+ opcode |= (((finst & 0xf) << 27)
+ | (r1 << 10) | (r2 << 16) | (r3 << 4));
}
else
{
@@ -1971,9 +1952,8 @@ md_assemble (char *str0)
if (finst < 0 || finst > 15)
as_bad ("finst out of range");
- opcode |=
- ((finst & 0xf) << 27) | (r1 << 10) | (r2 << 16) | (r3 <<
- 4);
+ opcode |= (((finst & 0xf) << 27)
+ | (r1 << 10) | (r2 << 16) | (r3 << 4));
}
else
{
diff --git a/gas/config/tc-visium.h b/gas/config/tc-visium.h
index 01f8628..8be7f77 100644
--- a/gas/config/tc-visium.h
+++ b/gas/config/tc-visium.h
@@ -45,6 +45,7 @@
#define tc_fix_adjustable(FIXP) visium_fix_adjustable (FIXP)
extern bool visium_fix_adjustable (struct fix *);
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) (4 + 1)
#define HANDLE_ALIGN(SEC, FRAGP) \
if ((FRAGP)->fr_type == rs_align_code) \
visium_handle_align (FRAGP);
diff --git a/gas/config/tc-wasm32.c b/gas/config/tc-wasm32.c
index c9b0787..23d2b43 100644
--- a/gas/config/tc-wasm32.c
+++ b/gas/config/tc-wasm32.c
@@ -178,7 +178,7 @@ valueT
md_section_align (asection * seg, valueT addr)
{
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
/* Apply a fixup, return TRUE if done (and no relocation is
@@ -204,7 +204,7 @@ void
md_apply_fix (fixS * fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
- long val = (long) *valP;
+ valueT val = *valP;
if (fixP->fx_pcrel)
{
@@ -746,7 +746,7 @@ md_assemble (char *str)
if (!op[0])
as_bad (_("can't find opcode "));
- opcode = (struct wasm32_opcode_s *) str_hash_find (wasm32_hash, op);
+ opcode = str_hash_find (wasm32_hash, op);
if (opcode == NULL)
{
diff --git a/gas/config/tc-wasm32.h b/gas/config/tc-wasm32.h
index b2ccf1c..2a84a97 100644
--- a/gas/config/tc-wasm32.h
+++ b/gas/config/tc-wasm32.h
@@ -75,7 +75,6 @@ extern int wasm32_force_relocation (struct fix *);
#define elf_tc_final_processing()
#define md_post_relax_hook
#define md_start_line_hook()
-#define HANDLE_ALIGN(sec, fragP)
extern bool wasm32_fix_adjustable (struct fix *);
diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c
index 5e09ee5..4a7829f 100644
--- a/gas/config/tc-xgate.c
+++ b/gas/config/tc-xgate.c
@@ -104,7 +104,7 @@ static void get_default_target (void);
static char *extract_word (char *, char *, int);
static struct xgate_opcode *xgate_find_match (struct xgate_opcode_handle *,
int, s_operand [], unsigned int);
-static int cmp_opcode (struct xgate_opcode *, struct xgate_opcode *);
+static int cmp_opcode (const void *, const void *);
static void xgate_print_table (void);
static unsigned int xgate_get_operands (char *, s_operand []);
static register_id reg_name_search (char *);
@@ -308,7 +308,7 @@ md_begin (void)
xgate_op_table[i] = xgate_opcode_ptr[i];
qsort (xgate_op_table, xgate_num_opcodes, sizeof (struct xgate_opcode),
- (int (*)(const void *, const void *)) cmp_opcode);
+ cmp_opcode);
/* Calculate number of handles since this will be
smaller than the raw number of opcodes in the table. */
@@ -466,7 +466,7 @@ valueT
md_section_align (asection * seg, valueT addr)
{
int align = bfd_section_alignment (seg);
- return ((addr + (1 << align) - 1) & -(1 << align));
+ return (addr + ((valueT) 1 << align) - 1) & -((valueT) 1 << align);
}
void
@@ -491,8 +491,7 @@ md_assemble (char *input_line)
if (!op_name[0])
as_bad (_("opcode missing or not found on input line"));
- opcode_handle = (struct xgate_opcode_handle *) str_hash_find (xgate_hash,
- op_name);
+ opcode_handle = str_hash_find (xgate_hash, op_name);
if (!opcode_handle)
as_bad (_("opcode %s not found in opcode hash table"), op_name);
else
@@ -541,9 +540,7 @@ md_assemble (char *input_line)
input_line = macro_inline; /* Rewind. */
p = extract_word (p, op_name, 10);
- opcode_handle
- = (struct xgate_opcode_handle *) str_hash_find (xgate_hash,
- op_name);
+ opcode_handle = str_hash_find (xgate_hash, op_name);
if (!opcode_handle)
{
as_bad (_(": processing macro, real opcode handle"
@@ -624,7 +621,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
else
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line, _
("Relocation %d is not supported by object file format."),
@@ -655,11 +652,11 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
/* If the fixup is done mark it done so no further symbol resolution
will take place. */
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
/* We don't actually support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
where = fixP->fx_frag->fr_literal + fixP->fx_where;
@@ -708,7 +705,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
_("Value out of 16-bit range."));
value >>= 8;
value &= 0x00ff;
- bfd_putb16 ((bfd_vma) value | opcode, (void *) where);
+ bfd_putb16 (value | opcode, where);
break;
case BFD_RELOC_XGATE_24:
case BFD_RELOC_XGATE_IMM8_LO:
@@ -716,7 +713,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value out of 16-bit range."));
value &= 0x00ff;
- bfd_putb16 ((bfd_vma) value | opcode, (void *) where);
+ bfd_putb16 (value | opcode, where);
break;
case BFD_RELOC_XGATE_IMM3:
if (value < 0 || value > 7)
@@ -740,13 +737,13 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
number_to_chars_bigendian (where, (opcode | value), 2);
break;
case BFD_RELOC_8:
- ((bfd_byte *) where)[0] = (bfd_byte) value;
+ *where = value & 0xff;
break;
case BFD_RELOC_32:
- bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb32 (value, where);
break;
case BFD_RELOC_16:
- bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
+ bfd_putb16 (value, where);
break;
default:
as_fatal (_("Line %d: unknown relocation type: 0x%x."), fixP->fx_line,
@@ -899,8 +896,10 @@ xgate_parse_exp (char *s, expressionS * op)
}
static int
-cmp_opcode (struct xgate_opcode *op1, struct xgate_opcode *op2)
+cmp_opcode (const void *p1, const void *p2)
{
+ const struct xgate_opcode *op1 = p1;
+ const struct xgate_opcode *op2 = p2;
return strcmp (op1->name, op2->name);
}
@@ -1124,7 +1123,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[])
unsigned short oper_mask = 0;
int operand_bit_length = 0;
unsigned int operand = 0;
- char n_operand_bits = 0;
char first_operand_equals_second = 0;
int i = 0;
char c = 0;
@@ -1140,7 +1138,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[])
{
oper_mask <<= 1;
oper_mask += 1;
- n_operand_bits++;
}
}
diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c
index 83bf873..7a90316 100644
--- a/gas/config/tc-xstormy16.c
+++ b/gas/config/tc-xstormy16.c
@@ -331,7 +331,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
long
md_pcrel_from_section (fixS * fixP, segT sec)
{
- if ((fixP->fx_addsy != (symbolS *) NULL
+ if ((fixP->fx_addsy != NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
|| xstormy16_force_relocation (fixP))
@@ -474,16 +474,16 @@ xstormy16_md_apply_fix (fixS * fixP,
break;
}
- if (fixP->fx_addsy == (symbolS *) NULL)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
/* We don't actually support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != NULL)
as_bad_subtract (fixP);
- if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
{
- int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+ int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (cd, opindex);
const char *errmsg;
bfd_reloc_code_real_type reloc_type;
@@ -496,7 +496,7 @@ xstormy16_md_apply_fix (fixS * fixP,
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);
+ CGEN_CPU_SET_VMA_OPERAND (cd) (cd, opindex, fields, value);
#if CGEN_INT_INSN_P
{
@@ -507,7 +507,7 @@ xstormy16_md_apply_fix (fixS * fixP,
/* ??? 0 is passed for `pc'. */
errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields,
- &insn_value, (bfd_vma) 0);
+ &insn_value, 0);
cgen_put_insn_value (cd, (unsigned char *) where,
CGEN_INSN_BITSIZE (insn), insn_value,
gas_cgen_cpu_desc->insn_endian);
@@ -516,7 +516,7 @@ xstormy16_md_apply_fix (fixS * fixP,
/* ??? 0 is passed for `pc'. */
errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields,
(unsigned char *) where,
- (bfd_vma) 0);
+ 0);
#endif
if (errmsg)
as_bad_where (fixP->fx_file, fixP->fx_line, "%s", errmsg);
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index ed53b6d..af1154e 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -1312,7 +1312,7 @@ get_directive (directiveE *directive, bool *negated)
if (strncmp (directive_string, directive_info[i].name, len) == 0)
{
input_line_pointer += len;
- *directive = (directiveE) i;
+ *directive = i;
if (*negated && !directive_info[i].can_be_negated)
as_bad (_("directive %s cannot be negated"),
directive_info[i].name);
@@ -1321,7 +1321,7 @@ get_directive (directiveE *directive, bool *negated)
}
as_bad (_("unknown directive"));
- *directive = (directiveE) XTENSA_UNDEFINED;
+ *directive = XTENSA_UNDEFINED;
}
@@ -1705,7 +1705,7 @@ xtensa_elf_cons (int nbytes)
as_bad (_("invalid use of %s relocation"), reloc_howto->name);
else
{
- char *p = frag_more ((int) nbytes);
+ char *p = frag_more (nbytes);
xtensa_set_frag_assembly_state (frag_now);
fix_new_exp (frag_now, p - frag_now->fr_literal,
nbytes, &exp, reloc_howto->pc_relative, reloc);
@@ -1714,7 +1714,7 @@ xtensa_elf_cons (int nbytes)
else
{
xtensa_set_frag_assembly_state (frag_now);
- emit_expr (&exp, (unsigned int) nbytes);
+ emit_expr (&exp, nbytes);
}
}
while (*input_line_pointer++ == ',');
@@ -1869,7 +1869,7 @@ expression_end (const char *name)
}
-#define ERROR_REG_NUM ((unsigned) -1)
+#define ERROR_REG_NUM (-1u)
static unsigned
tc_get_register (const char *prefix)
@@ -1903,7 +1903,7 @@ tc_get_register (const char *prefix)
return ERROR_REG_NUM;
}
- if (!ISDIGIT ((unsigned char) *input_line_pointer))
+ if (!ISDIGIT (*input_line_pointer))
{
as_bad (_("bad register number: %s"), input_line_pointer);
return ERROR_REG_NUM;
@@ -1911,7 +1911,7 @@ tc_get_register (const char *prefix)
reg = 0;
- while (ISDIGIT ((int) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
reg = reg * 10 + *input_line_pointer++ - '0';
if (!(next_expr = expression_end (input_line_pointer)))
@@ -1961,7 +1961,7 @@ expression_maybe_register (xtensa_opcode opc, int opnd, expressionS *tok)
case BFD_RELOC_HI16:
if (tok->X_op == O_constant)
{
- tok->X_add_number = ((unsigned) tok->X_add_number) >> 16;
+ tok->X_add_number = ((uint32_t) tok->X_add_number) >> 16;
return;
}
break;
@@ -2522,7 +2522,7 @@ xg_translate_idioms (char **popname, int *pnum_args, char **arg_strings)
{
if (*pnum_args == 0)
{
- arg_strings[0] = (char *) xmalloc (2);
+ arg_strings[0] = xmalloc (2);
strcpy (arg_strings[0], "0");
*pnum_args = 1;
}
@@ -5378,7 +5378,7 @@ xtensa_frob_label (symbolS *sym)
/* Since the label was already attached to a frag associated with the
previous basic block, it now needs to be reset to the current frag. */
symbol_set_frag (sym, frag_now);
- S_SET_VALUE (sym, (valueT) frag_now_fix ());
+ S_SET_VALUE (sym, frag_now_fix ());
if (generating_literals)
xtensa_add_literal_sym (sym);
@@ -7660,6 +7660,12 @@ static size_t xg_find_chain_entry (struct trampoline_chain *tc,
return a;
}
+static valueT
+vma_abs (offsetT v)
+{
+ return v < 0 ? -(valueT) v : (valueT) v;
+}
+
/* Find the best jump target for the source in the given trampoline chain.
The best jump target is the one that results in the shortest path to the
final target, it's the location of the jump closest to the final target,
@@ -7686,7 +7692,7 @@ xg_get_best_chain_entry (struct trampoline_chain *tc, addressT source)
chained_target = S_GET_VALUE(next->sym) + next->offset;
off = source - chained_target;
- if (labs (off) >= J_RANGE - J_MARGIN)
+ if (vma_abs (off) >= J_RANGE - J_MARGIN)
break;
i += step;
@@ -7696,8 +7702,8 @@ xg_get_best_chain_entry (struct trampoline_chain *tc, addressT source)
chained_target = S_GET_VALUE(e->sym) + e->offset;
off = source - chained_target;
- if (labs (off) < J_MARGIN ||
- labs (off) >= J_RANGE - J_MARGIN)
+ if (vma_abs (off) < J_MARGIN
+ || vma_abs (off) >= J_RANGE - J_MARGIN)
return &tc->target;
return tc->entry + i;
}
@@ -8995,15 +9001,15 @@ xtensa_add_config_info (void)
/* Follow the standard note section layout:
First write the length of the name string. */
p = frag_more (4);
- md_number_to_chars (p, (valueT) XTINFO_NAMESZ, 4);
+ md_number_to_chars (p, XTINFO_NAMESZ, 4);
/* Next comes the length of the "descriptor", i.e., the actual data. */
p = frag_more (4);
- md_number_to_chars (p, (valueT) sz, 4);
+ md_number_to_chars (p, sz, 4);
/* Write the note type. */
p = frag_more (4);
- md_number_to_chars (p, (valueT) XTINFO_TYPE, 4);
+ md_number_to_chars (p, XTINFO_TYPE, 4);
/* Write the name field. */
p = frag_more (XTINFO_NAMESZ);
@@ -9359,7 +9365,7 @@ static addressT xg_get_fulcrum (addressT source, addressT target)
offsetT delta = target - source;
int n;
- n = (labs (delta) + J_RANGE - J_MARGIN - 1) / (J_RANGE - J_MARGIN);
+ n = (vma_abs (delta) + J_RANGE - J_MARGIN - 1) / (J_RANGE - J_MARGIN);
return source + delta / n;
}
@@ -9410,11 +9416,11 @@ static size_t xg_find_best_trampoline (struct trampoline_index *idx,
/* Stop if some trampoline is found and the search is more than
J_RANGE / 4 from the projected fulcrum. A trampoline w/o jump
around is nice, but it shouldn't have much overhead. */
- if (best < idx->n_entries && labs (off) > J_RANGE / 4)
+ if (best < idx->n_entries && vma_abs (off) > J_RANGE / 4)
return best;
off = trampoline_frag->fr_address - source;
- if (labs (off) < J_RANGE - J_MARGIN)
+ if (vma_abs (off) < J_RANGE - J_MARGIN)
{
++checked;
/* Stop if a trampoline w/o jump around is found or initialized
@@ -9480,7 +9486,7 @@ static bool xg_is_relaxable_fixup (fixS *fixP)
target = S_GET_VALUE (s) + fixP->fx_offset;
delta = target - addr;
- if (labs (delta) < J_RANGE - J_MARGIN)
+ if (vma_abs (delta) < J_RANGE - J_MARGIN)
return false;
xtensa_insnbuf_from_chars (isa, trampoline_buf,
@@ -10315,7 +10321,7 @@ relax_frag_immed (segT segP,
min_steps, stretch);
gas_assert (num_steps >= min_steps && num_steps <= RELAX_IMMED_MAXSTEPS);
- fragP->tc_frag_data.slot_subtypes[slot] = (int) RELAX_IMMED + num_steps;
+ fragP->tc_frag_data.slot_subtypes[slot] = RELAX_IMMED + num_steps;
/* Figure out the number of bytes needed. */
num_literal_bytes = get_num_stack_literal_bytes (&istack);
@@ -10344,8 +10350,7 @@ relax_frag_immed (segT segP,
min_steps, stretch + old_size);
gas_assert (num_steps >= min_steps && num_steps <= RELAX_IMMED_MAXSTEPS);
- fragP->tc_frag_data.slot_subtypes[slot]
- = (int) RELAX_IMMED + num_steps;
+ fragP->tc_frag_data.slot_subtypes[slot] = RELAX_IMMED + num_steps;
num_literal_bytes = get_num_stack_literal_bytes (&istack);
literal_diff
diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h
index 3d757e8..41218d7 100644
--- a/gas/config/tc-xtensa.h
+++ b/gas/config/tc-xtensa.h
@@ -379,7 +379,7 @@ extern void xtensa_init (int, char **);
#define DATA_SECTION_NAME xtensa_section_rename (".data")
#define BSS_SECTION_NAME xtensa_section_rename (".bss")
#define HANDLE_ALIGN(sec, fragP) xtensa_handle_align (fragP)
-#define MAX_MEM_FOR_RS_ALIGN_CODE 1
+#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) 1
/* The renumber_section function must be mapped over all the sections
diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index 3abc026..add28a3 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -633,6 +633,33 @@ z80_start_line_hook (void)
break;
}
}
+ /* Remove leading zeros from dollar local labels if SDCC compat enabled. */
+ if (sdcc_compat && *input_line_pointer == '0')
+ {
+ char *dollar;
+
+ /* SDCC emits at most one label definition per line, so it is
+ enough to look at only the first label. Hand-written asm
+ might use more, but then it is unlikely to use leading zeros
+ on dollar local labels. */
+
+ /* Place p at the first character after [0-9]+. */
+ for (p = input_line_pointer; *p >= '0' && *p <= '9'; ++p)
+ ;
+
+ /* Is this a dollar sign label?
+ GAS allows spaces between $ and :, but SDCC does not. */
+ if (p[0] == '$' && p[1] == ':')
+ {
+ dollar = p;
+ /* Replace zeros with spaces until the first non-zero,
+ but leave the last character before $ intact (for e.g. 0$:). */
+ for (p = input_line_pointer; *p == '0' && p < dollar - 1; ++p)
+ {
+ *p = ' ';
+ }
+ }
+ }
/* Check for <label>[:] =|([.](EQU|DEFL)) <value>. */
if (is_name_beginner (*input_line_pointer))
{
@@ -2966,10 +2993,10 @@ emit_lea (char prefix, char opcode, const char * args)
switch (rnum)
{
case REG_IX:
- opcode = (opcode == (char)0x33) ? 0x55 : (opcode|0x00);
+ opcode = opcode == 0x33 ? 0x55 : opcode | 0x00;
break;
case REG_IY:
- opcode = (opcode == (char)0x32) ? 0x54 : (opcode|0x01);
+ opcode = opcode == 0x32 ? 0x54 : opcode | 0x01;
}
q = frag_more (2);
@@ -3420,7 +3447,7 @@ assemble_suffix (const char **suffix)
i = 0x40;
break;
}
- *frag_more (1) = (char)i;
+ *frag_more (1) = i;
switch (i)
{
case 0x40: inst_mode = INST_MODE_FORCED | INST_MODE_S | INST_MODE_IS; break;
@@ -3720,7 +3747,7 @@ is_overflow (long value, unsigned bitsize)
{
if (value < 0)
return signed_overflow (value, bitsize);
- return unsigned_overflow ((unsigned long)value, bitsize);
+ return unsigned_overflow (value, bitsize);
}
void
@@ -4064,8 +4091,8 @@ str_to_zeda32(char *litP, int *sizeP)
else if (!sign)
mantissa &= (1ull << 23) - 1;
for (i = 0; i < 24; i += 8)
- *litP++ = (char)(mantissa >> i);
- *litP = (char)(0x80 + exponent);
+ *litP++ = mantissa >> i;
+ *litP = 0x80 + exponent;
return NULL;
}
@@ -4111,9 +4138,9 @@ str_to_float48(char *litP, int *sizeP)
return _("overflow");
if (!sign)
mantissa &= (1ull << 39) - 1;
- *litP++ = (char)(0x80 + exponent);
+ *litP++ = 0x80 + exponent;
for (i = 0; i < 40; i += 8)
- *litP++ = (char)(mantissa >> i);
+ *litP++ = mantissa >> i;
return NULL;
}
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index 4cfb302..83a732f 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -164,7 +164,7 @@ md_begin (void)
opcode_entry_type *fake_opcode;
fake_opcode = XNEW (opcode_entry_type);
fake_opcode->name = md_pseudo_table[idx].poc_name;
- fake_opcode->func = (void *) (md_pseudo_table + idx);
+ fake_opcode->p = md_pseudo_table + idx;
fake_opcode->opcode = 250;
str_hash_insert (opcode_hash_control, fake_opcode->name, fake_opcode, 0);
}
@@ -1032,7 +1032,6 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE
{
unsigned char *output_ptr = buffer;
int c;
- int nibble;
unsigned int *class_ptr;
frag_wane (frag_now);
@@ -1044,7 +1043,7 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE
memset (buffer, 0, sizeof (buffer));
class_ptr = this_try->byte_info;
- for (nibble = 0; (c = *class_ptr++); nibble++)
+ while ((c = *class_ptr++) != 0)
{
switch (c & CLASS_MASK)
@@ -1236,7 +1235,7 @@ md_assemble (char *str)
*op_end = 0; /* Zero-terminate op code string for str_hash_find() call. */
- opcode = (opcode_entry_type *) str_hash_find (opcode_hash_control, op_start);
+ opcode = str_hash_find (opcode_hash_control, op_start);
if (opcode == NULL)
{
@@ -1248,7 +1247,7 @@ md_assemble (char *str)
if (opcode->opcode == 250)
{
- pseudo_typeS *p;
+ const pseudo_typeS *p;
char oc;
char *old = input_line_pointer;
@@ -1260,7 +1259,7 @@ md_assemble (char *str)
*old = '\n';
while (is_whitespace (*input_line_pointer))
input_line_pointer++;
- p = (pseudo_typeS *) (opcode->func);
+ p = opcode->p;
(p->poc_handler) (p->poc_val);
input_line_pointer = old;
@@ -1407,7 +1406,7 @@ md_section_align (segT seg, valueT size)
void
md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED)
{
- long val = * (long *) valP;
+ offsetT val = *valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
switch (fixP->fx_r_type)
diff --git a/gas/config/te-nacl.h b/gas/config/te-nacl.h
deleted file mode 100644
index fff7388..0000000
--- a/gas/config/te-nacl.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2012-2025 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 3,
- or (at your option) any later version.
-
- GAS is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GAS; see the file COPYING. If not, write to the Free
- Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
- 02110-1301, USA. */
-
-#define TE_NACL
-
-#define LOCAL_LABELS_DOLLAR 1
-#define LOCAL_LABELS_FB 1
-
-/* These are for ARM but don't hurt other CPU targets.
- They match the settings from te-armeabi.h; NaCl/ARM is based on EABI. */
-#define FPU_DEFAULT FPU_ARCH_SOFTVFP
-#define EABI_DEFAULT EF_ARM_EABI_VER5
-
-#include "obj-format.h"
diff --git a/gas/config/te-vms.c b/gas/config/te-vms.c
index c88fbbe..8e6f7e7 100644
--- a/gas/config/te-vms.c
+++ b/gas/config/te-vms.c
@@ -169,7 +169,7 @@ vms_file_stats_name (const char *dirname,
return 0;
}
- fullname = concat (dirname, filename, NULL);
+ fullname = concat (dirname, filename, (const char *) NULL);
tryfile = to_vms_file_spec (fullname);
/* Allocate and initialize a FAB and NAM structures. */
@@ -278,7 +278,7 @@ vms_file_stats_name (const char *dirname,
struct tm *ts;
long long gmtoff, secs, nsecs;
- fullname = concat (dirname, filename, NULL);
+ fullname = concat (dirname, filename, (const char *) NULL);
if ((stat (fullname, &buff)) != 0)
{