* 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

@@ -1180,7 +1180,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
s = bfd_get_section_by_name (abfd, ".dynamic");
if (s != NULL)
{
int elfsec;
unsigned int elfsec;
unsigned long shlink;
bfd_byte *extdyn, *extdynend;
size_t extdynsize;
@@ -1192,7 +1192,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
goto error_return;
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
if (elfsec == -1)
if (elfsec == SHN_BAD)
goto error_return;
shlink = elf_elfsections (abfd)[elfsec]->sh_link;
@@ -4996,11 +4996,11 @@ _bfd_elf_write_corefile_contents (bfd *abfd)
/* Given a section, search the header to find them. */
int
unsigned int
_bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect)
{
const struct elf_backend_data *bed;
int index;
unsigned int index;
if (elf_section_data (asect) != NULL
&& elf_section_data (asect)->this_idx != 0)
@@ -5013,7 +5013,7 @@ _bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect)
else if (bfd_is_und_section (asect))
index = SHN_UNDEF;
else
index = -1;
index = SHN_BAD;
bed = get_elf_backend_data (abfd);
if (bed->elf_backend_section_from_bfd_section)
@@ -5024,7 +5024,7 @@ _bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect)
return retval;
}
if (index == -1)
if (index == SHN_BAD)
bfd_set_error (bfd_error_nonrepresentable_section);
return index;
@@ -6277,7 +6277,7 @@ swap_out_syms (bfd *abfd,
else
{
asection *sec = syms[idx]->section;
int shndx;
unsigned int shndx;
if (sec->output_section)
{
@@ -6324,7 +6324,7 @@ swap_out_syms (bfd *abfd,
{
shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
if (shndx == -1)
if (shndx == SHN_BAD)
{
asection *sec2;
@@ -6348,7 +6348,7 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"),
}
shndx = _bfd_elf_section_from_bfd_section (abfd, sec2);
BFD_ASSERT (shndx != -1);
BFD_ASSERT (shndx != SHN_BAD);
}
}