This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

better error messages


I had a bogus ELF file, to which objcopy just said:
objcopy:tmp.o: File truncated
which was somewhat uninformative. the problem was said file had a section with CONTENTS that extended beyond the end of the file. One had to look carefully to find that though.


This patch adds a new bfd_nonfatal_message function, which produces more informative messages naming the bfd and the section, where applicable. I've updated the calls in objcopy to use this new function, in preference to bfd_nonfatal (which should be deprecated, IMHO).

Now one gets
objcopy:tmp.o[.physMem]: File truncated
which clues you in a bit more. I chose [] to name the section, but I'm not wedded to it.


tested on arm-eabi, ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2007-07-27  Nathan Sidwell  <nathan@codesourcery.com>

	* bucomm.c (bfd_nonfatal_message): New.
	* bucomm.h (bfd_nonfatal_message): Declare.
	* objcopy.c (RETURN_NONFATAL): Remove.
	(copy_unknown_object): Replace bfd_nonfatal and RETURN_NONFATAL
	with bfd_nonfatal_message calls.
	(copy_object, copy_archive, copy_file, setup_section,
	copy_section, write_debugging_info): Likewise.

Index: bucomm.c
===================================================================
RCS file: /cvs/src/src/binutils/bucomm.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 bucomm.c
*** bucomm.c	5 Jul 2007 16:54:45 -0000	1.31
--- bucomm.c	27 Jul 2007 15:40:25 -0000
*************** bfd_nonfatal (const char *string)
*** 61,66 ****
--- 61,99 ----
  }
  
  void
