aboutsummaryrefslogtreecommitdiff
path: root/bfd/reloc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-11-19 07:29:26 +1030
committerAlan Modra <amodra@gmail.com>2019-11-19 07:35:05 +1030
commit94698d0198f4018b2ac248b248868cb7a5c0cc43 (patch)
treefe373cc4fe81bf04f1ab0171a8ec236444c79768 /bfd/reloc.c
parent2e953acac2ef45afa10e0b2c4c6c23fb52718a26 (diff)
downloadgdb-94698d0198f4018b2ac248b248868cb7a5c0cc43.zip
gdb-94698d0198f4018b2ac248b248868cb7a5c0cc43.tar.gz
gdb-94698d0198f4018b2ac248b248868cb7a5c0cc43.tar.bz2
PR25200, SIGSEGV in _bfd_elf_validate_reloc
PR 25200 * reloc.c (bfd_default_reloc_type_lookup): Don't BFD_FAIL. * elf.c (_bfd_elf_validate_reloc): Don't segfault on NULL howto.
Diffstat (limited to 'bfd/reloc.c')
-rw-r--r--bfd/reloc.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/bfd/reloc.c b/bfd/reloc.c
index ae71f6b..cc842d7514 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -8123,28 +8123,11 @@ DESCRIPTION
reloc_howto_type *
bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
{
- switch (code)
- {
- case BFD_RELOC_CTOR:
- /* The type of reloc used in a ctor, which will be as wide as the
- address - so either a 64, 32, or 16 bitter. */
- switch (bfd_arch_bits_per_address (abfd))
- {
- case 64:
- BFD_FAIL ();
- break;
- case 32:
- return &bfd_howto_32;
- case 16:
- BFD_FAIL ();
- break;
- default:
- BFD_FAIL ();
- }
- break;
- default:
- BFD_FAIL ();
- }
+ /* Very limited support is provided for relocs in generic targets
+ such as elf32-little. FIXME: Should we always return NULL? */
+ if (code == BFD_RELOC_CTOR
+ && bfd_arch_bits_per_address (abfd) == 32)
+ return &bfd_howto_32;
return NULL;
}