This is the mail archive of the binutils@sourceware.cygnus.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: a bug in as


   Date: Tue, 13 Jul 1999 11:28:34 -0700 (PDT)
   From: hjl@lucon.org (H.J. Lu)

   I got this report. The code is wrong. But as message doesn't help
   either. Is there a way for as to report correct line number? Also
   it shouldn't be an internal error.

I checked in the appended patch.

Ian

Index: write.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/write.c,v
retrieving revision 1.7
diff -u -r1.7 write.c
--- write.c	1999/07/11 20:20:01	1.7
+++ write.c	1999/07/14 20:55:33
@@ -498,8 +498,9 @@
 			  - fragP->fr_fix) / fragP->fr_var;
       if (fragP->fr_offset < 0)
 	{
-	  as_bad (_("attempt to .org/.space backwards? (%ld)"),
-		  (long) fragP->fr_offset);
+	  as_bad_where (fragP->fr_file, fragP->fr_line,
+			_("attempt to .org/.space backwards? (%ld)"),
+			(long) fragP->fr_offset);
 	}
       fragP->fr_type = rs_fill;
       break;
@@ -2302,8 +2303,16 @@
 		      /* Growth may be negative, but variable part of frag
 			 cannot have fewer than 0 chars.  That is, we can't
 			 .org backwards. */
-		      as_bad (_("attempt to .org backwards ignored"));
-		      growth = 0;
+		      as_bad_where (fragP->fr_file, fragP->fr_line,
+				    _("attempt to .org backwards ignored"));
+
+		      /* We've issued an error message.  Change the
+                         frag to avoid cascading errors.  */
+		      fragP->fr_type = rs_align;
+		      fragP->fr_subtype = 0;
+		      fragP->fr_offset = 0;
+		      fragP->fr_fix = after - address;
+		      growth = stretch;
 		    }
 
 		  growth -= stretch;	/* This is an absolute growth factor */

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