fix Xtensa assembler relaxtion bug

Bob Wilson bwilson@tensilica.com
Tue Mar 29 06:51:00 GMT 2005


This patch from Sterling Augustine fixes a longstanding relaxation bug for 
Xtensa targets.  In the (relatively unusual) situation of an Xtensa 
zero-overhead loop ending with an out-of-range conditional branch, the assembler 
must insert a no-op at the end of the loop.  (When the conditional branch is 
relaxed, it becomes a negated branch over a jump, followed by a no-op 
instruction at the loop-end.)  For some unknown reason, the implementation of 
this relaxation had been overloading the DESIRE_ALIGN_IF_TARGET frag at the end 
of a loop to also mark the loop end.  This breaks if the Xtensa 
--no-target-align option is used, since then the DESIRE_ALIGN_IF_TARGET frags 
are not produced.  The patch fixes this by generating LOOP_END frags at the ends 
of all zero-overhead loops, whether target alignment is enabled or not.  It also 
changes the xg_assemble_vliw_tokens function to use do_align_targets -- this is 
just so that code used prior to md_end consistently goes through 
do_align_targets function instead of directly checking the align_targets 
variable.  Committed on the mainline and 2.16 branch.


2005-03-28  Sterling Augustine  <sterling@tensilica.com>
	    Bob Wilson  <bob.wilson@acm.org>

	* config/tc-xtensa.c (do_align_targets): Update comment.
	(xtensa_frob_label): Compute "freq" before possibly switching frags.
	Insert a LOOP_END frag before every loop target, and do not overload
	DESIRE_ALIGN_IF_TARGET frags with loop end information.
	(xg_assemble_vliw_tokens): Use do_align_targets.
	(xtensa_fix_target_frags): Remove code to convert a
	DESIRE_ALIGN_IF_TARGET frag to a LOOP_END frag when there is a
	negatable branch at the end of a loop.
	(frag_can_negate_branch): Delete.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gas-align-bug.diff
Type: text/x-patch
Size: 6424 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20050329/7c6a919d/attachment.bin>


More information about the Binutils mailing list