+ bfd_nonfatal_message (const char *filename,
+ 		      const bfd *bfd, const asection *section,
+ 		      const char *format, ...)
+ {
+   const char *errmsg = bfd_errmsg (bfd_get_error ());
+   const char *section_name = NULL;
+   va_list args;
+ 
+   va_start (args, format);
+   fprintf (stderr, "%s", program_name);
+   
+   if (bfd)
+     {
+       if (!filename)
+ 	filename = bfd_get_filename (bfd);
+       if (section)
+ 	section_name = bfd_get_section_name (bfd, section);
+     }
+   if (section_name)
+     fprintf (stderr, ":%s[%s]", filename, section_name);
+   else
+     fprintf (stderr, ":%s", filename);
+ 
+   if (format)
+     {
+       fprintf (stderr, ": ");
+       vfprintf (stderr, format, args);
+     }
+   fprintf (stderr, ": %s\n", errmsg);
+   va_end (args);
+ }
+ 
+ void
  bfd_fatal (const char *string)
  {
    bfd_nonfatal (string);
Index: bucomm.h
===================================================================
RCS file: /cvs/src/src/binutils/bucomm.h,v
retrieving revision 1.27
diff -c -3 -p -r1.27 bucomm.h
*** bucomm.h	5 Jul 2007 16:54:45 -0000	1.27
--- bucomm.h	27 Jul 2007 15:40:25 -0000
*************** const char *bfd_get_archive_filename (bf
*** 27,32 ****
--- 27,35 ----
  
  void bfd_nonfatal (const char *);
  
+ void bfd_nonfatal_message (const char *, const bfd *, const asection *,
+ 			   const char *, ...);
+ 
  void bfd_fatal (const char *) ATTRIBUTE_NORETURN;
  
  void report (const char *, va_list) ATTRIBUTE_PRINTF(1,0);
Index: objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.117
diff -c -3 -p -r1.117 objcopy.c
*** objcopy.c	5 Jul 2007 16:54:45 -0000	1.117
--- objcopy.c	27 Jul 2007 15:40:27 -0000
*************** section_rename;
*** 64,71 ****
  /* List of sections to be renamed.  */
  static section_rename *section_rename_list;
  
- #define RETURN_NONFATAL(s) {bfd_nonfatal (s); status = 1; return;}
- 
  static asymbol **isympp = NULL;	/* Input symbols.  */
  static asymbol **osympp = NULL;	/* Output symbols that survive stripping.  */
  
--- 64,69 ----
*************** copy_unknown_object (bfd *ibfd, bfd *obf
*** 1254,1260 ****
  
    if (bfd_stat_arch_elt (ibfd, &buf) != 0)
      {
!       bfd_nonfatal (bfd_get_archive_filename (ibfd));
        return FALSE;
      }
  
--- 1252,1258 ----
  
    if (bfd_stat_arch_elt (ibfd, &buf) != 0)
      {
!       bfd_nonfatal_message (bfd_get_archive_filename (ibfd), NULL, NULL, NULL);
        return FALSE;
      }
  
*************** copy_unknown_object (bfd *ibfd, bfd *obf
*** 1287,1293 ****
        if (bfd_bread (cbuf, (bfd_size_type) tocopy, ibfd)
  	  != (bfd_size_type) tocopy)
  	{
! 	  bfd_nonfatal (bfd_get_archive_filename (ibfd));
  	  free (cbuf);
  	  return FALSE;
  	}
--- 1285,1292 ----
        if (bfd_bread (cbuf, (bfd_size_type) tocopy, ibfd)
  	  != (bfd_size_type) tocopy)
  	{
! 	  bfd_nonfatal_message (bfd_get_archive_filename (ibfd),
! 				NULL, NULL, NULL);
  	  free (cbuf);
  	  return FALSE;
  	}
*************** copy_unknown_object (bfd *ibfd, bfd *obf
*** 1295,1301 ****
        if (bfd_bwrite (cbuf, (bfd_size_type) tocopy, obfd)
  	  != (bfd_size_type) tocopy)
  	{
! 	  bfd_nonfatal (bfd_get_filename (obfd));
  	  free (cbuf);
  	  return FALSE;
  	}
--- 1294,1300 ----
        if (bfd_bwrite (cbuf, (bfd_size_type) tocopy, obfd)
  	  != (bfd_size_type) tocopy)
  	{
! 	  bfd_nonfatal_message (NULL, obfd, NULL, NULL);
  	  free (cbuf);
  	  return FALSE;
  	}
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1332,1338 ****
  
    if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
      {
!       bfd_nonfatal (bfd_get_filename (obfd));
        return FALSE;
      }
  
--- 1331,1337 ----
  
    if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
      {
!       bfd_nonfatal_message (NULL, obfd, NULL, NULL);
        return FALSE;
      }
  
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1366,1372 ****
        if (!bfd_set_start_address (obfd, start)
  	  || !bfd_set_file_flags (obfd, flags))
  	{
! 	  bfd_nonfatal (bfd_get_archive_filename (ibfd));
  	  return FALSE;
  	}
      }
--- 1365,1372 ----
        if (!bfd_set_start_address (obfd, start)
  	  || !bfd_set_file_flags (obfd, flags))
  	{
! 	  bfd_nonfatal_message (bfd_get_archive_filename (ibfd),
! 				NULL, NULL, NULL);
  	  return FALSE;
  	}
      }
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1390,1396 ****
  
    if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
      {
!       bfd_nonfatal (bfd_get_archive_filename (ibfd));
        return FALSE;
      }
  
--- 1390,1396 ----
  
    if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
      {
!       bfd_nonfatal_message (bfd_get_archive_filename (ibfd), NULL, NULL, NULL);
        return FALSE;
      }
  
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1406,1412 ****
    symsize = bfd_get_symtab_upper_bound (ibfd);
    if (symsize < 0)
      {
!       bfd_nonfatal (bfd_get_archive_filename (ibfd));
        return FALSE;
      }
  
--- 1406,1412 ----
    symsize = bfd_get_symtab_upper_bound (ibfd);
    if (symsize < 0)
      {
!       bfd_nonfatal_message (bfd_get_archive_filename (ibfd), NULL, NULL, NULL);
        return FALSE;
      }
  
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1414,1420 ****
    symcount = bfd_canonicalize_symtab (ibfd, isympp);
    if (symcount < 0)
      {
!       bfd_nonfatal (bfd_get_filename (ibfd));
        return FALSE;
      }
  
--- 1414,1420 ----
    symcount = bfd_canonicalize_symtab (ibfd, isympp);
    if (symcount < 0)
      {
!       bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
        return FALSE;
      }
  
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1445,1451 ****
  	     error codes, so check for the most likely user error first.  */
  	  if (bfd_get_section_by_name (obfd, padd->name))
  	    {
! 	      non_fatal (_("can't add section '%s' - it already exists!"), padd->name);
  	      return FALSE;
  	    }
  	  else
--- 1445,1452 ----
  	     error codes, so check for the most likely user error first.  */
  	  if (bfd_get_section_by_name (obfd, padd->name))
  	    {
! 	      bfd_nonfatal_message (NULL, obfd, NULL,
! 				 _("can't add section '%s'"), padd->name);
  	      return FALSE;
  	    }
  	  else
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1453,1467 ****
  	      padd->section = bfd_make_section_with_flags (obfd, padd->name, flags);
  	      if (padd->section == NULL)
  		{
! 		  non_fatal (_("can't create section `%s': %s"),
! 			     padd->name, bfd_errmsg (bfd_get_error ()));
  		  return FALSE;
  		}
  	    }
  
  	  if (! bfd_set_section_size (obfd, padd->section, padd->size))
  	    {
! 	      bfd_nonfatal (bfd_get_filename (obfd));
  	      return FALSE;
  	    }
  
--- 1454,1469 ----
  	      padd->section = bfd_make_section_with_flags (obfd, padd->name, flags);
  	      if (padd->section == NULL)
  		{
! 		  bfd_nonfatal_message (NULL, obfd, NULL,
! 					_("can't create section `%s'"),
! 					padd->name);
  		  return FALSE;
  		}
  	    }
  
  	  if (! bfd_set_section_size (obfd, padd->section, padd->size))
  	    {
! 	      bfd_nonfatal_message (NULL, obfd, padd->section, NULL);
  	      return FALSE;
  	    }
  
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1471,1477 ****
  		if (! bfd_set_section_vma (obfd, padd->section,
  					   pset->vma_val))
  		  {
! 		    bfd_nonfatal (bfd_get_filename (obfd));
  		    return FALSE;
  		  }
  
--- 1473,1479 ----
  		if (! bfd_set_section_vma (obfd, padd->section,
  					   pset->vma_val))
  		  {
! 		    bfd_nonfatal_message (NULL, obfd, padd->section, NULL);
  		    return FALSE;
  		  }
  
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1483,1489 ****
  		      (obfd, padd->section,
  		       bfd_section_alignment (obfd, padd->section)))
  		    {
! 		      bfd_nonfatal (bfd_get_filename (obfd));
  		      return FALSE;
  		    }
  		}
