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/elf64-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/elf64-mips.c')
-rw-r--r-- | bfd/elf64-mips.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 9501613..115047f 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -3572,6 +3572,8 @@ bfd_elf64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, static reloc_howto_type * mips_elf64_rtype_to_howto (bfd *abfd, unsigned int r_type, bfd_boolean rela_p) { + reloc_howto_type *howto = NULL; + switch (r_type) { case R_MIPS_GNU_VTINHERIT: @@ -3595,29 +3597,33 @@ mips_elf64_rtype_to_howto (bfd *abfd, unsigned int r_type, bfd_boolean rela_p) if (r_type >= R_MICROMIPS_min && r_type < R_MICROMIPS_max) { if (rela_p) - return µmips_elf64_howto_table_rela[r_type - R_MICROMIPS_min]; + howto + = µmips_elf64_howto_table_rela[r_type - R_MICROMIPS_min]; else - return µmips_elf64_howto_table_rel[r_type - R_MICROMIPS_min]; + howto + = µmips_elf64_howto_table_rel[r_type - R_MICROMIPS_min]; } if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max) { if (rela_p) - return &mips16_elf64_howto_table_rela[r_type - R_MIPS16_min]; + howto = &mips16_elf64_howto_table_rela[r_type - R_MIPS16_min]; else - return &mips16_elf64_howto_table_rel[r_type - R_MIPS16_min]; + howto = &mips16_elf64_howto_table_rel[r_type - R_MIPS16_min]; } - if (r_type >= R_MIPS_max) + if (r_type < R_MIPS_max) { - _bfd_error_handler (_("%pB: unsupported relocation type %#x"), - abfd, r_type); - bfd_set_error (bfd_error_bad_value); - return NULL; + if (rela_p) + howto = &mips_elf64_howto_table_rela[r_type]; + else + howto = &mips_elf64_howto_table_rel[r_type]; } - if (rela_p) - return &mips_elf64_howto_table_rela[r_type]; - else - return &mips_elf64_howto_table_rel[r_type]; - break; + 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; } } |