Import config.guess and config.sub.
[deliverable/binutils-gdb.git] / binutils / readelf.c
index 9c15d9f25ccf8c8f95455674e6b37c89043c5c80..ea0aa023701ef018ccf1d3e992207a7eea5bb8a2 100644 (file)
 #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"
@@ -652,6 +654,8 @@ guess_is_rela (e_machine)
     case EM_MMIX:
     case EM_XSTORMY16:
     case EM_VAX:
+    case EM_IP2K:
+    case EM_IP2K_OLD:
       return TRUE;
 
     case EM_MMA:
@@ -1115,6 +1119,10 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
          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);
@@ -1127,6 +1135,11 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
        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)
@@ -1569,6 +1582,8 @@ get_machine_name (e_machine)
     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;
@@ -2241,6 +2256,8 @@ get_section_type_name (sh_type)
     }
 }
 
+#define OPTION_DEBUG_DUMP      512
+
 struct option options [] =
 {
   {"all",              no_argument, 0, 'a'},
@@ -2260,7 +2277,7 @@ struct option options [] =
   {"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'},
@@ -2295,7 +2312,8 @@ usage ()
   -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, _("\
@@ -2493,6 +2511,88 @@ parse_args (argc, argv)
                  }
            }
          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 ++;
@@ -3750,13 +3850,13 @@ dump_ia64_unwind (aux)
       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" : "",
@@ -4199,6 +4299,7 @@ dynamic_segment_parisc_val (entry)
       print_vma (entry->d_un.d_ptr, PREFIX_HEX);
       break;
     }
+  putchar ('\n');
 }
 
 static int
@@ -4549,11 +4650,13 @@ process_dynamic_segment (file)
          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");
@@ -4575,11 +4678,13 @@ process_dynamic_segment (file)
          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");
@@ -4606,6 +4711,7 @@ process_dynamic_segment (file)
              else
                {
                  unsigned long int val = entry->d_un.d_val;
+
                  if (val & DF_1_NOW)
                    {
                      printf (" NOW");
@@ -4811,6 +4917,8 @@ process_dynamic_segment (file)
 
        case DT_BIND_NOW:
          /* The value of this entry is ignored.  */
+         if (do_dynamic)
+           putchar ('\n');
          break;
 
        case DT_GNU_PRELINKED:
This page took 0.028834 seconds and 4 git commands to generate.