#include "elf/d30v.h"
#include "elf/dlx.h"
#include "elf/fr30.h"
+#include "elf/frv.h"
#include "elf/h8.h"
#include "elf/hppa.h"
#include "elf/i386.h"
+#include "elf/i370.h"
#include "elf/i860.h"
#include "elf/i960.h"
#include "elf/ia64.h"
+#include "elf/ip2k.h"
#include "elf/m32r.h"
#include "elf/m68k.h"
+#include "elf/m68hc11.h"
#include "elf/mcore.h"
#include "elf/mips.h"
#include "elf/mmix.h"
#include "elf/sh.h"
#include "elf/sparc.h"
#include "elf/v850.h"
+#include "elf/vax.h"
#include "elf/x86-64.h"
#include "elf/xstormy16.h"
static int process_corefile_note_segments PARAMS ((FILE *));
static int process_corefile_contents PARAMS ((FILE *));
static int process_arch_specific PARAMS ((FILE *));
+static int process_gnu_liblist PARAMS ((FILE *));
typedef int Elf32_Word;
/* Display a symbol on stdout. If do_wide is not true then
format the symbol to be at most WIDTH characters,
- truhncating as necessary. If WIDTH is negative then
+ truncating as necessary. If WIDTH is negative then
format the string to be exactly - WIDTH characters,
truncating or padding as necessary. */
case EM_CYGNUS_MN10300:
case EM_FR30:
case EM_CYGNUS_FR30:
+ case EM_CYGNUS_FRV:
case EM_SH:
case EM_ALPHA:
case EM_MCORE:
case EM_S390_OLD:
case EM_MMIX:
case EM_XSTORMY16:
+ case EM_VAX:
+ case EM_IP2K:
+ case EM_IP2K_OLD:
return TRUE;
case EM_MMA:
case EM_68HC05:
case EM_SVX:
case EM_ST19:
- case EM_VAX:
default:
warn (_("Don't know about relocations on this machine architecture\n"));
return FALSE;
rtype = elf_i386_reloc_type (type);
break;
+ case EM_68HC11:
+ case EM_68HC12:
+ rtype = elf_m68hc11_reloc_type (type);
+ break;
+
case EM_68K:
rtype = elf_m68k_reloc_type (type);
break;
rtype = elf_fr30_reloc_type (type);
break;
+ case EM_CYGNUS_FRV:
+ rtype = elf_frv_reloc_type (type);
+ break;
+
case EM_MCORE:
rtype = elf_mcore_reloc_type (type);
break;
rtype = elf_x86_64_reloc_type (type);
break;
+ case EM_S370:
+ rtype = i370_reloc_type (type);
+ break;
+
case EM_S390_OLD:
case EM_S390:
rtype = elf_s390_reloc_type (type);
case EM_XSTORMY16:
rtype = elf_xstormy16_reloc_type (type);
break;
+
+ case EM_VAX:
+ rtype = elf_vax_reloc_type (type);
+ break;
+
+ case EM_IP2K:
+ case EM_IP2K_OLD:
+ rtype = elf_ip2k_reloc_type (type);
+ break;
}
if (rtype == NULL)
case DT_USED: return "USED";
case DT_FILTER: return "FILTER";
+ case DT_GNU_PRELINKED: return "GNU_PRELINKED";
+ case DT_GNU_CONFLICT: return "GNU_CONFLICT";
+ case DT_GNU_CONFLICTSZ: return "GNU_CONFLICTSZ";
+ case DT_GNU_LIBLIST: return "GNU_LIBLIST";
+ case DT_GNU_LIBLISTSZ: return "GNU_LIBLISTSZ";
+
default:
if ((type >= DT_LOPROC) && (type <= DT_HIPROC))
{
case EM_MN10200: return "mn10200";
case EM_CYGNUS_FR30:
case EM_FR30: return "Fujitsu FR30";
+ case EM_CYGNUS_FRV: return "Fujitsu FR-V";
case EM_PJ_OLD:
case EM_PJ: return "picoJava";
case EM_MMA: return "Fujitsu Multimedia Accelerator";
case EM_OPENRISC:
case EM_OR32: return "OpenRISC";
case EM_DLX: return "OpenDLX";
+ case EM_IP2K_OLD:
+ case EM_IP2K: return "Ubicom IP2xxx 8-bit microcontrollers";
default:
sprintf (buff, _("<unknown>: %x"), e_machine);
return buff;
case E_V850E_ARCH:
strcat (buf, ", v850e");
break;
- case E_V850EA_ARCH:
- strcat (buf, ", v850ea");
- break;
case E_V850_ARCH:
strcat (buf, ", v850");
break;
case E_MIPS_MACH_3900: strcat (buf, ", 3900"); break;
case E_MIPS_MACH_4010: strcat (buf, ", 4010"); break;
case E_MIPS_MACH_4100: strcat (buf, ", 4100"); break;
- case E_MIPS_MACH_4650: strcat (buf, ", 4650"); break;
case E_MIPS_MACH_4111: strcat (buf, ", 4111"); break;
+ case E_MIPS_MACH_4120: strcat (buf, ", 4120"); break;
+ case E_MIPS_MACH_4650: strcat (buf, ", 4650"); break;
+ case E_MIPS_MACH_5400: strcat (buf, ", 5400"); break;
+ case E_MIPS_MACH_5500: strcat (buf, ", 5500"); break;
case E_MIPS_MACH_SB1: strcat (buf, ", sb1"); break;
case 0:
/* We simply ignore the field in this case to avoid confusion:
if ((e_flags & EF_IA_64_ABSOLUTE))
strcat (buf, ", absolute");
break;
+
+ case EM_VAX:
+ if ((e_flags & EF_VAX_NONPIC))
+ strcat (buf, ", non-PIC");
+ if ((e_flags & EF_VAX_DFLOAT))
+ strcat (buf, ", D-Float");
+ if ((e_flags & EF_VAX_GFLOAT))
+ strcat (buf, ", G-Float");
+ break;
}
}
case 0x6ffffffc: return "VERDEF";
case 0x7ffffffd: return "AUXILIARY";
case 0x7fffffff: return "FILTER";
+ case SHT_GNU_LIBLIST: return "GNU_LIBLIST";
default:
if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC))
}
}
+#define OPTION_DEBUG_DUMP 512
+
struct option options [] =
{
{"all", no_argument, 0, 'a'},
{"version-info", no_argument, 0, 'V'},
{"use-dynamic", no_argument, 0, 'D'},
{"hex-dump", required_argument, 0, 'x'},
- {"debug-dump", optional_argument, 0, 'w'},
+ {"debug-dump", optional_argument, 0, OPTION_DEBUG_DUMP},
{"unwind", no_argument, 0, 'u'},
#ifdef SUPPORT_DISASSEMBLY
{"instruction-dump", required_argument, 0, 'i'},
-A --arch-specific Display architecture specific information (if any).\n\
-D --use-dynamic Use the dynamic section info when displaying symbols\n\
-x --hex-dump=<number> Dump the contents of section <number>\n\
- -w --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n\
+ -w[liaprmfFso] or\n\
+ --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n\
Display the contents of DWARF2 debug sections\n"));
#ifdef SUPPORT_DISASSEMBLY
fprintf (stdout, _("\
}
}
break;
+ case OPTION_DEBUG_DUMP:
+ do_dump ++;
+ if (optarg == 0)
+ do_debugging = 1;
+ else
+ {
+ static const char *debug_dump_opt[]
+ = { "line", "info", "abbrev", "pubnames", "ranges",
+ "macro", "frames", "frames-interp", "str", "loc", NULL };
+ unsigned int index;
+ const char *p;
+
+ do_debugging = 0;
+
+ p = optarg;
+ while (*p)
+ {
+ for (index = 0; debug_dump_opt[index]; index++)
+ {
+ size_t len = strlen (debug_dump_opt[index]);
+
+ if (strncmp (p, debug_dump_opt[index], len) == 0
+ && (p[len] == ',' || p[len] == '\0'))
+ {
+ switch (p[0])
+ {
+ case 'i':
+ do_debug_info = 1;
+ break;
+
+ case 'a':
+ do_debug_abbrevs = 1;
+ break;
+
+ case 'l':
+ if (p[1] == 'i')
+ do_debug_lines = 1;
+ else
+ do_debug_loc = 1;
+ break;
+
+ case 'p':
+ do_debug_pubnames = 1;
+ break;
+
+ case 'r':
+ do_debug_aranges = 1;
+ break;
+
+ case 'f':
+ if (len > 6)
+ do_debug_frames_interp = 1;
+ do_debug_frames = 1;
+ break;
+
+ case 'm':
+ do_debug_macinfo = 1;
+ break;
+
+ case 's':
+ do_debug_str = 1;
+ break;
+ }
+
+ p += len;
+ break;
+ }
+ }
+
+ if (debug_dump_opt[index] == NULL)
+ {
+ warn (_("Unrecognized debug option '%s'\n"), p);
+ p = strchr (p, ',');
+ if (p == NULL)
+ break;
+ }
+
+ if (*p == ',')
+ p++;
+ }
+ }
+ break;
#ifdef SUPPORT_DISASSEMBLY
case 'i':
do_dump ++;
print_vma (tp->start.offset, PREFIX_HEX);
fputc ('-', stdout);
print_vma (tp->end.offset, PREFIX_HEX);
- printf ("), info at +0x%lx\n",
+ printf ("], info at +0x%lx\n",
(unsigned long) (tp->info.offset - aux->seg_base));
head = aux->info + (tp->info.offset - aux->info_addr);
stamp = BYTE_GET8 ((unsigned char *) head);
- printf (" v%u, flags=0x%lx (%s%s ), len=%lu bytes\n",
+ printf (" v%u, flags=0x%lx (%s%s), len=%lu bytes\n",
(unsigned) UNW_VER (stamp),
(unsigned long) ((stamp & UNW_FLAG_MASK) >> 32),
UNW_FLAG_EHANDLER (stamp) ? " ehandler" : "",
print_vma (entry->d_un.d_ptr, PREFIX_HEX);
break;
}
+ putchar ('\n');
}
static int
if (do_dynamic)
{
printf (_("Flags:"));
+
if (entry->d_un.d_val == 0)
printf (_(" None\n"));
else
{
unsigned long int val = entry->d_un.d_val;
+
if (val & DTF_1_PARINIT)
{
printf (" PARINIT");
if (do_dynamic)
{
printf (_("Flags:"));
+
if (entry->d_un.d_val == 0)
printf (_(" None\n"));
else
{
unsigned long int val = entry->d_un.d_val;
+
if (val & DF_P1_LAZYLOAD)
{
printf (" LAZYLOAD");
else
{
unsigned long int val = entry->d_un.d_val;
+
if (val & DF_1_NOW)
{
printf (" NOW");
case DT_MOVESZ :
case DT_INIT_ARRAYSZ:
case DT_FINI_ARRAYSZ:
+ case DT_GNU_CONFLICTSZ:
+ case DT_GNU_LIBLISTSZ:
if (do_dynamic)
{
print_vma (entry->d_un.d_val, UNSIGNED);
case DT_BIND_NOW:
/* The value of this entry is ignored. */
+ if (do_dynamic)
+ putchar ('\n');
+ break;
+
+ case DT_GNU_PRELINKED:
+ if (do_dynamic)
+ {
+ struct tm * tmp;
+ time_t time = entry->d_un.d_val;
+
+ tmp = gmtime (&time);
+ printf ("%04u-%02u-%02uT%02u:%02u:%02u\n",
+ tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
+ tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+ }
break;
default:
printf ("DW_OP_nop");
break;
- /* DWARF 2.1 extensions. */
+ /* DWARF 3 extensions. */
case DW_OP_push_object_address:
printf ("DW_OP_push_object_address");
break;
printf ("DW_OP_call4: <%lx>", (long) byte_get (data, 4));
data += 4;
break;
- case DW_OP_calli:
- printf ("DW_OP_calli");
+ case DW_OP_call_ref:
+ printf ("DW_OP_call_ref");
+ break;
+
+ /* GNU extensions. */
+ case DW_OP_GNU_push_tls_address:
+ printf ("DW_OP_GNU_push_tls_address");
break;
default:
addr = section->sh_addr;
bytes = section->sh_size;
section_end = start + bytes;
+
if (bytes == 0)
{
printf (_("\nThe .debug_loc section is empty.\n"));
return 0;
}
+
printf (_("Contents of the .debug_loc section:\n\n"));
printf (_("\n Offset Begin End Expression\n"));
+
while (start < section_end)
{
unsigned long begin;
return debug_str_contents + offset;
}
-
static int
display_debug_str (section, start, file)
Elf32_Internal_Shdr * section;
return 1;
}
-
static unsigned char *
read_and_display_attr_value (attribute, form, data, cu_offset, pointer_size)
unsigned long attribute;
break;
}
- /* Check for RELA relocations in the abbrev_offset address, and
- apply them. */
+ /* Check for RELA relocations in the
+ abbrev_offset address, and apply them. */
for (relsec = section_headers;
relsec < section_headers + elf_header.e_shnum;
++relsec)
Elf_Internal_Sym *sym;
if (relsec->sh_type != SHT_RELA
- || SECTION_HEADER (relsec->sh_info) != section)
+ || SECTION_HEADER (relsec->sh_info) != section
+ || relsec->sh_size == 0)
continue;
if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size,
{
sym = symtab + ELF32_R_SYM (rp->r_info);
- if (ELF32_ST_TYPE (sym->st_info) != STT_SECTION)
+ if (ELF32_R_SYM (rp->r_info) != 0
+ && ELF32_ST_TYPE (sym->st_info) != STT_SECTION)
{
warn (_("Skipping unexpected symbol type %u\n"),
ELF32_ST_TYPE (sym->st_info));
{
sym = symtab + ELF64_R_SYM (rp->r_info);
- if (ELF64_ST_TYPE (sym->st_info) != STT_SECTION)
+ if (ELF64_R_SYM (rp->r_info) != 0
+ && ELF64_ST_TYPE (sym->st_info) != STT_SECTION)
{
warn (_("Skipping unexpected symbol type %u\n"),
ELF64_ST_TYPE (sym->st_info));
}
}
- compunit.cu_abbrev_offset += rp->r_addend;
+ compunit.cu_abbrev_offset = rp->r_addend;
break;
}
free_abbrevs ();
/* Read in the abbrevs used by this compilation unit. */
-
{
Elf32_Internal_Shdr * sec;
unsigned char * begin;
return 1;
}
+static int
+process_gnu_liblist (file)
+ FILE * file;
+{
+ Elf_Internal_Shdr * section, * string_sec;
+ Elf32_External_Lib * elib;
+ char * strtab;
+ size_t cnt;
+ unsigned i;
+
+ if (! do_arch)
+ return 0;
+
+ for (i = 0, section = section_headers;
+ i < elf_header.e_shnum;
+ i++, section ++)
+ {
+ switch (section->sh_type)
+ {
+ case SHT_GNU_LIBLIST:
+ elib = ((Elf32_External_Lib *)
+ get_data (NULL, file, section->sh_offset, section->sh_size,
+ _("liblist")));
+
+ if (elib == NULL)
+ break;
+ string_sec = SECTION_HEADER (section->sh_link);
+
+ strtab = (char *) get_data (NULL, file, string_sec->sh_offset,
+ string_sec->sh_size,
+ _("liblist string table"));
+
+ if (strtab == NULL
+ || section->sh_entsize != sizeof (Elf32_External_Lib))
+ {
+ free (elib);
+ break;
+ }
+
+ printf (_("\nLibrary list section '%s' contains %lu entries:\n"),
+ SECTION_NAME (section),
+ (long) (section->sh_size / sizeof (Elf32_External_Lib)));
+
+ puts (" Library Time Stamp Checksum Version Flags");
+
+ for (cnt = 0; cnt < section->sh_size / sizeof (Elf32_External_Lib);
+ ++cnt)
+ {
+ Elf32_Lib liblist;
+ time_t time;
+ char timebuf[20];
+ struct tm * tmp;
+
+ liblist.l_name = BYTE_GET (elib[cnt].l_name);
+ time = BYTE_GET (elib[cnt].l_time_stamp);
+ liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum);
+ liblist.l_version = BYTE_GET (elib[cnt].l_version);
+ liblist.l_flags = BYTE_GET (elib[cnt].l_flags);
+
+ tmp = gmtime (&time);
+ sprintf (timebuf, "%04u-%02u-%02uT%02u:%02u:%02u",
+ tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
+ tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+ printf ("%3lu: ", (unsigned long) cnt);
+ if (do_wide)
+ printf ("%-20s", strtab + liblist.l_name);
+ else
+ printf ("%-20.20s", strtab + liblist.l_name);
+ printf (" %s %#010lx %-7ld %-7ld\n", timebuf, liblist.l_checksum,
+ liblist.l_version, liblist.l_flags);
+ }
+
+ free (elib);
+ }
+ }
+
+ return 1;
+}
+
static const char *
get_note_type (e_type)
unsigned e_type;
process_corefile_contents (file);
+ process_gnu_liblist (file);
+
process_arch_specific (file);
fclose (file);