Thumb-2 relaxation bugs.

Paul Brook paul@codesourcery.com
Fri Mar 2 18:22:00 GMT 2007


The attached patch fixes a bug in the Thumb-2 relaxation code.

Under some cuircumstances the size of one instruction may effect teh size of 
annother instruction in such a way that a simple iterative relaxation 
algorithm will never converge. This typically happens when there are 
alignment requirements in addition to range reqtrictions.

The existing code only accounted for cases where the alignment requirement 
came from the instruction being relaxed, not from .align directives. The new 
code uses a more general algorithm to force use of wide instruction and 
guarantee convergence.

While fixing this I also noticed we weren't compensating for the effects of 
the current relaxation pass when calculating symbol values. This has also 
been fixed.

Tested on arm-none-eabi.
Applied to CVS head.

Paul

2007-03-02  Paul Brook  <paul@codesourcery.com>

	gas/
	* config/tc-arm.c (relax_immediate): Always return positive values.
	(relaxed_symbol_addr): New function.
	(relax_adr, relax_branch): Use it.
	(arm_relax_frag): Pass strect argument.  Adjust infinite loop check.

	gas/testsuite/
	* gas/arm/relax_branch_align.d: New test.
	* gas/arm/relax_branch_align.s: New test.
-------------- next part --------------
2007-03-02  Paul Brook  <paul@codesourcery.com>

	gas/
	* config/tc-arm.c (relax_immediate): Always return positive values.
	(relaxed_symbol_addr): New function.
	(relax_adr, relax_branch): Use it.
	(arm_relax_frag): Pass strect argument.  Adjust infinite loop check.

	gas/testsuite/
	* gas/arm/relax_branch_align.d: New test.
	* gas/arm/relax_branch_align.s: New test.


More information about the Binutils mailing list