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)
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++)
{
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
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);
if (basereg == alpha_gp_register &&
(symlen > 4 && strcmp (&symname [symlen - 4], "..lk") == 0))
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, newtok, 3, &insn);
if (lituse)
{
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);
}
else
{
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, newtok, 3, &insn);
if (lituse)
{
}
}
- sym = symbol_find_or_make ((const char *) symname);
+ sym = symbol_find_or_make (symname);
set_tok_reg (newtok[0], AXP_REG_AT);
set_tok_sym (newtok[1], sym, 0);
else
rr = regno (tok[2].X_add_number);
- sym = symbol_find_or_make ((const char *) symname);
+ sym = symbol_find_or_make (symname);
/* Move the operands into the right place. */
if (yr == AXP_REG_T10 && xr == AXP_REG_T11)
int ntok,
const void * vopname)
{
- const char *opname = (const char *) vopname;
+ const char *opname = vopname;
struct alpha_insn insn;
expressionS newtok[3];
int r, tokidx = 0;
int ntok,
const void * vopname)
{
- const char *opname = (const char *) vopname;
+ const char *opname = vopname;
expressionS newtok[3];
int r, tokidx = 0;
if (!nflg)
continue;
found_flag = false;
- unsigned * psflg = (unsigned *)r->flags;
+ const unsigned *psflg = r->flags;
do
{
tmp = false;
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);
}
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
}
static bfd_reloc_code_real_type
-get_reloc (struct d10v_operand *op)
+get_reloc (const struct d10v_operand *op)
{
int bits = op->bits;
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)
}
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
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
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_)
{
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)
entry.name = name;
- reg = (const metag_reg *) htab_find (reg_htab, &entry);
+ reg = htab_find (reg_htab, &entry);
return reg;
}
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;
entry.name = buf;
- scond = (const split_condition *) htab_find (scond_htab, &entry);
+ scond = htab_find (scond_htab, &entry);
if (!scond)
return NULL;
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);
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)
{
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);
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;
}
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)
/* 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;
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;
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, (void *) tuple->value);
+ nds32_elf_append_relax_relocs (tuple->key, (const void *) tuple->value);
return 1;
}
{
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;
/* 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))
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
}
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
while (n--)
{
result <<= 8;
- result |= (where[n] & 255);
+ result |= (buf[n] & 255);
}
}
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)
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 *);
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. */
}
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);
}
If the name wasn't generated by foo_label_name(), then return it
unaltered. This is used for error messages. */
-char *
-decode_local_label_name (char *s)
+const char *
+decode_local_label_name (const char *s)
{
- char *p;
+ const char *p;
char *symbol_decode;
unsigned int label_number;
unsigned int instance_number;
S_IS_DEFINED (const symbolS *s)
{
if (s->flags.local_symbol)
- return ((struct local_symbol *) s)->section != undefined_section;
+ return ((const struct local_symbol *) s)->section != undefined_section;
return s->bsym->section != undefined_section;
}
{
segT sec;
if (s->flags.local_symbol)
- sec = ((struct local_symbol *) s)->section;
+ sec = ((const struct local_symbol *) s)->section;
else
{
if ((strict
S_CAN_BE_REDEFINED (const symbolS *s)
{
if (s->flags.local_symbol)
- return (((struct local_symbol *) s)->frag
+ return (((const struct local_symbol *) s)->frag
== &predefined_address_frag);
/* Permit register names to be redefined. */
return s->x->value.X_op == O_register;
S_GET_SEGMENT (const symbolS *s)
{
if (s->flags.local_symbol)
- return ((struct local_symbol *) s)->section;
+ return ((const struct local_symbol *) s)->section;
return s->bsym->section;
}
char * symbol_relc_make_expr (expressionS *);
char * symbol_relc_make_sym (symbolS *);
char * symbol_relc_make_value (offsetT);
-char *decode_local_label_name (char *s);
+const char *decode_local_label_name (const char *);
symbolS *symbol_find (const char *name);
symbolS *symbol_find_noref (const char *name, int noref);
symbolS *symbol_find_exact (const char *name);
if (name)
{
const char *name2 =
- decode_local_label_name ((char *) S_GET_NAME (symp));
+ decode_local_label_name (S_GET_NAME (symp));
/* They only differ if `name' is a fb or dollar local
label name. */
if (name2 != name && ! S_IS_DEFINED (symp))