diff options
author | Gunther Nikl <gnikl@justmail.de> | 2020-04-29 14:42:41 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-04-29 14:42:41 +0100 |
commit | dfa85db14c5e64530200b166044fa7f01f61bd28 (patch) | |
tree | bc32242f1445fd679804099f19e6f75bb883ad42 | |
parent | c2e71e57a0bfd74e9e7b883e457e4bb29bc17396 (diff) | |
download | gdb-dfa85db14c5e64530200b166044fa7f01f61bd28.zip gdb-dfa85db14c5e64530200b166044fa7f01f61bd28.tar.gz gdb-dfa85db14c5e64530200b166044fa7f01f61bd28.tar.bz2 |
bfd: Fix 64-bit relocation handling for a.out
* aoutx.h (swap_std_reloc_out): Special case 64 bit relocations.
(aout_link_reloc_link_order): Likewise. Make r_length an unsigned.
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/aoutx.h | 14 |
2 files changed, 16 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 054aa32..31e8526 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2020-04-29 Gunther Nikl <gnikl@justmail.de> + + * aoutx.h (swap_std_reloc_out): Special case 64 bit relocations. + (aout_link_reloc_link_order): Likewise. Make r_length an unsigned. + 2020-04-28 Alan Modra <amodra@gmail.com> * vms-alpha.c (_bfd_vms_slurp_etir): Correct divide by zero check. diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 41ced3d..d545746 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -1945,7 +1945,12 @@ NAME (aout, swap_std_reloc_out) (bfd *abfd, PUT_WORD (abfd, g->address, natptr->r_address); BFD_ASSERT (g->howto != NULL); - r_length = g->howto->size ; /* Size as a power of two. */ + + if (bfd_get_reloc_size (g->howto) != 8) + r_length = g->howto->size; /* Size as a power of two. */ + else + r_length = 3; + r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ /* XXX This relies on relocs coming from a.out files. */ r_baserel = (g->howto->type & 8) != 0; @@ -3803,13 +3808,16 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo, int r_baserel; int r_jmptable; int r_relative; - int r_length; + unsigned int r_length; r_pcrel = (int) howto->pc_relative; r_baserel = (howto->type & 8) != 0; r_jmptable = (howto->type & 16) != 0; r_relative = (howto->type & 32) != 0; - r_length = howto->size; + if (bfd_get_reloc_size (howto) != 8) + r_length = howto->size; /* Size as a power of two. */ + else + r_length = 3; PUT_WORD (flaginfo->output_bfd, p->offset, srel.r_address); if (bfd_header_big_endian (flaginfo->output_bfd)) |