PR ld/2008
	* elf.c (_bfd_elf_setup_sections): Return FALSE if
	elf_linked_to_section will be set to NULL.

	* format.c (bfd_check_format_matches): Don't check the default
	target twice.
This commit is contained in:
H.J. Lu
2005-12-13 15:34:28 +00:00
parent a717134b33
commit 25bbc98480
3 changed files with 28 additions and 2 deletions

View File

@@ -654,8 +654,23 @@ _bfd_elf_setup_sections (bfd *abfd)
}
else
{
asection *link;
this_hdr = elf_elfsections (abfd)[elfsec];
elf_linked_to_section (s) = this_hdr->bfd_section;
/* PR 1991, 2008:
Some strip/objcopy may leave an incorrect value in
sh_link. We don't want to proceed. */
link = this_hdr->bfd_section;
if (link == NULL)
{
(*_bfd_error_handler)
(_("%B: sh_link [%d] in section `%A' is incorrect"),
s->owner, s, elfsec);
result = FALSE;
}
elf_linked_to_section (s) = link;
}
}
}