netbsd-core.c and bfd_make_section_anyway()

Jason R Thorpe thorpej@wasabisystems.com
Sat Jan 5 18:04:00 GMT 2002


On Sat, Jan 05, 2002 at 05:28:08PM -0800, Jason R Thorpe wrote:

 > ...and bfd_make_section_anyway() calls bfd_section_init() which calls
 > bfd_make_empty_symbol(), which returns NULL.
 > 
 > irix-core.c seems to work-around this by providing its own make_empty_symbol
 > routine, and uding the _bfd_nosymbols versions for all the other symbol
 > routines.
 > 
 > Should all the core file vectors be changed to behave like the irix version?
 > If so, I can supply a fix for netbsd-core.c.

...alternative, the following patch fixes it, as well.

2002-01-05  Jason Thorpe  <thorpej@wasabisystems.com>

	* section.c (bfd_section_init): Do not fail if the target
	vector does not support symbols.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>
-------------- next part --------------
Index: section.c
===================================================================
RCS file: /cvs/src/src/bfd/section.c,v
retrieving revision 1.43
diff -c -r1.43 section.c
*** section.c	2002/01/05 13:11:31	1.43
--- section.c	2002/01/06 01:42:28
***************
*** 713,726 ****
       of a section.  */
    newsect->symbol = bfd_make_empty_symbol (abfd);
    if (newsect->symbol == NULL)
!     return NULL;
  
!   newsect->symbol->name = newsect->name;
!   newsect->symbol->value = 0;
!   newsect->symbol->section = newsect;
!   newsect->symbol->flags = BSF_SECTION_SYM;
! 
!   newsect->symbol_ptr_ptr = &newsect->symbol;
  
    if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect)))
      return NULL;
--- 713,734 ----
       of a section.  */
    newsect->symbol = bfd_make_empty_symbol (abfd);
    if (newsect->symbol == NULL)
!     {
!       /* If the target vector doesn't support symbols, don't treat
! 	 this as an error.  */
!       if (abfd->xvec->_bfd_make_empty_symbol !=
!           _bfd_nosymbols_make_empty_symbol)
!         return NULL;
!     }
!   else
!     {
!       newsect->symbol->name = newsect->name;
!       newsect->symbol->value = 0;
!       newsect->symbol->section = newsect;
!       newsect->symbol->flags = BSF_SECTION_SYM;
  
!       newsect->symbol_ptr_ptr = &newsect->symbol;
!     }
  
    if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect)))
      return NULL;


More information about the Binutils mailing list