[PATCH 1/8] Bfd: Don't abort in cases where the size of a reloc is 3 bytes.

John Darrington john@darrington.wattle.id.au
Mon Jul 16 14:01:00 GMT 2018


* bfd/reloc.c (_bfd_clear_contents): Handle the case where size == 3.
---
 bfd/reloc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/bfd/reloc.c b/bfd/reloc.c
index 68bc8a8..3b42915 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -1636,6 +1636,11 @@ _bfd_clear_contents (reloc_howto_type *howto,
     case 2:
       x = bfd_get_16 (input_bfd, location);
       break;
+    case 3:
+      x = bfd_get_8 (input_bfd, location);
+      x <<= 16;
+      x |= bfd_get_16 (input_bfd, location + 1);
+      break;
     case 4:
       x = bfd_get_32 (input_bfd, location);
       break;
@@ -1670,6 +1675,10 @@ _bfd_clear_contents (reloc_howto_type *howto,
     case 2:
       bfd_put_16 (input_bfd, x, location);
       break;
+    case 3:
+      bfd_put_16 (input_bfd, x, location + 1);
+      bfd_put_8 (input_bfd, x >> 16, location);
+      break;
     case 4:
       bfd_put_32 (input_bfd, x, location);
       break;
-- 
2.1.4



More information about the Binutils mailing list