diff options
author | Maciej W. Rozycki <macro@mips.com> | 2018-04-04 02:00:48 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@mips.com> | 2018-04-04 02:00:48 +0100 |
commit | 7ed6f92aaffdcc0995b0247379fb8ea621854dce (patch) | |
tree | 2c60097492778aeee83be6804d215e9b48eca25f /bfd/elf32-mips.c | |
parent | 270baac0079c128ca6780098c086444d115f4afa (diff) | |
download | gdb-7ed6f92aaffdcc0995b0247379fb8ea621854dce.zip gdb-7ed6f92aaffdcc0995b0247379fb8ea621854dce.tar.gz gdb-7ed6f92aaffdcc0995b0247379fb8ea621854dce.tar.bz2 |
PR binutils/22875: MIPS/ELF: Also fail with relocation placeholders
Do not consider placeholder EMPTY_HOWTO relocation entries valid in
`rtype_to_howto' MIPS handlers. Instead issue an unsupported relocation
type error and return a NULL howto as with relocations outside the three
ISA-specific min-max ranges.
bfd/
* elf32-mips.c (mips_elf32_rtype_to_howto): Also return
unsuccessfully for placeholder howtos.
* elf64-mips.c (mips_elf64_rtype_to_howto): Likewise.
* elfn32-mips.c (mips_elf_n32_rtype_to_howto): Likewise.
Diffstat (limited to 'bfd/elf32-mips.c')
-rw-r--r-- | bfd/elf32-mips.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index c3c96a4..87147b5 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -2198,6 +2198,8 @@ mips_elf32_rtype_to_howto (bfd *abfd, unsigned int r_type, bfd_boolean rela_p ATTRIBUTE_UNUSED) { + reloc_howto_type *howto = NULL; + switch (r_type) { case R_MIPS_GNU_VTINHERIT: @@ -2216,17 +2218,18 @@ mips_elf32_rtype_to_howto (bfd *abfd, return &elf_mips_eh_howto; default: if (r_type >= R_MICROMIPS_min && r_type < R_MICROMIPS_max) - return &elf_micromips_howto_table_rel[r_type - R_MICROMIPS_min]; + howto = &elf_micromips_howto_table_rel[r_type - R_MICROMIPS_min]; if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max) - return &elf_mips16_howto_table_rel[r_type - R_MIPS16_min]; - if (r_type >= (unsigned int) R_MIPS_max) - { - _bfd_error_handler (_("%pB: unsupported relocation type %#x"), - abfd, r_type); - bfd_set_error (bfd_error_bad_value); - return NULL; - } - return &elf_mips_howto_table_rel[r_type]; + howto = &elf_mips16_howto_table_rel[r_type - R_MIPS16_min]; + if (r_type < R_MIPS_max) + howto = &elf_mips_howto_table_rel[r_type]; + if (howto != NULL && howto->name != NULL) + return howto; + + _bfd_error_handler (_("%pB: unsupported relocation type %#x"), + abfd, r_type); + bfd_set_error (bfd_error_bad_value); + return NULL; } } |