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]

Fix .space for multi-pass relaxation


Multi-pass relaxation turned up a problem with rs_space frag
relaxation.  We used to simply add the space in first time around the
relax loop, and disable the adjustment for subsequent loops by setting
fr_symbol to NULL.  Now that we revisist a section for another
relaxation pass, we need to keep fr_symbol around.

gas/ChangeLog
	* write.c (relax_segment): Don't zap fr_symbol when relaxing.

-- 
Alan Modra

Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.34
diff -u -p -r1.34 write.c
--- write.c	2001/05/24 08:19:32	1.34
+++ write.c	2001/05/24 23:11:24
@@ -2453,18 +2453,22 @@ relax_segment (segment_frag_root, segmen
 	      case rs_space:
 		if (symbolP)
 		  {
-		    growth = S_GET_VALUE (symbolP);
+		    offsetT amount;
+
+		    amount = S_GET_VALUE (symbolP);
 		    if (symbol_get_frag (symbolP) != &zero_address_frag
 			|| S_IS_COMMON (symbolP)
 			|| ! S_IS_DEFINED (symbolP))
 		      as_bad_where (fragP->fr_file, fragP->fr_line,
 				    _(".space specifies non-absolute value"));
-		    fragP->fr_symbol = 0;
-		    if (growth < 0)
+		    if (amount < 0)
 		      {
 			as_warn (_(".space or .fill with negative value, ignored"));
-			growth = 0;
+			amount = 0;
+			fragP->fr_symbol = 0;
 		      }
+		    growth = (fragP->fr_address + amount
+			      - fragP->fr_next->fr_address);
 		  }
 		else
 		  growth = 0;


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