* config/tc-mips.c (append_insn): Use actual relocation size for new

fixp's.	Don't relax overflow checking for partial_inplace relocations.
	Use the actual relocation type in combined relocs, not just the type
	of the first one.
	(macro_build_jalr): Use actual relocation size for new fix.
	(s_cpsetup, s_gpdword): Likewise.
This commit is contained in:
Thiemo Seufer 2003-05-22 09:19:33 +00:00
parent dc9461f6ad
commit a105a3009c
2 changed files with 81 additions and 62 deletions

View File

@ -1,3 +1,12 @@
2003-05-22 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* config/tc-mips.c (append_insn): Use actual relocation size for new
fixp's. Don't relax overflow checking for partial_inplace relocations.
Use the actual relocation type in combined relocs, not just the type
of the first one.
(macro_build_jalr): Use actual relocation size for new fix.
(s_cpsetup, s_gpdword): Likewise.
2003-05-22 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> 2003-05-22 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* config/tc-mips.c (macro): Don't use uninitialized tempreg. * config/tc-mips.c (macro): Don't use uninitialized tempreg.

View File

@ -2154,34 +2154,39 @@ append_insn (place, ip, address_expr, reloc_type)
} }
else else
{ {
reloc_howto_type *howto;
need_reloc: need_reloc:
/* Don't generate a reloc if we are writing into a variant frag. */ /* Don't generate a reloc if we are writing into a variant frag. */
if (place == NULL) if (place == NULL)
{ {
fixp[0] = fix_new_exp (frag_now, f - frag_now->fr_literal, 4, howto = bfd_reloc_type_lookup (stdoutput, reloc_type[0]);
fixp[0] = fix_new_exp (frag_now, f - frag_now->fr_literal,
bfd_get_reloc_size(howto),
address_expr, address_expr,
*reloc_type == BFD_RELOC_16_PCREL_S2, reloc_type[0] == BFD_RELOC_16_PCREL_S2,
reloc_type[0]); reloc_type[0]);
/* These relocations can have an addend that won't fit in /* These relocations can have an addend that won't fit in
4 octets for 64bit assembly. */ 4 octets for 64bit assembly. */
if (HAVE_64BIT_GPRS && if (HAVE_64BIT_GPRS
(*reloc_type == BFD_RELOC_16 && ! howto->partial_inplace
|| *reloc_type == BFD_RELOC_32 && (reloc_type[0] == BFD_RELOC_16
|| *reloc_type == BFD_RELOC_MIPS_JMP || reloc_type[0] == BFD_RELOC_32
|| *reloc_type == BFD_RELOC_HI16_S || reloc_type[0] == BFD_RELOC_MIPS_JMP
|| *reloc_type == BFD_RELOC_LO16 || reloc_type[0] == BFD_RELOC_HI16_S
|| *reloc_type == BFD_RELOC_GPREL16 || reloc_type[0] == BFD_RELOC_LO16
|| *reloc_type == BFD_RELOC_MIPS_LITERAL || reloc_type[0] == BFD_RELOC_GPREL16
|| *reloc_type == BFD_RELOC_GPREL32 || reloc_type[0] == BFD_RELOC_MIPS_LITERAL
|| *reloc_type == BFD_RELOC_64 || reloc_type[0] == BFD_RELOC_GPREL32
|| *reloc_type == BFD_RELOC_CTOR || reloc_type[0] == BFD_RELOC_64
|| *reloc_type == BFD_RELOC_MIPS_SUB || reloc_type[0] == BFD_RELOC_CTOR
|| *reloc_type == BFD_RELOC_MIPS_HIGHEST || reloc_type[0] == BFD_RELOC_MIPS_SUB
|| *reloc_type == BFD_RELOC_MIPS_HIGHER || reloc_type[0] == BFD_RELOC_MIPS_HIGHEST
|| *reloc_type == BFD_RELOC_MIPS_SCN_DISP || reloc_type[0] == BFD_RELOC_MIPS_HIGHER
|| *reloc_type == BFD_RELOC_MIPS_REL16 || reloc_type[0] == BFD_RELOC_MIPS_SCN_DISP
|| *reloc_type == BFD_RELOC_MIPS_RELGOT)) || reloc_type[0] == BFD_RELOC_MIPS_REL16
|| reloc_type[0] == BFD_RELOC_MIPS_RELGOT))
fixp[0]->fx_no_overflow = 1; fixp[0]->fx_no_overflow = 1;
if (reloc_needs_lo_p (*reloc_type)) if (reloc_needs_lo_p (*reloc_type))
@ -2210,29 +2215,31 @@ append_insn (place, ip, address_expr, reloc_type)
address_expr->X_add_symbol = 0; address_expr->X_add_symbol = 0;
address_expr->X_add_number = 0; address_expr->X_add_number = 0;
howto = bfd_reloc_type_lookup (stdoutput, reloc_type[1]);
fixp[1] = fix_new_exp (frag_now, f - frag_now->fr_literal, fixp[1] = fix_new_exp (frag_now, f - frag_now->fr_literal,
4, address_expr, FALSE, bfd_get_reloc_size(howto),
reloc_type[1]); address_expr, FALSE, reloc_type[1]);
/* These relocations can have an addend that won't fit in /* These relocations can have an addend that won't fit in
4 octets for 64bit assembly. */ 4 octets for 64bit assembly. */
if (HAVE_64BIT_GPRS && if (HAVE_64BIT_GPRS
(*reloc_type == BFD_RELOC_16 && ! howto->partial_inplace
|| *reloc_type == BFD_RELOC_32 && (reloc_type[1] == BFD_RELOC_16
|| *reloc_type == BFD_RELOC_MIPS_JMP || reloc_type[1] == BFD_RELOC_32
|| *reloc_type == BFD_RELOC_HI16_S || reloc_type[1] == BFD_RELOC_MIPS_JMP
|| *reloc_type == BFD_RELOC_LO16 || reloc_type[1] == BFD_RELOC_HI16_S
|| *reloc_type == BFD_RELOC_GPREL16 || reloc_type[1] == BFD_RELOC_LO16
|| *reloc_type == BFD_RELOC_MIPS_LITERAL || reloc_type[1] == BFD_RELOC_GPREL16
|| *reloc_type == BFD_RELOC_GPREL32 || reloc_type[1] == BFD_RELOC_MIPS_LITERAL
|| *reloc_type == BFD_RELOC_64 || reloc_type[1] == BFD_RELOC_GPREL32
|| *reloc_type == BFD_RELOC_CTOR || reloc_type[1] == BFD_RELOC_64
|| *reloc_type == BFD_RELOC_MIPS_SUB || reloc_type[1] == BFD_RELOC_CTOR
|| *reloc_type == BFD_RELOC_MIPS_HIGHEST || reloc_type[1] == BFD_RELOC_MIPS_SUB
|| *reloc_type == BFD_RELOC_MIPS_HIGHER || reloc_type[1] == BFD_RELOC_MIPS_HIGHEST
|| *reloc_type == BFD_RELOC_MIPS_SCN_DISP || reloc_type[1] == BFD_RELOC_MIPS_HIGHER
|| *reloc_type == BFD_RELOC_MIPS_REL16 || reloc_type[1] == BFD_RELOC_MIPS_SCN_DISP
|| *reloc_type == BFD_RELOC_MIPS_RELGOT)) || reloc_type[1] == BFD_RELOC_MIPS_REL16
|| reloc_type[1] == BFD_RELOC_MIPS_RELGOT))
fixp[1]->fx_no_overflow = 1; fixp[1]->fx_no_overflow = 1;
if (reloc_type[2] != BFD_RELOC_UNUSED) if (reloc_type[2] != BFD_RELOC_UNUSED)
@ -2241,30 +2248,33 @@ append_insn (place, ip, address_expr, reloc_type)
address_expr->X_add_symbol = 0; address_expr->X_add_symbol = 0;
address_expr->X_add_number = 0; address_expr->X_add_number = 0;
howto = bfd_reloc_type_lookup (stdoutput, reloc_type[2]);
fixp[2] = fix_new_exp (frag_now, fixp[2] = fix_new_exp (frag_now,
f - frag_now->fr_literal, 4, f - frag_now->fr_literal,
bfd_get_reloc_size(howto),
address_expr, FALSE, address_expr, FALSE,
reloc_type[2]); reloc_type[2]);
/* These relocations can have an addend that won't fit in /* These relocations can have an addend that won't fit in
4 octets for 64bit assembly. */ 4 octets for 64bit assembly. */
if (HAVE_64BIT_GPRS && if (HAVE_64BIT_GPRS
(*reloc_type == BFD_RELOC_16 && ! howto->partial_inplace
|| *reloc_type == BFD_RELOC_32 && (reloc_type[2] == BFD_RELOC_16
|| *reloc_type == BFD_RELOC_MIPS_JMP || reloc_type[2] == BFD_RELOC_32
|| *reloc_type == BFD_RELOC_HI16_S || reloc_type[2] == BFD_RELOC_MIPS_JMP
|| *reloc_type == BFD_RELOC_LO16 || reloc_type[2] == BFD_RELOC_HI16_S
|| *reloc_type == BFD_RELOC_GPREL16 || reloc_type[2] == BFD_RELOC_LO16
|| *reloc_type == BFD_RELOC_MIPS_LITERAL || reloc_type[2] == BFD_RELOC_GPREL16
|| *reloc_type == BFD_RELOC_GPREL32 || reloc_type[2] == BFD_RELOC_MIPS_LITERAL
|| *reloc_type == BFD_RELOC_64 || reloc_type[2] == BFD_RELOC_GPREL32
|| *reloc_type == BFD_RELOC_CTOR || reloc_type[2] == BFD_RELOC_64
|| *reloc_type == BFD_RELOC_MIPS_SUB || reloc_type[2] == BFD_RELOC_CTOR
|| *reloc_type == BFD_RELOC_MIPS_HIGHEST || reloc_type[2] == BFD_RELOC_MIPS_SUB
|| *reloc_type == BFD_RELOC_MIPS_HIGHER || reloc_type[2] == BFD_RELOC_MIPS_HIGHEST
|| *reloc_type == BFD_RELOC_MIPS_SCN_DISP || reloc_type[2] == BFD_RELOC_MIPS_HIGHER
|| *reloc_type == BFD_RELOC_MIPS_REL16 || reloc_type[2] == BFD_RELOC_MIPS_SCN_DISP
|| *reloc_type == BFD_RELOC_MIPS_RELGOT)) || reloc_type[2] == BFD_RELOC_MIPS_REL16
|| reloc_type[2] == BFD_RELOC_MIPS_RELGOT))
fixp[2]->fx_no_overflow = 1; fixp[2]->fx_no_overflow = 1;
} }
} }
@ -3313,7 +3323,7 @@ macro_build_jalr (icnt, ep)
RA, PIC_CALL_REG); RA, PIC_CALL_REG);
if (HAVE_NEWABI) if (HAVE_NEWABI)
fix_new_exp (frag_now, f - frag_now->fr_literal, fix_new_exp (frag_now, f - frag_now->fr_literal,
0, ep, FALSE, BFD_RELOC_MIPS_JALR); 4, ep, FALSE, BFD_RELOC_MIPS_JALR);
} }
/* /*
@ -12805,17 +12815,17 @@ s_cpsetup (ignore)
macro_build ((char *) NULL, &icnt, &ex_sym, "lui", "t,u", mips_gp_register, macro_build ((char *) NULL, &icnt, &ex_sym, "lui", "t,u", mips_gp_register,
(int) BFD_RELOC_GPREL16); (int) BFD_RELOC_GPREL16);
fix_new (frag_now, f - frag_now->fr_literal, fix_new (frag_now, f - frag_now->fr_literal,
0, NULL, 0, 0, BFD_RELOC_MIPS_SUB); 8, NULL, 0, 0, BFD_RELOC_MIPS_SUB);
fix_new (frag_now, f - frag_now->fr_literal, fix_new (frag_now, f - frag_now->fr_literal,
0, NULL, 0, 0, BFD_RELOC_HI16_S); 4, NULL, 0, 0, BFD_RELOC_HI16_S);
f = frag_more (0); f = frag_more (0);
macro_build ((char *) NULL, &icnt, &ex_sym, "addiu", "t,r,j", macro_build ((char *) NULL, &icnt, &ex_sym, "addiu", "t,r,j",
mips_gp_register, mips_gp_register, (int) BFD_RELOC_GPREL16); mips_gp_register, mips_gp_register, (int) BFD_RELOC_GPREL16);
fix_new (frag_now, f - frag_now->fr_literal, fix_new (frag_now, f - frag_now->fr_literal,
0, NULL, 0, 0, BFD_RELOC_MIPS_SUB); 8, NULL, 0, 0, BFD_RELOC_MIPS_SUB);
fix_new (frag_now, f - frag_now->fr_literal, fix_new (frag_now, f - frag_now->fr_literal,
0, NULL, 0, 0, BFD_RELOC_LO16); 4, NULL, 0, 0, BFD_RELOC_LO16);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL, macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
HAVE_64BIT_ADDRESSES ? "daddu" : "add", "d,v,t", HAVE_64BIT_ADDRESSES ? "daddu" : "add", "d,v,t",
@ -13004,7 +13014,7 @@ s_gpdword (ignore)
p = frag_more (8); p = frag_more (8);
md_number_to_chars (p, (valueT) 0, 8); md_number_to_chars (p, (valueT) 0, 8);
fix_new_exp (frag_now, p - frag_now->fr_literal, 8, &ex, FALSE, fix_new_exp (frag_now, p - frag_now->fr_literal, 4, &ex, FALSE,
BFD_RELOC_GPREL32); BFD_RELOC_GPREL32);
/* GPREL32 composed with 64 gives a 64-bit GP offset. */ /* GPREL32 composed with 64 gives a 64-bit GP offset. */