This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 6/6] PR binutils/22875: HPPA/ELF: Also fail with relocation placeholders
- From: "Maciej W. Rozycki" <macro at mips dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: Alan Modra <amodra at gmail dot com>, Dave Anglin <dave dot anglin at nrc dot ca>, Jeff Law <law at redhat dot com>, <binutils at sourceware dot org>
- Date: Thu, 29 Mar 2018 18:35:06 +0100
- Subject: [PATCH 6/6] PR binutils/22875: HPPA/ELF: Also fail with relocation placeholders
- References: <alpine.DEB.2.00.1803282251560.2163@tp.orcam.me.uk>
Do not consider R_PARISC_UNIMPLEMENTED placeholder relocation entries of
the `elf_hppa_howto_table' table valid in `info_to_howto' HPPA handlers.
Instead issue an unsupported relocation type error and return a NULL
howto as with relocations whose number is R_PARISC_UNIMPLEMENTED or
beyond.
bfd/
* elf-hppa.h (elf_hppa_info_to_howto): Also return
unsuccessfully for unimplemented relocations.
(elf_hppa_info_to_howto_rel): Likewise.
---
Hi,
Regression-tested successfully. OK to apply?
Maciej
---
bfd/elf-hppa.h | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
binutils-hppa-bfd-unsupp-reloc.diff
Index: binutils/bfd/elf-hppa.h
===================================================================
--- binutils.orig/bfd/elf-hppa.h 2018-03-27 18:15:36.002447700 +0100
+++ binutils/bfd/elf-hppa.h 2018-03-27 18:23:58.131106596 +0100
@@ -1026,8 +1026,15 @@ elf_hppa_info_to_howto (bfd *abfd,
Elf_Internal_Rela *elf_reloc)
{
unsigned int r_type = ELF32_R_TYPE (elf_reloc->r_info);
+ unsigned int type = r_type;
+ reloc_howto_type *howto;
- if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED)
+ if (r_type < (unsigned int) R_PARISC_UNIMPLEMENTED)
+ {
+ howto = &elf_hppa_howto_table[r_type];
+ type = howto->type;
+ }
+ if (type >= (unsigned int) R_PARISC_UNIMPLEMENTED)
{
/* xgettext:c-format */
_bfd_error_handler (_("%pB: unsupported relocation type %#x"),
@@ -1035,7 +1042,7 @@ elf_hppa_info_to_howto (bfd *abfd,
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
- bfd_reloc->howto = &elf_hppa_howto_table[r_type];
+ bfd_reloc->howto = howto;
return TRUE;
}
@@ -1047,8 +1054,15 @@ elf_hppa_info_to_howto_rel (bfd *abfd,
Elf_Internal_Rela *elf_reloc)
{
unsigned int r_type = ELF_R_TYPE (elf_reloc->r_info);
+ unsigned int type = r_type;
+ reloc_howto_type *howto;
- if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED)
+ if (r_type < (unsigned int) R_PARISC_UNIMPLEMENTED)
+ {
+ howto = &elf_hppa_howto_table[r_type];
+ type = howto->type;
+ }
+ if (type >= (unsigned int) R_PARISC_UNIMPLEMENTED)
{
/* xgettext:c-format */
_bfd_error_handler (_("%pB: unsupported relocation type %#x"),
@@ -1056,8 +1070,7 @@ elf_hppa_info_to_howto_rel (bfd *abfd,
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
-
- bfd_reloc->howto = &elf_hppa_howto_table[r_type];
+ bfd_reloc->howto = howto;
return TRUE;
}