mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 13:27:26 +08:00
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.
This commit is contained in:
@ -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>
|
2014-12-02 Denis Chertykov <chertykov@gmail.com>
|
||||||
|
|
||||||
* MAINTAINERS: Fix my email address.
|
* MAINTAINERS: Fix my email address.
|
||||||
|
@ -3123,7 +3123,9 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
|
|||||||
strcat (buf, ", abort");
|
strcat (buf, ", abort");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort ();
|
warn (_("Unrecognised IA64 VMS Command Code: %x\n"),
|
||||||
|
e_flags & EF_IA_64_VMS_COMCOD);
|
||||||
|
strcat (buf, ", <unknown>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -5086,7 +5088,10 @@ get_elf_section_flags (bfd_vma sh_flags)
|
|||||||
if (p != buff + field_size + 4)
|
if (p != buff + field_size + 4)
|
||||||
{
|
{
|
||||||
if (size < (10 + 2))
|
if (size < (10 + 2))
|
||||||
abort ();
|
{
|
||||||
|
warn (_("Internal error: not enough buffer room for section flag info"));
|
||||||
|
return _("<unknown>");
|
||||||
|
}
|
||||||
size -= 2;
|
size -= 2;
|
||||||
*p++ = ',';
|
*p++ = ',';
|
||||||
*p++ = ' ';
|
*p++ = ' ';
|
||||||
@ -5150,7 +5155,10 @@ get_elf_section_flags (bfd_vma sh_flags)
|
|||||||
if (p != buff + field_size + 4)
|
if (p != buff + field_size + 4)
|
||||||
{
|
{
|
||||||
if (size < (2 + 1))
|
if (size < (2 + 1))
|
||||||
abort ();
|
{
|
||||||
|
warn (_("Internal error: not enough buffer room for section flag info"));
|
||||||
|
return _("<unknown>");
|
||||||
|
}
|
||||||
size -= 2;
|
size -= 2;
|
||||||
*p++ = ',';
|
*p++ = ',';
|
||||||
*p++ = ' ';
|
*p++ = ' ';
|
||||||
@ -5165,7 +5173,10 @@ get_elf_section_flags (bfd_vma sh_flags)
|
|||||||
if (p != buff + field_size + 4)
|
if (p != buff + field_size + 4)
|
||||||
{
|
{
|
||||||
if (size < (2 + 1))
|
if (size < (2 + 1))
|
||||||
abort ();
|
{
|
||||||
|
warn (_("Internal error: not enough buffer room for section flag info"));
|
||||||
|
return _("<unknown>");
|
||||||
|
}
|
||||||
size -= 2;
|
size -= 2;
|
||||||
*p++ = ',';
|
*p++ = ',';
|
||||||
*p++ = ' ';
|
*p++ = ' ';
|
||||||
@ -5180,7 +5191,10 @@ get_elf_section_flags (bfd_vma sh_flags)
|
|||||||
if (p != buff + field_size + 4)
|
if (p != buff + field_size + 4)
|
||||||
{
|
{
|
||||||
if (size < (2 + 1))
|
if (size < (2 + 1))
|
||||||
abort ();
|
{
|
||||||
|
warn (_("Internal error: not enough buffer room for section flag info"));
|
||||||
|
return _("<unknown>");
|
||||||
|
}
|
||||||
size -= 2;
|
size -= 2;
|
||||||
*p++ = ',';
|
*p++ = ',';
|
||||||
*p++ = ' ';
|
*p++ = ' ';
|
||||||
@ -9708,7 +9722,9 @@ get_symbol_visibility (unsigned int visibility)
|
|||||||
case STV_INTERNAL: return "INTERNAL";
|
case STV_INTERNAL: return "INTERNAL";
|
||||||
case STV_HIDDEN: return "HIDDEN";
|
case STV_HIDDEN: return "HIDDEN";
|
||||||
case STV_PROTECTED: return "PROTECTED";
|
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");
|
strcat (res, " RSV");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort ();
|
warn (_("Unrecognized IA64 VMS ST Function type: %d\n"),
|
||||||
|
VMS_ST_FUNC_TYPE (other));
|
||||||
|
strcat (res, " <unknown>");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -9784,7 +9803,10 @@ get_ia64_symbol_other (unsigned int other)
|
|||||||
strcat (res, " LNK");
|
strcat (res, " LNK");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort ();
|
warn (_("Unrecognized IA64 VMS ST Linkage: %d\n"),
|
||||||
|
VMS_ST_LINKAGE (other));
|
||||||
|
strcat (res, " <unknown>");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res[0] != 0)
|
if (res[0] != 0)
|
||||||
@ -10981,9 +11003,16 @@ is_32bit_abs_reloc (unsigned int reloc_type)
|
|||||||
case EM_XTENSA:
|
case EM_XTENSA:
|
||||||
return reloc_type == 1; /* R_XTENSA_32. */
|
return reloc_type == 1; /* R_XTENSA_32. */
|
||||||
default:
|
default:
|
||||||
error (_("Missing knowledge of 32-bit reloc types used in DWARF sections of machine number %d\n"),
|
{
|
||||||
elf_header.e_machine);
|
static unsigned int prev_warn = 0;
|
||||||
abort ();
|
|
||||||
|
/* 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;
|
reloc_size = 2;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
warn (_("unable to apply unsupported reloc type %d to section %s\n"),
|
static unsigned int prev_reloc = 0;
|
||||||
reloc_type, printable_section_name (section));
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12250,7 +12282,8 @@ display_arm_attribute (unsigned char * p,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
abort ();
|
printf (_("<unknown: %d>\n"), tag);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user