PATCH: PR gas/4029: relax_segment can't stabilize .gcc_except_table

Nick Clifton nickc@redhat.com
Thu Feb 22 11:02:00 GMT 2007


Hi H. J.

> 2007-02-19  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	PR gas/4029
> 	* frags.h (frag): Add growth_count and last_growth.
> 
> 	* write.c (relax_segment): Break infinite loop for rs_leb128.

Could you make a couple of small changes please ?

> +  unsigned int growth_count: 4;
> +  unsigned int last_growth: 2;

I think that it would be clearer if you used #define'd values for the 
numbers stored in the last_growth field, rather than just using 
constants.  eg:

   #define LAST_GROWTH_UNKNOWN  0
   #define LAST_GROWTH_INCREASE 1
   #define LAST_GROWTH_SHRINK   2


> +		  if (growth == -1
> +		      && fragP->growth_count == 0xf)
> +		    {
> +		      /* There are 15 growths after shrinks. To break
> +			 the infinite loop, we grow the size by 1 instead
> +			 of shrinking it by 1.  */
> +		      growth = 1;
> +		    }

I also think that we ought to have a testcase to check this code, and we 
ought to refer to that testcase in the above comment so that future 
readers of the code can reproduce the problem for themselves.  (If 
possible the testcase ought to have some way of timing out rather than 
going into an infinite loop if the code is broken, although I am not 
sure how you can do this using dejagnu.  Are the gas tests time limited 
in the same way as the gcc tests ?)

Cheers
   Nick



More information about the Binutils mailing list