/* readelf.c -- display contents of an ELF format file
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 99, 2000 Free Software Foundation, Inc.
Originally developed by Eric Youngdale <eric@andante.jic.com>
Modifications by Nick Clifton <nickc@cygnus.com>
case DT_FINI_ARRAYSZ: return "FINI_ARRAYSZ";
case DT_RUNPATH: return "RUNPATH";
case DT_FLAGS: return "FLAGS";
- case DT_ENCODING: return "ENCODING";
+
case DT_PREINIT_ARRAY: return "PREINIT_ARRAY";
case DT_PREINIT_ARRAYSZ: return "PREINIT_ARRAYSZ";
case EM_486: return "Intel 80486";
case EM_860: return "Intel 80860";
case EM_MIPS: return "MIPS R3000";
- case EM_S370: return "Amdahl";
+ case EM_S370: return "IBM System/370";
case EM_MIPS_RS4_BE: return "MIPS R4000 big-endian";
case EM_OLD_SPARCV9: return "Sparc v9 (old)";
case EM_PARISC: return "HPPA";
case ELFOSABI_SYSV: return _("UNIX - System V");
case ELFOSABI_HPUX: return _("UNIX - HP-UX");
case ELFOSABI_STANDALONE: return _("Standalone App");
+ case ELFOSABI_ARM: return _("ARM");
default:
sprintf (buff, _("<unknown: %x>"), osabi);
return buff;
case DF_SYMBOLIC: strcat (buff, "SYMBOLIC "); break;
case DF_TEXTREL: strcat (buff, "TEXTREL "); break;
case DF_BIND_NOW: strcat (buff, "BIND_NOW "); break;
- default: strcat (buff, "unknown "); return;
+ default: strcat (buff, "unknown "); break;
}
}
+ return buff;
}
/* Parse and display the contents of the dynamic segment. */
{
case DT_FLAGS:
if (do_dynamic)
- printf (get_dynamic_flags (entry->d_un.d_val));
+ printf ("%s", get_dynamic_flags (entry->d_un.d_val));
break;
case DT_AUXILIARY:
for (cnt = 0; cnt < total; cnt += 4)
{
int j, nn;
+ char *name;
printf (" %03x:", cnt);
{
ivna.vna_name = BYTE_GET (evna.vna_name);
+ name = strtab + ivna.vna_name;
nn += printf ("(%s%-*s",
- strtab + ivna.vna_name,
- 12 - strlen (strtab
- + ivna.vna_name),
+ name,
+ 12 - (int) strlen (name),
")");
break;
}
ivda.vda_name =
BYTE_GET (evda.vda_name);
+ name = strtab + ivda.vda_name;
nn +=
printf ("(%s%-*s",
- strtab + ivda.vda_name,
- 12
- - strlen (strtab
- + ivda.vda_name),
+ name,
+ 12 - (int) strlen (name),
")");
}
}
{
ivna.vna_name = BYTE_GET (evna.vna_name);
+ name = strtab + ivna.vna_name;
nn += printf ("(%s%-*s",
- strtab + ivna.vna_name,
- 12 - strlen (strtab
- + ivna.vna_name),
+ name,
+ 12 - (int) strlen (name),
")");
break;
}
ivda.vda_name = BYTE_GET (evda.vda_name);
+ name = strtab + ivda.vda_name;
nn += printf ("(%s%-*s",
- strtab + ivda.vda_name,
- 12 - strlen (strtab
- + ivda.vda_name),
+ name,
+ 12 - (int) strlen (name),
")");
}
}
printf (_("\nSymbol table for image:\n"));
if (is_32bit_elf)
- printf (_(" Num Buc: Value Size Type Bind Vis Ot Ndx Name\n"));
+ printf (_(" Num Buc: Value Size Type Bind Vis Ndx Name\n"));
else
- printf (_(" Num Buc: Value Size Type Bind Vis Ot Ndx Name\n"));
+ printf (_(" Num Buc: Value Size Type Bind Vis Ndx Name\n"));
for (hn = 0; hn < nbuckets; hn++)
{
printf (" %6s", get_symbol_type (ELF_ST_TYPE (psym->st_info)));
printf (" %6s", get_symbol_binding (ELF_ST_BIND (psym->st_info)));
printf (" %3s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other)));
- printf (" %2d", ELF_ST_OTHER (psym->st_other));
printf (" %3.3s", get_symbol_index_type (psym->st_shndx));
printf (" %s\n", dynamic_strings + psym->st_name);
}
SECTION_NAME (section),
(unsigned long) (section->sh_size / section->sh_entsize));
if (is_32bit_elf)
- printf (_(" Num: Value Size Type Bind Vis Ot Ndx Name\n"));
+ printf (_(" Num: Value Size Type Bind Vis Ndx Name\n"));
else
- printf (_(" Num: Value Size Type Bind Vis Ot Ndx Name\n"));
+ printf (_(" Num: Value Size Type Bind Vis Ndx Name\n"));
symtab = GET_ELF_SYMBOLS (file, section->sh_offset,
section->sh_size / section->sh_entsize);
printf (" %-7s", get_symbol_type (ELF_ST_TYPE (psym->st_info)));
printf (" %-6s", get_symbol_binding (ELF_ST_BIND (psym->st_info)));
printf (" %-3s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other)));
- printf (" %2d", ELF_ST_OTHER (psym->st_other));
printf (" %4s", get_symbol_index_type (psym->st_shndx));
printf (" %s", strtab + psym->st_name);
case DW_FORM_ref_addr:
case DW_FORM_addr:
uvalue = byte_get (data, pointer_size);
- printf (is_ref ? " <%x>" : " %#x", uvalue);
+ printf (is_ref ? " <%lx>" : " %#lx", uvalue);
data += pointer_size;
break;
case DW_FORM_flag:
case DW_FORM_data1:
uvalue = byte_get (data ++, 1);
- printf (is_ref ? " <%x>" : " %d", uvalue);
+ printf (is_ref ? " <%lx>" : " %ld", uvalue);
break;
case DW_FORM_ref2:
case DW_FORM_data2:
uvalue = byte_get (data, 2);
data += 2;
- printf (is_ref ? " <%x>" : " %d", uvalue);
+ printf (is_ref ? " <%lx>" : " %ld", uvalue);
break;
case DW_FORM_ref4:
case DW_FORM_data4:
uvalue = byte_get (data, 4);
data += 4;
- printf (is_ref ? " <%x>" : " %d", uvalue);
+ printf (is_ref ? " <%lx>" : " %ld", uvalue);
break;
case DW_FORM_ref8:
GET_DATA_ALLOC (liblist_offset, liblistno * sizeof (Elf32_External_Lib),
elib, Elf32_External_Lib *, "liblist");
- printf ("\nSection '.liblist' contains %d entries:\n", liblistno);
+ printf ("\nSection '.liblist' contains %lu entries:\n",
+ (unsigned long) liblistno);
fputs (" Library Time Stamp Checksum Version Flags\n",
stdout);
strftime (timebuf, 20, "%Y-%m-%dT%H:%M:%S", gmtime (&time));
- printf ("%3d: %-20s %s %#10lx %-7ld", cnt,
+ printf ("%3lu: %-20s %s %#10lx %-7ld", (unsigned long) cnt,
dynamic_strings + liblist.l_name, timebuf,
liblist.l_checksum, liblist.l_version);
{
Elf_Internal_Sym * psym = &dynamic_symbols[iconf[cnt]];
- printf ("%5u: %8lu ", cnt, iconf[cnt]);
+ printf ("%5lu: %8lu ", (unsigned long) cnt, iconf[cnt]);
print_vma (psym->st_value, FULL_HEX);
printf (" %s\n", dynamic_strings + psym->st_name);
}
external = pnotes;
- printf (_("\nNotes at offset 0x%08lx with length 0x%08lx:\n"), offset, length);
+ printf (_("\nNotes at offset 0x%08lx with length 0x%08lx:\n"),
+ (unsigned long) offset,
+ (unsigned long) length);
printf (_(" Owner\t\tData size\tDescription\n"));
while (external < (Elf_External_Note *)((char *) pnotes + length))