/* readelf.c -- display contents of an ELF format file
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Originally developed by Eric Youngdale <eric@andante.jic.com>
Modifications by Nick Clifton <nickc@redhat.com>
\f
/* The difference between readelf and objdump:
- Both programs are capabale of displaying the contents of ELF format files,
+ Both programs are capable of displaying the contents of ELF format files,
so why does the binutils project have two file dumpers ?
The reason is that objdump sees an ELF file through a BFD filter of the
case EF_ARM_EABI_VER3:
strcat (buf, ", Version3 EABI");
+ break;
+
+ case EF_ARM_EABI_VER4:
+ strcat (buf, ", Version4 EABI");
while (e_flags)
{
unsigned flag;
decode_ARM_machine_flags (e_flags, buf);
break;
+ case EM_CYGNUS_FRV:
+ switch (e_flags & EF_FRV_CPU_MASK)
+ {
+ case EF_FRV_CPU_GENERIC:
+ break;
+
+ default:
+ strcat (buf, ", fr???");
+ break;
+
+ case EF_FRV_CPU_FR300:
+ strcat (buf, ", fr300");
+ break;
+
+ case EF_FRV_CPU_FR400:
+ strcat (buf, ", fr400");
+ break;
+ case EF_FRV_CPU_FR405:
+ strcat (buf, ", fr405");
+ break;
+
+ case EF_FRV_CPU_FR450:
+ strcat (buf, ", fr450");
+ break;
+
+ case EF_FRV_CPU_FR500:
+ strcat (buf, ", fr500");
+ break;
+ case EF_FRV_CPU_FR550:
+ strcat (buf, ", fr550");
+ break;
+
+ case EF_FRV_CPU_SIMPLE:
+ strcat (buf, ", simple");
+ break;
+ case EF_FRV_CPU_TOMCAT:
+ strcat (buf, ", tomcat");
+ break;
+ }
+ break;
+
case EM_68K:
if (e_flags & EF_CPU32)
strcat (buf, ", cpu32");
return NULL;
}
+static const char *
+get_x86_64_section_type_name (unsigned int sh_type)
+{
+ switch (sh_type)
+ {
+ case SHT_X86_64_UNWIND: return "X86_64_UNWIND";
+ default:
+ break;
+ }
+ return NULL;
+}
+
+static const char *
+get_arm_section_type_name (unsigned int sh_type)
+{
+ switch (sh_type)
+ {
+ case SHT_ARM_EXIDX:
+ return "ARM_EXIDX";
+ default:
+ break;
+ }
+ return NULL;
+}
+
static const char *
get_section_type_name (unsigned int sh_type)
{
case EM_IA_64:
result = get_ia64_section_type_name (sh_type);
break;
+ case EM_X86_64:
+ result = get_x86_64_section_type_name (sh_type);
+ break;
+ case EM_ARM:
+ result = get_arm_section_type_name (sh_type);
+ break;
default:
result = NULL;
break;
<= segment->p_vaddr + segment->p_memsz)
: ((bfd_vma) section->sh_offset >= segment->p_offset
&& (section->sh_offset + section->sh_size
- <= segment->p_offset + segment->p_filesz))))
+ <= segment->p_offset + segment->p_filesz)))
+ /* .tbss is special. It doesn't contribute memory space
+ to normal segments. */
+ && (!((section->sh_flags & SHF_TLS) != 0
+ && section->sh_type == SHT_NOBITS)
+ || segment->p_type == PT_TLS))
printf ("%s ", SECTION_NAME (section));
}
group->root = g;
}
+ if (symtab)
+ free (symtab);
if (strtab)
free (strtab);
if (start)
printf ("DW_OP_const1u: %lu", (unsigned long) byte_get (data++, 1));
break;
case DW_OP_const1s:
- printf ("DW_OP_const1s: %ld", (long) byte_get (data++, 1));
+ printf ("DW_OP_const1s: %ld", (long) byte_get_signed (data++, 1));
break;
case DW_OP_const2u:
printf ("DW_OP_const2u: %lu", (unsigned long) byte_get (data, 2));
data += 2;
break;
case DW_OP_const2s:
- printf ("DW_OP_const2s: %ld", (long) byte_get (data, 2));
+ printf ("DW_OP_const2s: %ld", (long) byte_get_signed (data, 2));
data += 2;
break;
case DW_OP_const4u:
data += 4;
break;
case DW_OP_const4s:
- printf ("DW_OP_const4s: %ld", (long) byte_get (data, 4));
+ printf ("DW_OP_const4s: %ld", (long) byte_get_signed (data, 4));
data += 4;
break;
case DW_OP_const8u:
printf ("DW_OP_xor");
break;
case DW_OP_bra:
- printf ("DW_OP_bra: %ld", (long) byte_get (data, 2));
+ printf ("DW_OP_bra: %ld", (long) byte_get_signed (data, 2));
data += 2;
break;
case DW_OP_eq:
printf ("DW_OP_ne");
break;
case DW_OP_skip:
- printf ("DW_OP_skip: %ld", (long) byte_get (data, 2));
+ printf ("DW_OP_skip: %ld", (long) byte_get_signed (data, 2));
data += 2;
break;