This is the mail archive of the binutils@sources.redhat.com 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]

Re: [PATCH] GAS relaxing bug


On 18 Mar 2001, Andreas Schwab wrote:

> --- write.c	2001/03/08 23:24:22	1.27
> +++ write.c	2001/03/18 17:59:25
> @@ -2069,6 +2069,8 @@
>  	 Beware zero-length frags.  */
>  
>        if (stretch != 0
> +	  /* Don't add STRETCH a second time.  */
> +	  && fragP != sym_frag
>  	  && S_GET_SEGMENT (symbolP) == segment
>  	  && (sym_frag->fr_address > was_address
>  	      || (sym_frag->fr_address == was_address

Andreas, I don't think this patch is wrong, but it doesn't actually fix
all cases of the problem you have struck.  I believe Ian's 2001/02/13
change is at fault here.  Prior to Ian's patch, is_dnrange checked that
the symbol frag really was later in the frag chain than fragP.  Now, for a
positive stretch, we always have sym_frag->fr_address > was_address when
sym_frag == fragP.  OK, that's what your patch fixes, but consider the
following case

before stretch		after really big stretch (or tiny frags)

--------

sym_frag

--------

fragP			--------

--------		sym_frag

			--------

			fragP

			--------

Here, you'll have sym_frag->fr_address > was_address, even though
sym_frag != fragP.  I think we still need to call is_dnrange.

--- write.c	2001/03/08 23:24:22	1.27
+++ write.c	2001/03/19 00:49:33
@@ -2069,9 +2069,9 @@ relax_frag (segment, fragP, stretch)
 	 Beware zero-length frags.  */
 
       if (stretch != 0
+	  && sym_frag->fr_address >= was_address
 	  && S_GET_SEGMENT (symbolP) == segment
-	  && (sym_frag->fr_address > was_address
-	      || (sym_frag->fr_address == was_address
-		  && is_dnrange (fragP, sym_frag))))
+	  && is_dnrange (fragP, sym_frag))
 	{
 	  target += stretch;
 	}

I'll wait for comments before applying the above, which unfortunately
removes one of Ian's optimizations.

Alan
-- 
Linuxcare


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