* gdb.texinfo (SVR4 Process Information): Document subcommands of
[deliverable/binutils-gdb.git] / binutils / readelf.c
index eb9b451181ecdf20f776d4667d5e21a69010f9c3..a65c82ea3ed276db38bb655b4b8b0ec3bafa6959 100644 (file)
@@ -1,5 +1,6 @@
 /* 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>
@@ -23,7 +24,7 @@
 \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
@@ -1766,6 +1767,10 @@ decode_ARM_machine_flags (unsigned e_flags, char buf[])
 
     case EF_ARM_EABI_VER3:
       strcat (buf, ", Version3 EABI");
+      break;
+
+    case EF_ARM_EABI_VER4:
+      strcat (buf, ", Version4 EABI");
       while (e_flags)
        {
          unsigned flag;
@@ -1872,6 +1877,47 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
          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");
@@ -2362,6 +2408,31 @@ get_ia64_section_type_name (unsigned int sh_type)
   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)
 {
@@ -2412,6 +2483,12 @@ 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;
@@ -3261,7 +3338,12 @@ process_program_headers (FILE *file)
                         <= 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));
            }
 
@@ -3952,6 +4034,8 @@ process_section_groups (FILE *file)
              group->root = g;
            }
 
+         if (symtab)
+           free (symtab);
          if (strtab)
            free (strtab);
          if (start)
@@ -7630,14 +7714,14 @@ decode_location_expression (unsigned char * data,
          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:
@@ -7645,7 +7729,7 @@ decode_location_expression (unsigned char * data,
          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:
@@ -7735,7 +7819,7 @@ decode_location_expression (unsigned char * data,
          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:
@@ -7757,7 +7841,7 @@ decode_location_expression (unsigned char * data,
          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;
 
This page took 0.027384 seconds and 4 git commands to generate.