diff options
author | Alan Modra <amodra@gmail.com> | 2018-12-18 09:20:06 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-12-18 10:47:02 +1030 |
commit | 7af5d5c4dda26ac36ee2ff42af8f39a10382cc41 (patch) | |
tree | ea96ed2204aee3212b07516b827b30a0b779192f /bfd/elf64-s390.c | |
parent | c5ebe0ff706521b4a5fb66a5e764031825276ad5 (diff) | |
download | gdb-7af5d5c4dda26ac36ee2ff42af8f39a10382cc41.zip gdb-7af5d5c4dda26ac36ee2ff42af8f39a10382cc41.tar.gz gdb-7af5d5c4dda26ac36ee2ff42af8f39a10382cc41.tar.bz2 |
PR23980, assertion fail
All of the backend relocate_section functions that interpret reloc
numbers assuming the input file is of the expected type (ie. same as
output or very similar) really ought to be checking input file type.
Not many do, and those that do currently just assert. This patch
replaces the assertion with a more graceful exit.
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.
Diffstat (limited to 'bfd/elf64-s390.c')
-rw-r--r-- | bfd/elf64-s390.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index c2a2955..b05df50 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -2119,7 +2119,11 @@ elf_s390_relocate_section (bfd *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) |