public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH]: Fix elf32-v850.c's detection of a missing symbol table
@ 2005-05-17 11:55 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2005-05-17 11:55 UTC (permalink / raw)
  To: binutils

Hi Guys,

  A user recently noticed a bug in the v850 toolchain - the
  elf32-v850.c file has code to detect corrupt input files which
  contain relocs but no symbol table.  Unfortunately this code could
  also be triggered by valid input files which only contain relocs
  against section symbols.  So I am applying the patch below to fix
  this problem.

Cheers
  Nick

bfd/ChangeLog
2005-05-17  Nick Clifton  <nickc@redhat.com>

	* elf32-v850.c (v850_elf_relocate_section): Move code to test for
	the presence of a symbol table to just before the symbol table is
	actually used.

Index: bfd/elf32-v850.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-v850.c,v
retrieving revision 1.54
diff -c -3 -p -r1.54 elf32-v850.c
*** bfd/elf32-v850.c	7 May 2005 13:22:51 -0000	1.54
--- bfd/elf32-v850.c	17 May 2005 10:19:17 -0000
*************** v850_elf_relocate_section (output_bfd, i
*** 1649,1663 ****
    symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
    sym_hashes = elf_sym_hashes (input_bfd);
  
-   if (sym_hashes == NULL)
-     {
-       info->callbacks->warning
- 	(info, "no hash table available",
- 	 NULL, input_bfd, input_section, (bfd_vma) 0);
- 
-       return FALSE;
-     }
- 
    /* Reset the list of remembered HI16S relocs to empty.  */
    free_hi16s     = previous_hi16s;
    previous_hi16s = NULL;
--- 1649,1654 ----
*************** v850_elf_relocate_section (output_bfd, i
*** 1698,1703 ****
--- 1689,1706 ----
  	{
  	  bfd_boolean unresolved_reloc, warned;
  
+ 	  /* Note - this check is delayed until now as it is possible and valid
+ 	     to have a file without any symbols but with relocs that can be
+ 	     processed.  */
+ 	  if (sym_hashes == NULL)
+ 	    {
+ 	      info->callbacks->warning
+ 		(info, "no hash table available",
+ 		 NULL, input_bfd, input_section, (bfd_vma) 0);
+ 
+ 	      return FALSE;
+ 	    }
+ 
  	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
  				   r_symndx, symtab_hdr, sym_hashes,
  				   h, sec, relocation,
  

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-17 10:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-17 11:55 [PATCH]: Fix elf32-v850.c's detection of a missing symbol table Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).