OSDN Git Service

coff-alpha.c (alpha_adjust_reloc_in): Issue an informative error message if an
authorNick Clifton <nickc@redhat.com>
Wed, 6 Jul 2005 10:35:41 +0000 (10:35 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 6 Jul 2005 10:35:41 +0000 (10:35 +0000)
  unknown reloc is encountered.
  (alpha_relocate_section): Likewise.
ecoff.c (_bfd_ecoff_write_object_contents): Cope with a reloc with a missing
  howto field.

bfd/ChangeLog
bfd/coff-alpha.c
bfd/ecoff.c

index 393e2ae..dd2e4a5 100644 (file)
@@ -1,3 +1,12 @@
+2005-07-06  Nick Clifton  <nickc@redhat.com>
+
+       * coff-alpha.c (alpha_adjust_reloc_in): Issue an informative error
+       message if an unknown reloc is encountered.
+       (alpha_relocate_section): Likewise.
+
+       * ecoff.c (_bfd_ecoff_write_object_contents): Cope with a reloc
+       with a missing howto field.
+
 2005-07-06  Alan Modra  <amodra@bigpond.net.au>
 
        * po/SRC-POTFILES.in: Add cpu-ms1.c, elf32-ms1.c, elf-vxworks.c,
index 62a0bb4..444385e 100644 (file)
@@ -632,7 +632,15 @@ alpha_adjust_reloc_in (abfd, intern, rptr)
      arelent *rptr;
 {
   if (intern->r_type > ALPHA_R_GPVALUE)
-    abort ();
+    {
+      (*_bfd_error_handler)
+       (_("%B: unknown/unsupported relocation type %d"),
+        abfd, intern->r_type);
+      bfd_set_error (bfd_error_bad_value);
+      rptr->addend = 0;
+      rptr->howto  = NULL;
+      return;
+    }
 
   switch (intern->r_type)
     {
@@ -1521,8 +1529,26 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
 
       switch (r_type)
        {
+       case ALPHA_R_GPRELHIGH:
+         (*_bfd_error_handler)
+           (_("%B: unsupported relocation: ALPHA_R_GPRELHIGH"),
+            input_bfd);
+         bfd_set_error (bfd_error_bad_value);
+         continue;
+         
+       case ALPHA_R_GPRELLOW:
+         (*_bfd_error_handler)
+           (_("%B: unsupported relocation: ALPHA_R_GPRELLOW"),
+            input_bfd);
+         bfd_set_error (bfd_error_bad_value);
+         continue;
+         
        default:
-         abort ();
+         (*_bfd_error_handler)
+           (_("%B: unknown relocation type %d"),
+            input_bfd, (int) r_type);
+         bfd_set_error (bfd_error_bad_value);
+         continue;
 
        case ALPHA_R_IGNORE:
          /* This reloc appears after a GPDISP reloc.  On earlier
index 8938551..cf2658a 100644 (file)
@@ -2633,6 +2633,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
          reloc_ptr_ptr = current->orelocation;
          reloc_end = reloc_ptr_ptr + current->reloc_count;
          out_ptr = (char *) reloc_buff;
+
          for (;
               reloc_ptr_ptr < reloc_end;
               reloc_ptr_ptr++, out_ptr += external_reloc_size)
@@ -2646,6 +2647,11 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
              reloc = *reloc_ptr_ptr;
              sym = *reloc->sym_ptr_ptr;
 
+             /* If the howto field has not been initialised then skip this reloc.
+                This assumes that an error message has been issued elsewhere.  */
+             if (reloc->howto == NULL)
+               continue;
+
              in.r_vaddr = (reloc->address
                            + bfd_get_section_vma (abfd, current));
              in.r_type = reloc->howto->type;