diff options
Diffstat (limited to 'gas/config/tc-mips.c')
-rw-r--r-- | gas/config/tc-mips.c | 133 |
1 files changed, 65 insertions, 68 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index eeb34ef..9134cef 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); @@ -6170,7 +6169,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 +7727,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 +7812,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 +8436,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 +8564,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 +8986,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 +9029,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 +9187,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 +9238,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 +11118,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 +11155,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 +11317,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 +11369,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 +11472,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 +11515,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 +12530,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 +14264,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 +14276,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 +14302,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 +14416,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) @@ -16228,7 +16226,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 +16336,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 +16350,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 +16359,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 +17629,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 +17654,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 +19806,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 +19913,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 +19954,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 (); |