bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BFD internal error


From: Alan Modra
Subject: Re: BFD internal error
Date: Mon, 18 Mar 2002 11:55:38 +1030
User-agent: Mutt/1.3.25i

On Fri, Mar 15, 2002 at 04:37:44PM -0500, James Tetazoo wrote:
> 
> BFD: BFD internal error, aborting at ../../bfd/libbfd.c line 606 in 
> bfd_write_bigendian_4byte_int

Thanks for the report.  I would guess that the write failed due to lack
of disk space, or possibly lack of memory.  bfd_write_bigendian_4byte_int
should not be calling "abort" for this condition.

bfd/ChangeLog
        * libbfd.c (bfd_write_bigendian_4byte_int): Return true iff success.
        * libbfd.h: Regenerate.
        * archive.c (coff_write_armap): Pass on failures from
        bfd_write_bigendian_4byte_int.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: bfd/archive.c
===================================================================
RCS file: /cvs/src/src/bfd/archive.c,v
retrieving revision 1.20
diff -u -p -r1.20 archive.c
--- archive.c   2001/12/05 22:46:21     1.20
+++ archive.c   2002/03/18 01:20:27
@@ -2190,7 +2190,8 @@ coff_write_armap (arch, elength, map, sy
       != sizeof (struct ar_hdr))
     return false;
 
-  bfd_write_bigendian_4byte_int (arch, symbol_count);
+  if (!bfd_write_bigendian_4byte_int (arch, symbol_count))
+    return false;
 
   /* Two passes, first write the file offsets for each symbol -
      remembering that each offset is on a two byte boundary.  */
@@ -2207,7 +2208,8 @@ coff_write_armap (arch, elength, map, sy
 
       while (count < symbol_count && map[count].u.abfd == current)
        {
-         bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr);
+         if (!bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr))
+           return false;
          count++;
        }
       /* Add size of this archive entry.  */
Index: bfd/libbfd.c
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.c,v
retrieving revision 1.21
diff -u -p -r1.21 libbfd.c
--- libbfd.c    2002/01/30 16:07:28     1.21
+++ libbfd.c    2002/03/18 01:20:28
@@ -593,7 +593,7 @@ INTERNAL_FUNCTION
        bfd_write_bigendian_4byte_int
 
 SYNOPSIS
-       void bfd_write_bigendian_4byte_int (bfd *, unsigned int);
+       boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
 
 DESCRIPTION
        Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
@@ -601,15 +601,14 @@ DESCRIPTION
        archives.
 
 */
-void
+boolean
 bfd_write_bigendian_4byte_int (abfd, i)
      bfd *abfd;
      unsigned int i;
 {
   bfd_byte buffer[4];
   bfd_putb32 ((bfd_vma) i, buffer);
-  if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) != 4)
-    abort ();
+  return bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4;
 }
 
 bfd_vma



reply via email to

[Prev in Thread] Current Thread [Next in Thread]