_bfd_mips_elf_final_link: Notify user about wrong .reginfo size

One of assertions in _bfd_mips_elf_final_link could be triggered by
a combination of input files and a linker script.  This happens when
either the input doesn't contain .reginfo section or when this section
is oversized.  This patch replaces the assertion with a more useful
error message.

	* elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
	.reginfo section has wrong size.
This commit is contained in:
Vlad Ivanov 2018-01-12 09:25:11 +00:00 committed by Maciej W. Rozycki
parent 97a232d733
commit 58807c48a5
2 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2018-01-12 Vlad Ivanov <vlad@ivanov.email>
* elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
.reginfo section has wrong size.
2018-01-11 H.J. Lu <hongjiu.lu@intel.com>
PR ld/22393

View File

@ -14374,7 +14374,15 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
}
/* Size has been set in _bfd_mips_elf_always_size_sections. */
BFD_ASSERT(o->size == sizeof (Elf32_External_RegInfo));
if (o->size != sizeof (Elf32_External_RegInfo))
{
_bfd_error_handler
(_("%B: .reginfo section size should be %d bytes, "
"actual size is %d"),
abfd, sizeof (Elf32_External_RegInfo), o->size);
return FALSE;
}
/* Skip this section later on (I don't think this currently
matters, but someday it might). */