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: finalize_syms for non-bfd


On Fri, May 25, 2001 at 03:02:15PM +0200, Peter Jakubek wrote:
> 
> results in "error5m.s:20: Warning: .space or .fill with negative value,
> ignored".

This code
      growth = (fragP->fr_address + amount
                - fragP->fr_next->fr_address);
was subtracting an address that hadn't yet been adjusted by "strech"
from one that had.  Harmless enough in most cases, because the next
time around the relax loop "stretch" settles to zero, and we get the
correct value.

> -			as_warn (_(".space or .fill with negative value, ignored"));
> +			as_warn_where (fragP->fr_file, fragP->fr_line, _(".space or .fill
> with negative value, ignored"));

Thanks.  I'll install this, and fix some similar cases while I'm at it.

	* write.c (relax_segment <rs_space>): Calculate growth using
	addresses before stretch.  Prevent repeated error messages.
	From Peter Jakubek  <pjak@snafu.de>
	Use as_bad_where and as_warn_where to pinpoint errors.

-- 
Alan Modra

Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.35
diff -u -p -r1.35 write.c
--- write.c	2001/05/24 23:33:00	1.35
+++ write.c	2001/05/26 12:31:58
@@ -2241,8 +2241,9 @@ relax_segment (segment_frag_root, segmen
 
 	    if (offset % fragP->fr_var != 0)
 	      {
-		as_bad (_("alignment padding (%lu bytes) not a multiple of %ld"),
-			(unsigned long) offset, (long) fragP->fr_var);
+		as_bad_where (fragP->fr_file, fragP->fr_line,
+			      _("alignment padding (%lu bytes) not a multiple of %ld"),
+			      (unsigned long) offset, (long) fragP->fr_var);
 		offset -= (offset % fragP->fr_var);
 	      }
 
@@ -2353,10 +2354,11 @@ relax_segment (segment_frag_root, segmen
 			    {
 			      char buf[50];
 			      sprint_value (buf, (addressT) lie->addnum);
-			      as_warn (_(".word %s-%s+%s didn't fit"),
-				       S_GET_NAME (lie->add),
-				       S_GET_NAME (lie->sub),
-				       buf);
+			      as_warn_where (fragP->fr_file, fragP->fr_line,
+					     _(".word %s-%s+%s didn't fit"),
+					     S_GET_NAME (lie->add),
+					     S_GET_NAME (lie->sub),
+					     buf);
 			    }
 			  lie->added = 1;
 			  if (fragP->fr_subtype == 0)
@@ -2451,6 +2453,7 @@ relax_segment (segment_frag_root, segmen
 		}
 
 	      case rs_space:
+		growth = 0;
 		if (symbolP)
 		  {
 		    offsetT amount;
@@ -2459,19 +2462,22 @@ relax_segment (segment_frag_root, segmen
 		    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"));
-		    if (amount < 0)
+		      {
+			as_bad_where (fragP->fr_file, fragP->fr_line,
+				      _(".space specifies non-absolute value"));
+			/* Prevent repeat of this error message.  */
+			fragP->fr_symbol = 0;
+		      }
+		    else if (amount < 0)
 		      {
-			as_warn (_(".space or .fill with negative value, ignored"));
-			amount = 0;
+			as_warn_where (fragP->fr_file, fragP->fr_line,
+				       _(".space or .fill with negative value, ignored"));
 			fragP->fr_symbol = 0;
 		      }
-		    growth = (fragP->fr_address + amount
-			      - fragP->fr_next->fr_address);
+		    else
+		      growth = (was_address + amount
+				- fragP->fr_next->fr_address);
 		  }
-		else
-		  growth = 0;
 		break;
 
 	      case rs_machine_dependent:


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