bfd: Fix 64-bit relocation handling for a.out
authorGunther Nikl <gnikl@justmail.de>
Wed, 29 Apr 2020 13:42:41 +0000 (14:42 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 29 Apr 2020 13:42:41 +0000 (14:42 +0100)
* aoutx.h (swap_std_reloc_out): Special case 64 bit relocations.
(aout_link_reloc_link_order): Likewise. Make r_length an unsigned.

bfd/ChangeLog
bfd/aoutx.h

index 054aa32745b4b809983ef777d1b85dced34184ae..31e8526da9fddc101c590e3dcba903673cfe93bd 100644 (file)
@@ -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.
index 41ced3dc72aadd100996cd43aa4ff385172094ef..d5457461ab0c37381c57b0a8cee46fdb5ed0bda9 100644 (file)
@@ -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))
This page took 0.027734 seconds and 4 git commands to generate.