[PATCH]: Fix elf32-v850.c's detection of a missing symbol table
Nick Clifton
nickc@redhat.com
Tue May 17 11:55:00 GMT 2005
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,
More information about the Binutils
mailing list