fix Xtensa ld crash on bad input

Bob Wilson bwilson@tensilica.com
Thu Mar 1 23:42:00 GMT 2007


The Xtensa linker relaxation needs to decode a lot of the instructions from the 
input objects.  If the opcodes are not recognized, due to user error or 
whatever, ld is supposed to fail gracefully but instead it was crashing.  This 
patch fixes the crash so that it fails nicely.  It also adds an assertion to 
detect similar problems in the future.  Tested with an xtensa-elf build and 
committed.

bfd/
	* elf32-xtensa.c (analyze_relocations): Zero src_count if not relaxing.
	(find_relaxable_sections): Do not increment src_count for unknown
	opcodes.  Decode only once instead of calling is_l32r_relocation.
	(compute_text_actions): Remove unused no_insn_move flag.  Assert that
	src_next matches src_count in relax_info.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bfd-relcount.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20070301/bf407096/attachment.ksh>


More information about the Binutils mailing list