--- 1485,1491 ----
  		      (obfd, padd->section,
  		       bfd_section_alignment (obfd, padd->section)))
  		    {
! 		      bfd_nonfatal_message (NULL, obfd, padd->section, NULL);
  		      return FALSE;
  		    }
  		}
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1498,1504 ****
  
        if (gnu_debuglink_section == NULL)
  	{
! 	  bfd_nonfatal (gnu_debuglink_filename);
  	  return FALSE;
  	}
  
--- 1500,1508 ----
  
        if (gnu_debuglink_section == NULL)
  	{
! 	  bfd_nonfatal_message (NULL, obfd, NULL,
! 				_("cannot create debug link section `%s'"),
! 				gnu_debuglink_filename);
  	  return FALSE;
  	}
  
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1614,1622 ****
  	      if (! bfd_set_section_size (obfd, osections[c - 1],
  					  pad_to - lma))
  		{
! 		  non_fatal (_("Can't add padding to %s: %s"),
! 			     bfd_get_section_name (obfd, osections[c - 1]),
! 			     bfd_errmsg (bfd_get_error ()));
  		  status = 1;
  		}
  	      else
--- 1618,1625 ----
  	      if (! bfd_set_section_size (obfd, osections[c - 1],
  					  pad_to - lma))
  		{
! 		  bfd_nonfatal_message (NULL, obfd, osections[c - 1],
! 					_("can't add padding"));
  		  status = 1;
  		}
  	      else
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1695,1701 ****
  	  if (! bfd_set_section_contents (obfd, padd->section, padd->contents,
  					  0, padd->size))
  	    {
! 	      bfd_nonfatal (bfd_get_filename (obfd));
  	      return FALSE;
  	    }
  	}
