From ab5e779453ef98198abfc1f0b6ae1033601548ea Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Sat, 29 May 1999 10:51:14 +0000 Subject: [PATCH] Display unknown values detected in ELF program header. --- binutils/ChangeLog | 7 +++++++ binutils/readelf.c | 21 +++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index b2f5e3c1db..58f9416977 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +1999-05-29 Nick Clifton + + * readelf.c (get_elf_class): Display unknown class number. + (get_data_encoding): Display unknown encoding number. + (get_osabi_name): Display unknown ABI number. + (process_file_header): Display unknown version number. + 1999-05-29 Nick Clifton * readelf.c (dump_relocations): Fix typo. diff --git a/binutils/readelf.c b/binutils/readelf.c index 394bf79f1b..6419e6a1d1 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -1353,12 +1353,16 @@ static const char * get_elf_class (elf_class) unsigned char elf_class; { + static char buff [32]; + switch (elf_class) { case ELFCLASSNONE: return _("none"); case ELFCLASS32: return _("ELF32"); case ELFCLASS64: return _("ELF64"); - default: return _(""); + default: + sprintf (buff, _(""), elf_class); + return buff; } } @@ -1366,12 +1370,16 @@ static const char * get_data_encoding (encoding) unsigned char encoding; { + static char buff [32]; + switch (encoding) { case ELFDATANONE: return _("none"); case ELFDATA2LSB: return _("2's complement, little endian"); case ELFDATA2MSB: return _("2's complement, big endian"); - default: return _(""); + default: + sprintf (buff, _(""), encoding); + return buff; } } @@ -1379,12 +1387,16 @@ static const char * get_osabi_name (osabi) unsigned char osabi; { + static char buff [32]; + switch (osabi) { case ELFOSABI_SYSV: return _("UNIX - System V"); case ELFOSABI_HPUX: return _("UNIX - HP-UX"); case ELFOSABI_STANDALONE: return _("Standalone App"); - default: return _(""); + default: + sprintf (buff, _(""), osabi); + return buff; } } @@ -1418,7 +1430,8 @@ process_file_header () printf (_(" Version: %d %s\n"), elf_header.e_ident [EI_VERSION], elf_header.e_ident [EI_VERSION] == EV_CURRENT ? "(current)" : - elf_header.e_ident [EI_VERSION] != EV_NONE ? "" : ""); + elf_header.e_ident [EI_VERSION] != EV_NONE ? "" : "", + elf_header.e_ident [EI_VERSION]); printf (_(" OS/ABI: %s\n"), get_osabi_name (elf_header.e_ident [EI_OSABI])); printf (_(" ABI Version: %d\n"),