This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] MIPS/GAS: Avoid an internal error in constant relocations


 As noted previously assembling an instruction like this:

	li	$2, %got(0)

causes an internal error, one of:

got.s: Assembler messages:
got.s:1: Fatal error: internal Error, line 4100, [...]


got.s: Assembler messages:
got.s:1: Fatal error: internal Error, line 13372, [...]

in the standard MIPS and the MIPS16 mode respectively.  User errors must 
not trigger internal errors, so here's a change to covert code to produce 
an ordinary error with an explanatory message.  That is intentionally the 
same as one I chose for the fixup fix.

 To avoid a "may be used uninitialized" message in the MIPS16 case I had 
to add an assignment to tmp so that it has a value for the call to 
mips16_immed that follows.  I chose not to preinitialise it so as to avoid 
a situation where another switch case added in the future may accidentally 
fail to initialise the variable.

 No regressions in MIPS testing, OK to apply?

2012-09-21  Maciej W. Rozycki  <>

	* config/tc-mips.c (append_insn): Report constants in unhandled
	relocations as a user rather than internal error.
	(mips16_ip): Likewise.


Index: binutils-fsf-trunk-quilt/gas/config/tc-mips.c
--- binutils-fsf-trunk-quilt.orig/gas/config/tc-mips.c	2012-09-20 21:20:07.000000000 +0100
+++ binutils-fsf-trunk-quilt/gas/config/tc-mips.c	2012-09-20 22:23:24.791781604 +0100
@@ -4097,7 +4097,7 @@ append_insn (struct mips_cl_insn *ip, ex
-	  internalError ();
+	  as_bad (_("Unsupported constant in relocation"));
@@ -13365,7 +13365,8 @@ mips16_ip (char *str, struct mips_cl_ins
-			    internalError ();
+			    tmp = 0;
+			    as_bad (_("Unsupported constant in relocation"));
 		      *offset_reloc = BFD_RELOC_UNUSED;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]