Fix several versioning related bugs. Produce nicer output.

This commit is contained in:
Ulrich Drepper
1998-07-19 22:18:24 +00:00
parent 4d14b2522a
commit 19808d3f79
2 changed files with 352 additions and 322 deletions

View File

@ -1,3 +1,13 @@
1998-07-19 15:15 Ulrich Drepper <drepper@cygnus.com>
* readelf.c: Fix several versioning related bugs. Produce nicer
output.
Fri Jul 10 15:57:58 1998 Nick Clifton <nickc@cygnus.com>
* readelf.c: Switch prototypes from unsigned short to unsigned
int.
Fri Jul 10 16:17:50 1998 Ian Lance Taylor <ian@cygnus.com>
From Christian Holland <CHolland@de.lucent.com>:

View File

@ -112,8 +112,8 @@ static int process_section_contents PARAMS ((FILE *));
static void process_file PARAMS ((char * file_name));
static int process_relocs PARAMS ((FILE *));
static int process_version_sections PARAMS ((FILE *));
static char * get_ver_flags PARAMS ((unsigned short flags));
static char * get_symbol_index_type PARAMS ((unsigned short type));
static char * get_ver_flags PARAMS ((unsigned int flags));
static char * get_symbol_index_type PARAMS ((unsigned int type));
static int get_section_headers PARAMS ((FILE * file));
static int get_file_header PARAMS ((FILE * file));
static Elf_Internal_Sym * get_elf_symbols
@ -1896,7 +1896,7 @@ process_dynamic_segment (file)
}
if (do_dynamic && dynamic_addr)
printf (_("\nDynamic segement at offset 0x%x contains %d entries:\n"),
printf (_("\nDynamic segment at offset 0x%x contains %d entries:\n"),
dynamic_addr, dynamic_size);
if (do_dynamic)
printf (_(" Tag Type Name/Value\n"));
@ -1906,9 +1906,11 @@ process_dynamic_segment (file)
i++, entry ++)
{
if (do_dynamic)
printf (_(" 0x%-6.6lx (%-11.11s) "),
printf (_(" 0x%-8.8lx (%s)%*s"),
(unsigned long) entry->d_tag,
get_dynamic_type (entry->d_tag));
get_dynamic_type (entry->d_tag),
12 - strlen (get_dynamic_type (entry->d_tag)),
" ");
switch (entry->d_tag)
{
@ -2013,7 +2015,7 @@ process_dynamic_segment (file)
static char *
get_ver_flags (flags)
unsigned short flags;
unsigned int flags;
{
static char buff [32];
@ -2280,11 +2282,11 @@ process_version_sections (file)
switch (data [cnt + j])
{
case 0:
printf (" 0 (*local*) ");
fputs (_(" 0 (*local*) "), stdout);
break;
case 1:
printf (" 1 (*global*) ");
fputs (_(" 1 (*global*) "), stdout);
break;
default:
@ -2333,8 +2335,11 @@ process_version_sections (file)
{
ivna.vna_name = BYTE_GET (evna.vna_name);
nn += printf ("(%11.11s)",
strtab + ivna.vna_name);
nn += printf ("(%s%-*s",
strtab + ivna.vna_name,
12 - strlen (strtab
+ ivna.vna_name),
")");
break;
}
else if (ivn.vn_next == 0)
@ -2377,8 +2382,12 @@ process_version_sections (file)
BYTE_GET (evda.vda_name);
nn +=
printf ("(%11.11s)",
strtab + ivda.vda_name);
printf ("(%s%-*s",
strtab + ivda.vda_name,
12
- strlen (strtab
+ ivda.vda_name),
")");
}
}
@ -2428,8 +2437,11 @@ process_version_sections (file)
{
ivna.vna_name = BYTE_GET (evna.vna_name);
nn += printf ("(%11.11s)",
strtab + ivna.vna_name);
nn += printf ("(%s%-*s",
strtab + ivna.vna_name,
12 - strlen (strtab
+ ivna.vna_name),
")");
break;
}
@ -2470,8 +2482,11 @@ process_version_sections (file)
ivda.vda_name = BYTE_GET (evda.vda_name);
nn += printf ("(%11.11s)",
strtab + ivda.vda_name);
nn += printf ("(%s%-*s",
strtab + ivda.vda_name,
12 - strlen (strtab
+ ivda.vda_name),
")");
}
}
@ -2543,7 +2558,7 @@ get_symbol_type (type)
static char *
get_symbol_index_type (type)
unsigned short type;
unsigned int type;
{
switch (type)
{
@ -2705,7 +2720,8 @@ process_symbol_table (file)
printf (_("\nSymbol table '%s' contains %d entries:\n"),
SECTION_NAME (section),
section->sh_size / section->sh_entsize);
printf (_(" Num: Value Size Type Bind Ot Ndx Name\n"));
fputs (_(" Num: Value Size Type Bind Ot Ndx Name\n"),
stdout);
symtab = get_elf_symbols (file, section->sh_offset,
section->sh_size / section->sh_entsize);
@ -2737,11 +2753,11 @@ process_symbol_table (file)
psym->st_other);
if (psym->st_shndx == 0)
printf ("UND");
fputs ("UND", stdout);
else if ((psym->st_shndx & 0xffff) == 0xfff1)
printf ("ABS");
fputs ("ABS", stdout);
else if ((psym->st_shndx & 0xffff) == 0xfff2)
printf ("COM");
fputs ("COM", stdout);
else
printf ("%3d", psym->st_shndx);
@ -2802,6 +2818,7 @@ process_symbol_table (file)
ivna.vna_other = BYTE_GET (evna.vna_other);
ivna.vna_next = BYTE_GET (evna.vna_next);
ivna.vna_name = BYTE_GET (evna.vna_name);
vna_off += ivna.vna_next;
}
@ -2816,8 +2833,11 @@ process_symbol_table (file)
while (ivn.vn_next != 0);
if (ivna.vna_other == vers_data)
{
printf ("@%s (%d)",
strtab + ivna.vna_name, ivna.vna_other);
check_def = 0;
}
else if (! is_nobits)
error (_("bad dynamic symbol"));
else