--- 1698,1704 ----
  	  if (! bfd_set_section_contents (obfd, padd->section, padd->contents,
  					  0, padd->size))
  	    {
! 	      bfd_nonfatal_message (NULL, obfd, padd->section, NULL);
  	      return FALSE;
  	    }
  	}
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1706,1712 ****
        if (! bfd_fill_in_gnu_debuglink_section
  	  (obfd, gnu_debuglink_section, gnu_debuglink_filename))
  	{
! 	  bfd_nonfatal (gnu_debuglink_filename);
  	  return FALSE;
  	}
      }
--- 1709,1717 ----
        if (! bfd_fill_in_gnu_debuglink_section
  	  (obfd, gnu_debuglink_section, gnu_debuglink_filename))
  	{
! 	  bfd_nonfatal_message (NULL, obfd, NULL,
! 				_("cannot fill debug link section `%s'"),
! 				gnu_debuglink_filename);
  	  return FALSE;
  	}
      }
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1745,1751 ****
  		  if (! bfd_set_section_contents (obfd, osections[i], buf,
  						  off, now))
  		    {
! 		      bfd_nonfatal (bfd_get_filename (obfd));
  		      return FALSE;
  		    }
  
--- 1750,1756 ----
  		  if (! bfd_set_section_contents (obfd, osections[i], buf,
  						  off, now))
  		    {
! 		      bfd_nonfatal_message (NULL, obfd, osections[i], NULL);
  		      return FALSE;
  		    }
  
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1767,1775 ****
       important for the ECOFF code at least.  */
    if (! bfd_copy_private_bfd_data (ibfd, obfd))
      {
!       non_fatal (_("%s: error copying private BFD data: %s"),
! 		 bfd_get_filename (obfd),
! 		 bfd_errmsg (bfd_get_error ()));
        return FALSE;
      }
  
--- 1772,1779 ----
       important for the ECOFF code at least.  */
    if (! bfd_copy_private_bfd_data (ibfd, obfd))
      {
!       bfd_nonfatal_message (NULL, obfd, NULL,
! 			    _("error copying private BFD data"));
        return FALSE;
      }
  
