aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2014-12-03 16:33:33 +0000
committerNick Clifton <nickc@redhat.com>2014-12-03 16:33:33 +0000
commitbee0ee850e846a8717b9aadb8d5da3adee3254ee (patch)
tree785504a49ae5a62a179db9176bbd7c0155f5d9d7 /binutils
parent9d157cb9fe73ff3d911ccdf581ab09eae02e78aa (diff)
downloadgdb-bee0ee850e846a8717b9aadb8d5da3adee3254ee.zip
gdb-bee0ee850e846a8717b9aadb8d5da3adee3254ee.tar.gz
gdb-bee0ee850e846a8717b9aadb8d5da3adee3254ee.tar.bz2
Replace calls to abort (in readelf) with informative error messages.
PR binutils/17531 * readelf.c (get_machine_flags): Replace call to abort with a warning message and a return value. (get_elf_section_flags): Likewise. (get_symbol_visibility): Likewise. (get_ia64_symbol_other): Likewise. (get_ia64_symbol_other): Likewise. (is_32bit_abs_reloc): Likewise. (apply_relocations): Likewise. (display_arm_attribute): Likewise.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog13
-rw-r--r--binutils/readelf.c61
2 files changed, 60 insertions, 14 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 2788dc4..2d28e1c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,16 @@
+2014-12-03 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/17531
+ * readelf.c (get_machine_flags): Replace call to abort with a
+ warning message and a return value.
+ (get_elf_section_flags): Likewise.
+ (get_symbol_visibility): Likewise.
+ (get_ia64_symbol_other): Likewise.
+ (get_ia64_symbol_other): Likewise.
+ (is_32bit_abs_reloc): Likewise.
+ (apply_relocations): Likewise.
+ (display_arm_attribute): Likewise.
+
2014-12-02 Denis Chertykov <chertykov@gmail.com>
* MAINTAINERS: Fix my email address.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 2004752..691f64c 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -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;