From: Ken Raeburn <raeburn@cygnus>
Date: Tue, 8 Feb 1994 21:02:35 +0000 (+0000)
Subject: 	* write.c (write_relocs): Print some sensible error message if
X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=df44a8523f9bd4d8e535256728f917f76ec51451;p=binutils-gdb.git

	* write.c (write_relocs): Print some sensible error message if
	bfd_perform_relocation returns bfd_reloc_overflow.
---

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 5ab1b13c2e2..45db86f7800 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,13 @@
+Tue Feb  8 16:00:25 1994  Ken Raeburn  (raeburn@cujo.cygnus.com)
+
+	* write.c (write_relocs): Print some sensible error message if
+	bfd_perform_relocation returns bfd_reloc_overflow.
+
+Mon Feb  7 15:49:24 1994  Jeffrey A. Law  (law@snake.cs.utah.edu)
+
+	* configure.in (hppa*-*elf*): New configuration for PA ELF.
+	(hppa*-*-osf*): Default object format is SOM.
+
 Mon Feb  7 16:07:35 1994  Ken Raeburn  (raeburn@cujo.cygnus.com)
 
 	* config/tc-alpha.c (md_atof): Warn that floating-point values
diff --git a/gas/write.c b/gas/write.c
index dc4c4e45a76..55d5961cb38 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -683,6 +683,9 @@ write_relocs (abfd, sec, xxx)
 	{
 	case bfd_reloc_ok:
 	  break;
+	case bfd_reloc_overflow:
+	  as_bad_where (fixp->fx_file, fixp->fx_line, "relocation overflow");
+	  break;
 	default:
 	  as_fatal ("bad return from bfd_perform_relocation");
 	}
@@ -2072,28 +2075,31 @@ fixup_segment (fixP, this_segment_type)
       if (!fixP->fx_bit_fixP && size > 0)
 	{
 	  valueT mask = 0;
-	  /* set all bits to one */
-	  mask--;
-	  /* Technically, combining these produces an undefined result
-	     if size is sizeof (valueT), though I think these two
-	     half-way operations should both be defined.  And the
-	     compiler should be able to combine them if it's valid on
-	     the host architecture.  */
-	  mask <<= size * 4;
-	  mask <<= size * 4;
-	  if ((add_number & mask) != 0
-	      && (add_number & mask) != mask)
+	  if (size < sizeof (mask))
 	    {
-	      char buf[50], buf2[50];
-	      sprint_value (buf, fragP->fr_address + where);
-	      if (add_number > 1000)
-		sprint_value (buf2, add_number);
-	      else
-		sprintf (buf2, "%ld", (long) add_number);
-	      as_bad_where (fixP->fx_file, fixP->fx_line,
-			    "Value of %s too large for field of %d bytes at %s",
-			    buf2, size, buf);
-	    }			/* generic error checking */
+	      /* set all bits to one */
+	      mask--;
+	      /* Technically, combining these produces an undefined result
+		 if size is sizeof (valueT), though I think these two
+		 half-way operations should both be defined.  And the
+		 compiler should be able to combine them if it's valid on
+		 the host architecture.  */
+	      mask <<= size * 4;
+	      mask <<= size * 4;
+	      if ((add_number & mask) != 0
+		  && (add_number & mask) != mask)
+		{
+		  char buf[50], buf2[50];
+		  sprint_value (buf, fragP->fr_address + where);
+		  if (add_number > 1000)
+		    sprint_value (buf2, add_number);
+		  else
+		    sprintf (buf2, "%ld", (long) add_number);
+		  as_bad_where (fixP->fx_file, fixP->fx_line,
+				"Value of %s too large for field of %d bytes at %s",
+				buf2, size, buf);
+		} /* generic error checking */
+	    }
 #ifdef WARN_SIGNED_OVERFLOW_WORD
 	  /* Warn if a .word value is too large when treated as a signed
 	     number.  We already know it is not too negative.  This is to