*************** copy_archive (bfd *ibfd, bfd *obfd, cons
*** 1828,1834 ****
    this_element = bfd_openr_next_archived_file (ibfd, NULL);
  
    if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
!     RETURN_NONFATAL (bfd_get_filename (obfd));
  
    while (!status && this_element != NULL)
      {
--- 1832,1842 ----
    this_element = bfd_openr_next_archived_file (ibfd, NULL);
  
    if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
!     {
!       bfd_nonfatal_message (NULL, obfd, NULL, NULL);
!       status = 1;
!       return;
!     }
  
    while (!status && this_element != NULL)
      {
*************** copy_archive (bfd *ibfd, bfd *obfd, cons
*** 1885,1891 ****
  	    output_bfd = bfd_openw (output_name, bfd_get_target (this_element));
  
  	  if (output_bfd == NULL)
! 	    RETURN_NONFATAL (output_name);
  
  	  delete = ! copy_object (this_element, output_bfd);
  
--- 1893,1903 ----
  	    output_bfd = bfd_openw (output_name, bfd_get_target (this_element));
  
  	  if (output_bfd == NULL)
! 	    {
! 	      bfd_nonfatal_message (output_name, NULL, NULL, NULL);
! 	      status = 1;
! 	      return;
! 	    }
  
  	  delete = ! copy_object (this_element, output_bfd);
  
*************** copy_archive (bfd *ibfd, bfd *obfd, cons
*** 1894,1900 ****
  	    {
  	      if (!bfd_close (output_bfd))
  		{
! 		  bfd_nonfatal (bfd_get_filename (output_bfd));
  		  /* Error in new object file. Don't change archive.  */
  		  status = 1;
  		}
--- 1906,1912 ----
  	    {
  	      if (!bfd_close (output_bfd))
  		{
! 		  bfd_nonfatal_message (NULL, output_bfd, NULL, NULL);
  		  /* Error in new object file. Don't change archive.  */
  		  status = 1;
  		}
*************** copy_archive (bfd *ibfd, bfd *obfd, cons
*** 1904,1918 ****
  	}
        else
  	{
! 	  non_fatal (_("Unable to recognise the format of the input file `%s'"),
! 		     bfd_get_archive_filename (this_element));
  
  	  output_bfd = bfd_openw (output_name, output_target);
  copy_unknown_element:
  	  delete = !copy_unknown_object (this_element, output_bfd);
  	  if (!bfd_close_all_done (output_bfd))
  	    {
! 	      bfd_nonfatal (bfd_get_filename (output_bfd));
  	      /* Error in new object file. Don't change archive.  */
  	      status = 1;
  	    }
--- 1916,1931 ----
  	}
        else
  	{
! 	  bfd_nonfatal_message (bfd_get_archive_filename (this_element),
! 				NULL, NULL,
! 				_("Unable to recognise the format of file"));
  
  	  output_bfd = bfd_openw (output_name, output_target);
  copy_unknown_element:
  	  delete = !copy_unknown_object (this_element, output_bfd);
  	  if (!bfd_close_all_done (output_bfd))
  	    {
! 	      bfd_nonfatal_message (NULL, output_bfd, NULL, NULL);
  	      /* Error in new object file. Don't change archive.  */
  	      status = 1;
  	    }
*************** copy_unknown_element:
*** 1946,1955 ****
    *ptr = NULL;
  
    if (!bfd_close (obfd))
!     RETURN_NONFATAL (bfd_get_filename (obfd));
  
    if (!bfd_close (ibfd))
!     RETURN_NONFATAL (bfd_get_filename (ibfd));
  
    /* Delete all the files that we opened.  */
    for (l = list; l != NULL; l = l->next)
--- 1959,1976 ----
    *ptr = NULL;
  
    if (!bfd_close (obfd))
!     {
!       bfd_nonfatal_message (NULL, obfd, NULL, NULL);
!       status = 1;
!       return;
!     }
  
    if (!bfd_close (ibfd))
!     {
!       bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
!       status = 1;
!       return;
!     }
  
    /* Delete all the files that we opened.  */
    for (l = list; l != NULL; l = l->next)
*************** copy_file (const char *input_filename, c
*** 1985,1991 ****
       non-object file, failures are nonfatal.  */
    ibfd = bfd_openr (input_filename, input_target);
    if (ibfd == NULL)
!     RETURN_NONFATAL (input_filename);
  
    if (bfd_check_format (ibfd, bfd_archive))
      {
--- 2006,2016 ----
       non-object file, failures are nonfatal.  */
    ibfd = bfd_openr (input_filename, input_target);
    if (ibfd == NULL)
!     {
!       bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
!       status = 1;
!       return;
!     }
  
    if (bfd_check_format (ibfd, bfd_archive))
      {
*************** copy_file (const char *input_filename, c
*** 2004,2010 ****
  
        obfd = bfd_openw (output_filename, output_target);
        if (obfd == NULL)
! 	RETURN_NONFATAL (output_filename);
  
        copy_archive (ibfd, obfd, output_target, force_output_target);
      }
--- 2029,2039 ----
  
        obfd = bfd_openw (output_filename, output_target);
        if (obfd == NULL)
! 	{
! 	  bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
! 	  status = 1;
! 	  return;
! 	}
  
        copy_archive (ibfd, obfd, output_target, force_output_target);
      }
*************** copy_file (const char *input_filename, c
*** 2020,2035 ****
  
        obfd = bfd_openw (output_filename, output_target);
        if (obfd == NULL)
! 	RETURN_NONFATAL (output_filename);
  
        if (! copy_object (ibfd, obfd))
  	status = 1;
  
        if (!bfd_close (obfd))
! 	RETURN_NONFATAL (output_filename);
  
        if (!bfd_close (ibfd))
! 	RETURN_NONFATAL (input_filename);
  
      }
    else
--- 2049,2076 ----
  
        obfd = bfd_openw (output_filename, output_target);
        if (obfd == NULL)
!  	{
!  	  bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
!  	  status = 1;
!  	  return;
!  	}
  
        if (! copy_object (ibfd, obfd))
  	status = 1;
  
        if (!bfd_close (obfd))
!  	{
!  	  bfd_nonfatal_message (NULL, obfd, NULL, NULL);
!  	  status = 1;
!  	  return;
!  	}
  
        if (!bfd_close (ibfd))
!  	{
!  	  bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
!  	  status = 1;
!  	  return;
!  	}
  
      }
    else
*************** copy_file (const char *input_filename, c
*** 2050,2056 ****
        if (obj_error != core_error)
  	bfd_set_error (obj_error);
  
!       bfd_nonfatal (input_filename);
  
        if (obj_error == bfd_error_file_ambiguously_recognized)
  	{
--- 2091,2097 ----
        if (obj_error != core_error)
  	bfd_set_error (obj_error);
  
!       bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
  
        if (obj_error == bfd_error_file_ambiguously_recognized)
  	{
*************** setup_bfd_headers (bfd *ibfd, bfd *obfd)
*** 2143,2151 ****
    return;
  
  loser:
!   non_fatal (_("%s: error in %s: %s"),
! 	     bfd_get_filename (ibfd),
! 	     err, bfd_errmsg (bfd_get_error ()));
    status = 1;
  }
  
--- 2184,2191 ----
    return;
  
  loser:
!   bfd_nonfatal_message (NULL, ibfd, NULL,
! 			_("error in %s"), err);
    status = 1;
  }
  
*************** setup_section (bfd *ibfd, sec_ptr isecti
*** 2300,2309 ****
    return;
  
  loser:
!   non_fatal (_("%s: section `%s': error in %s: %s"),
! 	     bfd_get_filename (ibfd),
! 	     bfd_section_name (ibfd, isection),
! 	     err, bfd_errmsg (bfd_get_error ()));
    status = 1;
  }
  
--- 2340,2346 ----
    return;
  
  loser:
!   bfd_nonfatal_message (NULL, ibfd, isection, _("error in %s"), err);
    status = 1;
  }
  
*************** copy_section (bfd *ibfd, sec_ptr isectio
*** 2356,2362 ****
  	  if (relsize == -1 && bfd_get_error () == bfd_error_invalid_operation)
  	    relsize = 0;
  	  else
! 	    RETURN_NONFATAL (bfd_get_filename (ibfd));
  	}
      }
  
--- 2393,2403 ----
  	  if (relsize == -1 && bfd_get_error () == bfd_error_invalid_operation)
  	    relsize = 0;
  	  else
! 	    {
! 	      bfd_nonfatal_message (NULL, ibfd, isection, NULL);
! 	      status = 1;
! 	      return;
! 	    }
  	}
      }
  
*************** copy_section (bfd *ibfd, sec_ptr isectio
*** 2367,2373 ****
        relpp = xmalloc (relsize);
        relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
        if (relcount < 0)
! 	RETURN_NONFATAL (bfd_get_filename (ibfd));
  
        if (strip_symbols == STRIP_ALL)
  	{
--- 2408,2419 ----
        relpp = xmalloc (relsize);
        relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
        if (relcount < 0)
! 	{
! 	  bfd_nonfatal_message (NULL, ibfd, isection,
! 				_("relocation count is negative"));
! 	  status = 1;
! 	  return;
! 	}
  
        if (strip_symbols == STRIP_ALL)
  	{
*************** copy_section (bfd *ibfd, sec_ptr isectio
*** 2401,2407 ****
        void *memhunk = xmalloc (size);
  
        if (!bfd_get_section_contents (ibfd, isection, memhunk, 0, size))
! 	RETURN_NONFATAL (bfd_get_filename (ibfd));
  
        if (reverse_bytes)
  	{
--- 2447,2457 ----
        void *memhunk = xmalloc (size);
  
        if (!bfd_get_section_contents (ibfd, isection, memhunk, 0, size))
! 	{
! 	  bfd_nonfatal_message (NULL, ibfd, isection, NULL);
! 	  status = 1;
! 	  return;
! 	}
  
        if (reverse_bytes)
  	{
*************** copy_section (bfd *ibfd, sec_ptr isectio
*** 2444,2451 ****
  	}
  
        if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
! 	RETURN_NONFATAL (bfd_get_filename (obfd));
! 
        free (memhunk);
      }
    else if (p != NULL && p->set_flags && (p->flags & SEC_HAS_CONTENTS) != 0)
--- 2494,2504 ----
  	}
  
        if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
! 	{
! 	  bfd_nonfatal_message (NULL, obfd, osection, NULL);
! 	  status = 1;
! 	  return;
! 	}
        free (memhunk);
      }
    else if (p != NULL && p->set_flags && (p->flags & SEC_HAS_CONTENTS) != 0)
*************** copy_section (bfd *ibfd, sec_ptr isectio
*** 2460,2466 ****
  
        memset (memhunk, 0, size);
        if (! bfd_set_section_contents (obfd, osection, memhunk, 0, size))
! 	RETURN_NONFATAL (bfd_get_filename (obfd));
        free (memhunk);
      }
  }
--- 2513,2523 ----
  
        memset (memhunk, 0, size);
        if (! bfd_set_section_contents (obfd, osection, memhunk, 0, size))
! 	{
! 	  bfd_nonfatal_message (NULL, obfd, osection, NULL);
! 	  status = 1;
! 	  return;
! 	}
        free (memhunk);
      }
  }
*************** write_debugging_info (bfd *obfd, void *d
*** 2601,2609 ****
  	  || ! bfd_set_section_alignment (obfd, stabsec, 2)
  	  || ! bfd_set_section_alignment (obfd, stabstrsec, 0))
  	{
! 	  non_fatal (_("%s: can't create debugging section: %s"),
! 		     bfd_get_filename (obfd),
! 		     bfd_errmsg (bfd_get_error ()));
  	  return FALSE;
  	}
  
--- 2658,2665 ----
  	  || ! bfd_set_section_alignment (obfd, stabsec, 2)
  	  || ! bfd_set_section_alignment (obfd, stabstrsec, 0))
  	{
! 	  bfd_nonfatal_message (NULL, obfd, NULL,
! 				_("can't create debugging section"));
  	  return FALSE;
  	}
  
*************** write_debugging_info (bfd *obfd, void *d
*** 2615,2631 ****
  	  || ! bfd_set_section_contents (obfd, stabstrsec, strings, 0,
  					 stringsize))
  	{
! 	  non_fatal (_("%s: can't set debugging section contents: %s"),
! 		     bfd_get_filename (obfd),
! 		     bfd_errmsg (bfd_get_error ()));
  	  return FALSE;
  	}
  
        return TRUE;
      }
  
!   non_fatal (_("%s: don't know how to write debugging information for %s"),
! 	     bfd_get_filename (obfd), bfd_get_target (obfd));
    return FALSE;
  }
  
--- 2671,2687 ----
  	  || ! bfd_set_section_contents (obfd, stabstrsec, strings, 0,
  					 stringsize))
  	{
! 	  bfd_nonfatal_message (NULL, obfd, NULL,
! 				_("can't set debugging section contents"));
  	  return FALSE;
  	}
  
        return TRUE;
      }
  
!   bfd_nonfatal_message (NULL, obfd, NULL,
! 			_("don't know how to write debugging information for %s"),
! 	     bfd_get_target (obfd));
    return FALSE;
  }
  

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