* elf-bfd.h (_bfd_elf_section_from_bfd_section): Update prototype.

* elf.c (_bfd_elf_section_from_bfd_section): Return unsigned int,
	SHN_BAD on error.
	(_bfd_elf_print_private_bfd_data): Test for SHN_BAD result from
	_bfd_elf_section_from_bfd_section, not -1.
	(swap_out_syms): Likewise.
	* elflink.c (elf_link_add_object_symbols): Likewise.
	(bfd_elf_get_bfd_needed_list): Likewise.
	(bfd_elf_match_symbols_in_sections): Likewise.
	(elf_link_add_object_symbols): Don't bother testing for symbols
	using normal sections before calling bfd_section_from_elf_index.
	(elf_link_input_bfd, bfd_elf_final_link): Likewise.
	(bfd_elf_reloc_symbol_deleted_p): Likewise.
	* elfcode.h (elf_slurp_symbol_table): Likewise.
	* elf32-spu.c (get_sym_h): Likewise.
	* elf32-xtensa.c (get_elf_r_symndx_section): Likewise.
	* elf64-ppc.c (opd_entry_value, get_sym_h, ppc64_elf_edit_toc): Ditto.
	* elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
This commit is contained in:
Alan Modra
2008-03-11 23:23:23 +00:00
parent 1bce5d2cc6
commit cb33740c88
9 changed files with 92 additions and 116 deletions

View File

@ -1,6 +1,6 @@
/* ELF executable support for BFD.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, from information published
@ -1270,19 +1270,6 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
{
sym->symbol.section = bfd_und_section_ptr;
}
else if (isym->st_shndx < SHN_LORESERVE
|| isym->st_shndx > SHN_HIRESERVE)
{
sym->symbol.section = bfd_section_from_elf_index (abfd,
isym->st_shndx);
if (sym->symbol.section == NULL)
{
/* This symbol is in a section for which we did not
create a BFD section. Just use bfd_abs_section,
although it is wrong. FIXME. */
sym->symbol.section = bfd_abs_section_ptr;
}
}
else if (isym->st_shndx == SHN_ABS)
{
sym->symbol.section = bfd_abs_section_ptr;
@ -1297,7 +1284,17 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
sym->symbol.value = isym->st_size;
}
else
sym->symbol.section = bfd_abs_section_ptr;
{
sym->symbol.section
= bfd_section_from_elf_index (abfd, isym->st_shndx);
if (sym->symbol.section == NULL)
{
/* This symbol is in a section for which we did not
create a BFD section. Just use bfd_abs_section,
although it is wrong. FIXME. */
sym->symbol.section = bfd_abs_section_ptr;
}
}
/* If this is a relocatable file, then the symbol value is
already section relative. */