diff options
Diffstat (limited to 'gas/config/tc-loongarch.c')
-rw-r--r-- | gas/config/tc-loongarch.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c index 06fb601..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 @@ -453,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 @@ -483,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; @@ -1756,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) { @@ -1793,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; @@ -2284,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; @@ -2319,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; @@ -2341,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; } @@ -2352,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) @@ -2371,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; @@ -2379,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; } |