[PATCH] bfd: Fix 64-bit relocation handling for a.out
[deliverable/binutils-gdb.git] / bfd / aoutx.h
index d5457461ab0c37381c57b0a8cee46fdb5ed0bda9..9ffb3fe8610ec2bb63fd8c0454bbb7e4c7afe126 100644 (file)
@@ -1946,10 +1946,22 @@ NAME (aout, swap_std_reloc_out) (bfd *abfd,
 
   BFD_ASSERT (g->howto != NULL);
 
-  if (bfd_get_reloc_size (g->howto) != 8)
-    r_length = g->howto->size; /* Size as a power of two.  */
-  else
-    r_length = 3;
+  switch (bfd_get_reloc_size (g->howto))
+    {
+    default:
+      _bfd_error_handler (_("%pB: unsupported AOUT relocation size: %d"),
+                         abfd, bfd_get_reloc_size (g->howto));
+      bfd_set_error (bfd_error_bad_value);
+      return;
+    case 1:
+    case 2:
+    case 4:
+      r_length = g->howto->size;       /* Size as a power of two.  */
+      break;
+    case 8:
+      r_length = 3;
+      break;
+    }
 
   r_pcrel  = (int) g->howto->pc_relative; /* Relative to PC?  */
   /* XXX This relies on relocs coming from a.out files.  */
This page took 0.027712 seconds and 4 git commands to generate.