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]

strip & nop relocs


This patch fixes a problem with stripping debug sections out of objects. Some toolchains use nop relocs to link a code section to its debug section. If you try and strip such an object, you get left with a dangling relocation to the removed debug section, and the strip fails.

This patch fixes bfd to not complain about such dangling relocations to non-allocatable sections.

ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery

2008-11-14  Nathan Sidwell  <nathan@codesourcery.com>

	* elf.c (_bfd_elf_symbol_from_bfd_symbol): Don't die on missing
	symbols in non-alloc sections.

Index: elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.468
diff -c -3 -p -r1.468 elf.c
*** elf.c	11 Nov 2008 04:26:13 -0000	1.468
--- elf.c	14 Nov 2008 10:54:26 -0000
*************** _bfd_elf_symbol_from_bfd_symbol (bfd *ab
*** 5066,5075 ****
  
    idx = asym_ptr->udata.i;
  
!   if (idx == 0)
      {
        /* This case can occur when using --strip-symbol on a symbol
! 	 which is used in a relocation entry.  */
        (*_bfd_error_handler)
  	(_("%B: symbol `%s' required but not present"),
  	 abfd, bfd_asymbol_name (asym_ptr));
--- 5081,5092 ----
  
    idx = asym_ptr->udata.i;
  
!   if (idx == 0 && (asym_ptr->section->flags & SEC_ALLOC) != 0)
      {
        /* This case can occur when using --strip-symbol on a symbol
! 	 which is used in a relocation entry.  Some compilers use
!          this to link code to debug sections.  It's only a problem if
!          the symbol is in an allocatable section, so complain then.  */
        (*_bfd_error_handler)
  	(_("%B: symbol `%s' required but not present"),
  	 abfd, bfd_asymbol_name (asym_ptr));

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