Replace calls to abort (in readelf) with informative error messages.
[deliverable/binutils-gdb.git] / binutils / readelf.c
index 200475232a85339b7ab90498eedfe8211991bf06..691f64cdfe3a998759a7817506a6b05ee8c9a090 100644 (file)
@@ -3123,7 +3123,9 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
                   strcat (buf, ", abort");
                   break;
                 default:
-                  abort ();
+                 warn (_("Unrecognised IA64 VMS Command Code: %x\n"),
+                       e_flags & EF_IA_64_VMS_COMCOD);
+                 strcat (buf, ", <unknown>");
                 }
             }
          break;
@@ -5086,7 +5088,10 @@ get_elf_section_flags (bfd_vma sh_flags)
              if (p != buff + field_size + 4)
                {
                  if (size < (10 + 2))
-                   abort ();
+                   {
+                     warn (_("Internal error: not enough buffer room for section flag info"));
+                     return _("<unknown>");
+                   }
                  size -= 2;
                  *p++ = ',';
                  *p++ = ' ';
@@ -5150,7 +5155,10 @@ get_elf_section_flags (bfd_vma sh_flags)
          if (p != buff + field_size + 4)
            {
              if (size < (2 + 1))
-               abort ();
+               {
+                 warn (_("Internal error: not enough buffer room for section flag info"));
+                 return _("<unknown>");
+               }
              size -= 2;
              *p++ = ',';
              *p++ = ' ';
@@ -5165,7 +5173,10 @@ get_elf_section_flags (bfd_vma sh_flags)
          if (p != buff + field_size + 4)
            {
              if (size < (2 + 1))
-               abort ();
+               {
+                 warn (_("Internal error: not enough buffer room for section flag info"));
+                 return _("<unknown>");
+               }
              size -= 2;
              *p++ = ',';
              *p++ = ' ';
@@ -5180,7 +5191,10 @@ get_elf_section_flags (bfd_vma sh_flags)
          if (p != buff + field_size + 4)
            {
              if (size < (2 + 1))
-               abort ();
+               {
+                 warn (_("Internal error: not enough buffer room for section flag info"));
+                 return _("<unknown>");
+               }
              size -= 2;
              *p++ = ',';
              *p++ = ' ';
@@ -9708,7 +9722,9 @@ get_symbol_visibility (unsigned int visibility)
     case STV_INTERNAL: return "INTERNAL";
     case STV_HIDDEN:   return "HIDDEN";
     case STV_PROTECTED: return "PROTECTED";
-    default: abort ();
+    default:
+      error (_("Unrecognized visibility value: %u"), visibility);
+      return _("<unknown>");
     }
 }
 
@@ -9763,7 +9779,10 @@ get_ia64_symbol_other (unsigned int other)
               strcat (res, " RSV");
               break;
             default:
-              abort ();
+             warn (_("Unrecognized IA64 VMS ST Function type: %d\n"),
+                   VMS_ST_FUNC_TYPE (other));
+             strcat (res, " <unknown>");
+             break;
             }
           break;
         default:
@@ -9784,7 +9803,10 @@ get_ia64_symbol_other (unsigned int other)
           strcat (res, " LNK");
           break;
         default:
-          abort ();
+         warn (_("Unrecognized IA64 VMS ST Linkage: %d\n"),
+               VMS_ST_LINKAGE (other));
+         strcat (res, " <unknown>");
+         break;
         }
 
       if (res[0] != 0)
@@ -10981,9 +11003,16 @@ is_32bit_abs_reloc (unsigned int reloc_type)
     case EM_XTENSA:
       return reloc_type == 1; /* R_XTENSA_32.  */
     default:
-      error (_("Missing knowledge of 32-bit reloc types used in DWARF sections of machine number %d\n"),
-            elf_header.e_machine);
-      abort ();
+      {
+       static unsigned int prev_warn = 0;
+
+       /* Avoid repeating the same warning multiple times.  */
+       if (prev_warn != elf_header.e_machine)
+         error (_("Missing knowledge of 32-bit reloc types used in DWARF sections of machine number %d\n"),
+                elf_header.e_machine);
+       prev_warn = elf_header.e_machine;
+       return FALSE;
+      }
     }
 }
 
@@ -11342,8 +11371,11 @@ apply_relocations (void * file,
            reloc_size = 2;
          else
            {
-             warn (_("unable to apply unsupported reloc type %d to section %s\n"),
-                   reloc_type, printable_section_name (section));
+             static unsigned int prev_reloc = 0;
+             if (reloc_type != prev_reloc)
+               warn (_("unable to apply unsupported reloc type %d to section %s\n"),
+                     reloc_type, printable_section_name (section));
+             prev_reloc = reloc_type;
              continue;
            }
 
@@ -12250,7 +12282,8 @@ display_arm_attribute (unsigned char * p,
              break;
 
            default:
-             abort ();
+             printf (_("<unknown: %d>\n"), tag);
+             break;
            }
          return p;
 
This page took 0.028687 seconds and 4 git commands to generate.