+2018-12-18 Alan Modra <amodra@gmail.com>
+
+ PR 23980
+ * elf32-i386.c (elf_i386_relocate_section): Exit with wrong format
+ error rather than asserting input file is as expected.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Exit with wrong format
+ error if input file is not ppc32 ELF.
+
2018-12-18 Alan Modra <amodra@gmail.com>
PR 23980
if (htab == NULL)
return FALSE;
- BFD_ASSERT (is_x86_elf (input_bfd, htab));
+ if (!is_x86_elf (input_bfd, htab))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
symtab_hdr = &elf_symtab_hdr (input_bfd);
sym_hashes = elf_sym_hashes (input_bfd);
(bfd_link_relocatable (info)) ? " (relocatable)" : "");
#endif
+ if (!is_ppc_elf (input_bfd))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
+
got2 = bfd_get_section_by_name (input_bfd, ".got2");
/* Initialize howto table if not already done. */
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- BFD_ASSERT (is_s390_elf (input_bfd));
+ if (!is_s390_elf (input_bfd))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
htab = elf_s390_hash_table (info);
symtab_hdr = &elf_symtab_hdr (input_bfd);
unsigned isec_segment, got_segment, plt_segment, check_segment[2];
bfd_boolean fdpic_p = FALSE;
- BFD_ASSERT (is_sh_elf (input_bfd));
+ if (!is_sh_elf (input_bfd))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
htab = sh_elf_hash_table (info);
if (htab != NULL)
if (!xtensa_default_isa)
xtensa_default_isa = xtensa_isa_init (0, 0);
- BFD_ASSERT (is_xtensa_elf (input_bfd));
+ if (!is_xtensa_elf (input_bfd))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
htab = elf_xtensa_hash_table (info);
if (htab == NULL)
if (input_section->owner == htab->params->stub_bfd)
return TRUE;
- BFD_ASSERT (is_ppc64_elf (input_bfd));
+ if (!is_ppc64_elf (input_bfd))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
local_got_ents = elf_local_got_ents (input_bfd);
TOCstart = elf_gp (output_bfd);
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- BFD_ASSERT (is_s390_elf (input_bfd));
+ if (!is_s390_elf (input_bfd))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
htab = elf_s390_hash_table (info);
if (htab == NULL)
if (htab == NULL)
return FALSE;
- BFD_ASSERT (is_x86_elf (input_bfd, htab));
+ if (!is_x86_elf (input_bfd, htab))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
plt_entry_size = htab->plt.plt_entry_size;
symtab_hdr = &elf_symtab_hdr (input_bfd);