bfd
[deliverable/binutils-gdb.git] / binutils / readelf.c
index 30bcf6672b0fa8075503da2e5e3a123980fc7340..15f4ac04c8b511197dc8ca3052d899a0d0c16162 100644 (file)
 #include "elf/m68hc11.h"
 #include "elf/mcore.h"
 #include "elf/mep.h"
+#include "elf/microblaze.h"
 #include "elf/mips.h"
 #include "elf/mmix.h"
 #include "elf/mn10200.h"
 #include "elf/pj.h"
 #include "elf/ppc.h"
 #include "elf/ppc64.h"
+#include "elf/rx.h"
 #include "elf/s390.h"
 #include "elf/score.h"
 #include "elf/sh.h"
 #include "filenames.h"
 
 char * program_name = "readelf";
-int do_wide;
 static long archive_file_offset;
 static unsigned long archive_file_size;
 static unsigned long dynamic_addr;
@@ -214,6 +215,7 @@ static struct group ** section_headers_groups;
 #define DISASS_DUMP    (1 << 1)        /* The -i command line switch.  */
 #define DEBUG_DUMP     (1 << 2)        /* The -w command line switch.  */
 #define STRING_DUMP     (1 << 3)       /* The -p command line switch.  */
+#define RELOC_DUMP      (1 << 4)       /* The -R command line switch.  */
 
 typedef unsigned char dump_type;
 
@@ -340,6 +342,8 @@ byte_put_little_endian (unsigned char * field, bfd_vma value, int size)
       /* Fall through.  */
     case 4:
       field[3] = (value >> 24) & 0xff;
+      /* Fall through.  */
+    case 3:
       field[2] = (value >> 16) & 0xff;
       /* Fall through.  */
     case 2:
@@ -503,8 +507,11 @@ byte_put_big_endian (unsigned char * field, bfd_vma value, int size)
       /* Fall through.  */
     case 4:
       field[3] = value & 0xff;
-      field[2] = (value >> 8) & 0xff;
-      value >>= 16;
+      value >>= 8;
+      /* Fall through.  */
+    case 3:
+      field[2] = value & 0xff;
+      value >>= 8;
       /* Fall through.  */
     case 2:
       field[1] = value & 0xff;
@@ -598,6 +605,7 @@ guess_is_rela (unsigned int e_machine)
     case EM_NIOS32:
     case EM_PPC64:
     case EM_PPC:
+    case EM_RX:
     case EM_S390:
     case EM_S390_OLD:
     case EM_SH:
@@ -609,9 +617,12 @@ guess_is_rela (unsigned int e_machine)
     case EM_CYGNUS_V850:
     case EM_VAX:
     case EM_X86_64:
+    case EM_L1OM:
     case EM_XSTORMY16:
     case EM_XTENSA:
     case EM_XTENSA_OLD:
+    case EM_MICROBLAZE:
+    case EM_MICROBLAZE_OLD:
       return TRUE;
 
     case EM_68HC05:
@@ -652,13 +663,15 @@ slurp_rela_relocs (FILE * file,
     {
       Elf32_External_Rela * erelas;
 
-      erelas = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs"));
+      erelas = (Elf32_External_Rela *) get_data (NULL, file, rel_offset, 1,
+                                                 rel_size, _("relocs"));
       if (!erelas)
        return 0;
 
       nrelas = rel_size / sizeof (Elf32_External_Rela);
 
-      relas = cmalloc (nrelas, sizeof (Elf_Internal_Rela));
+      relas = (Elf_Internal_Rela *) cmalloc (nrelas,
+                                             sizeof (Elf_Internal_Rela));
 
       if (relas == NULL)
        {
@@ -680,13 +693,15 @@ slurp_rela_relocs (FILE * file,
     {
       Elf64_External_Rela * erelas;
 
-      erelas = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs"));
+      erelas = (Elf64_External_Rela *) get_data (NULL, file, rel_offset, 1,
+                                                 rel_size, _("relocs"));
       if (!erelas)
        return 0;
 
       nrelas = rel_size / sizeof (Elf64_External_Rela);
 
-      relas = cmalloc (nrelas, sizeof (Elf_Internal_Rela));
+      relas = (Elf_Internal_Rela *) cmalloc (nrelas,
+                                             sizeof (Elf_Internal_Rela));
 
       if (relas == NULL)
        {
@@ -746,13 +761,14 @@ slurp_rel_relocs (FILE * file,
     {
       Elf32_External_Rel * erels;
 
-      erels = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs"));
+      erels = (Elf32_External_Rel *) get_data (NULL, file, rel_offset, 1,
+                                               rel_size, _("relocs"));
       if (!erels)
        return 0;
 
       nrels = rel_size / sizeof (Elf32_External_Rel);
 
-      rels = cmalloc (nrels, sizeof (Elf_Internal_Rela));
+      rels = (Elf_Internal_Rela *) cmalloc (nrels, sizeof (Elf_Internal_Rela));
 
       if (rels == NULL)
        {
@@ -774,13 +790,14 @@ slurp_rel_relocs (FILE * file,
     {
       Elf64_External_Rel * erels;
 
-      erels = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs"));
+      erels = (Elf64_External_Rel *) get_data (NULL, file, rel_offset, 1,
+                                               rel_size, _("relocs"));
       if (!erels)
        return 0;
 
       nrels = rel_size / sizeof (Elf64_External_Rel);
 
-      rels = cmalloc (nrels, sizeof (Elf_Internal_Rela));
+      rels = (Elf_Internal_Rela *) cmalloc (nrels, sizeof (Elf_Internal_Rela));
 
       if (rels == NULL)
        {
@@ -1127,6 +1144,7 @@ dump_relocations (FILE * file,
          break;
 
        case EM_X86_64:
+       case EM_L1OM:
          rtype = elf_x86_64_reloc_type (type);
          break;
 
@@ -1194,6 +1212,15 @@ dump_relocations (FILE * file,
        case EM_CR16_OLD:
          rtype = elf_cr16_reloc_type (type);
          break;
+       
+       case EM_MICROBLAZE:
+       case EM_MICROBLAZE_OLD:
+         rtype = elf_microblaze_reloc_type (type);
+         break;
+
+       case EM_RX:
+         rtype = elf_rx_reloc_type (type);
+         break;
        }
 
       if (rtype == NULL)
@@ -1291,7 +1318,8 @@ dump_relocations (FILE * file,
                      else if (elf_header.e_machine == EM_MIPS
                               && psym->st_shndx == SHN_MIPS_SUNDEFINED)
                        sec_name = "SUNDEF";
-                     else if (elf_header.e_machine == EM_X86_64
+                     else if ((elf_header.e_machine == EM_X86_64
+                               || elf_header.e_machine == EM_L1OM)
                               && psym->st_shndx == SHN_X86_64_LCOMMON)
                        sec_name = "LARGE_COMMON";
                      else if (elf_header.e_machine == EM_IA_64
@@ -1447,7 +1475,8 @@ get_ppc_dynamic_type (unsigned long type)
 {
   switch (type)
     {
-    case DT_PPC_GOT: return "PPC_GOT";
+    case DT_PPC_GOT:    return "PPC_GOT";
+    case DT_PPC_TLSOPT: return "PPC_TLSOPT";
     default:
       return NULL;
     }
@@ -1458,9 +1487,10 @@ get_ppc64_dynamic_type (unsigned long type)
 {
   switch (type)
     {
-    case DT_PPC64_GLINK: return "PPC64_GLINK";
-    case DT_PPC64_OPD:   return "PPC64_OPD";
-    case DT_PPC64_OPDSZ: return "PPC64_OPDSZ";
+    case DT_PPC64_GLINK:  return "PPC64_GLINK";
+    case DT_PPC64_OPD:    return "PPC64_OPD";
+    case DT_PPC64_OPDSZ:  return "PPC64_OPDSZ";
+    case DT_PPC64_TLSOPT: return "PPC64_TLSOPT";
     default:
       return NULL;
     }
@@ -1836,6 +1866,7 @@ get_machine_name (unsigned e_machine)
     case EM_HUANY:             return "Harvard Universitys's machine-independent object format";
     case EM_PRISM:             return "Vitesse Prism";
     case EM_X86_64:            return "Advanced Micro Devices X86-64";
+    case EM_L1OM:              return "Intel L1OM";
     case EM_S390_OLD:
     case EM_S390:              return "IBM S/390";
     case EM_SCORE:             return "SUNPLUS S+Core";
@@ -1860,6 +1891,9 @@ get_machine_name (unsigned e_machine)
     case EM_CYGNUS_MEP:         return "Toshiba MeP Media Engine";
     case EM_CR16:
     case EM_CR16_OLD:          return "National Semiconductor's CR16";
+    case EM_MICROBLAZE:                return "Xilinx MicroBlaze";
+    case EM_MICROBLAZE_OLD:    return "Xilinx MicroBlaze";
+    case EM_RX:                        return "Renesas RX";
     default:
       snprintf (buff, sizeof (buff), _("<unknown>: 0x%x"), e_machine);
       return buff;
@@ -2404,6 +2438,12 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
          if ((e_flags & EF_VAX_GFLOAT))
            strcat (buf, ", G-Float");
          break;
+
+       case EM_RX:
+         if (e_flags & E_FLAG_RX_64BIT_DOUBLES)
+           strcat (buf, ", 64-bit doubles");
+         if (e_flags & E_FLAG_RX_DSP)
+           strcat (buf, ", dsp");        
        }
     }
 
@@ -2711,12 +2751,11 @@ get_arm_section_type_name (unsigned int sh_type)
 {
   switch (sh_type)
     {
-    case SHT_ARM_EXIDX:
-      return "ARM_EXIDX";
-    case SHT_ARM_PREEMPTMAP:
-      return "ARM_PREEMPTMAP";
-    case SHT_ARM_ATTRIBUTES:
-      return "ARM_ATTRIBUTES";
+    case SHT_ARM_EXIDX:           return "ARM_EXIDX";
+    case SHT_ARM_PREEMPTMAP:      return "ARM_PREEMPTMAP";
+    case SHT_ARM_ATTRIBUTES:      return "ARM_ATTRIBUTES";
+    case SHT_ARM_DEBUGOVERLAY:    return "ARM_DEBUGOVERLAY";
+    case SHT_ARM_OVERLAYSECTION:  return "ARM_OVERLAYSECTION";
     default:
       break;
     }
@@ -2775,6 +2814,7 @@ get_section_type_name (unsigned int sh_type)
              result = get_ia64_section_type_name (sh_type);
              break;
            case EM_X86_64:
+           case EM_L1OM:
              result = get_x86_64_section_type_name (sh_type);
              break;
            case EM_ARM:
@@ -2844,11 +2884,12 @@ static struct option options[] =
   {"unwind",          no_argument, 0, 'u'},
   {"archive-index",    no_argument, 0, 'c'},
   {"hex-dump",        required_argument, 0, 'x'},
-  {"debug-dump",       optional_argument, 0, OPTION_DEBUG_DUMP},
+  {"relocated-dump",   required_argument, 0, 'R'},
   {"string-dump",      required_argument, 0, 'p'},
 #ifdef SUPPORT_DISASSEMBLY
   {"instruction-dump", required_argument, 0, 'i'},
 #endif
+  {"debug-dump",       optional_argument, 0, OPTION_DEBUG_DUMP},
 
   {"version",         no_argument, 0, 'v'},
   {"wide",            no_argument, 0, 'W'},
@@ -2885,6 +2926,8 @@ usage (FILE * stream)
                          Dump the contents of section <number|name> as bytes\n\
   -p --string-dump=<number|name>\n\
                          Dump the contents of section <number|name> as strings\n\
+  -R --relocated-dump=<number|name>\n\
+                         Dump the contents of section <number|name> as relocated bytes\n\
   -w[lLiaprmfFsoR] or\n\
   --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=str,=loc,=Ranges]\n\
                          Display the contents of DWARF2 debug sections\n"));
@@ -2918,7 +2961,8 @@ request_dump_bynumber (unsigned int section, dump_type type)
     {
       dump_type * new_dump_sects;
 
-      new_dump_sects = calloc (section + 1, sizeof (* dump_sects));
+      new_dump_sects = (dump_type *) calloc (section + 1,
+                                             sizeof (* dump_sects));
 
       if (new_dump_sects == NULL)
        error (_("Out of memory allocating dump request table.\n"));
@@ -2947,7 +2991,8 @@ request_dump_byname (const char * section, dump_type type)
 {
   struct dump_list_entry * new_request;
 
-  new_request = malloc (sizeof (struct dump_list_entry));
+  new_request = (struct dump_list_entry *)
+      malloc (sizeof (struct dump_list_entry));
   if (!new_request)
     error (_("Out of memory allocating dump request table.\n"));
 
@@ -2961,6 +3006,22 @@ request_dump_byname (const char * section, dump_type type)
   dump_sects_byname = new_request;
 }
 
+static inline void
+request_dump (dump_type type)
+{
+  int section;
+  char * cp;
+
+  do_dump++;
+  section = strtoul (optarg, & cp, 0);
+
+  if (! *cp && section >= 0)
+    request_dump_bynumber (section, type);
+  else
+    request_dump_byname (optarg, type);
+}
+
+
 static void
 parse_args (int argc, char ** argv)
 {
@@ -2970,11 +3031,8 @@ parse_args (int argc, char ** argv)
     usage (stderr);
 
   while ((c = getopt_long
-         (argc, argv, "ADHINSVWacdeghi:lnp:rstuvw::x:", options, NULL)) != EOF)
+         (argc, argv, "ADHINR:SVWacdeghi:lnp:rstuvw::x:", options, NULL)) != EOF)
     {
-      char * cp;
-      int section;
-
       switch (c)
        {
        case 0:
@@ -3048,20 +3106,13 @@ parse_args (int argc, char ** argv)
          do_archive_index++;
          break;
        case 'x':
-         do_dump++;
-         section = strtoul (optarg, & cp, 0);
-         if (! *cp && section >= 0)
-           request_dump_bynumber (section, HEX_DUMP);
-         else
-           request_dump_byname (optarg, HEX_DUMP);
+         request_dump (HEX_DUMP);
          break;
        case 'p':
-         do_dump++;
-         section = strtoul (optarg, & cp, 0);
-         if (! *cp && section >= 0)
-           request_dump_bynumber (section, STRING_DUMP);
-         else
-           request_dump_byname (optarg, STRING_DUMP);
+         request_dump (STRING_DUMP);
+         break;
+       case 'R':
+         request_dump (RELOC_DUMP);
          break;
        case 'w':
          do_dump++;
@@ -3088,12 +3139,8 @@ parse_args (int argc, char ** argv)
          break;
 #ifdef SUPPORT_DISASSEMBLY
        case 'i':
-         do_dump++;
-         section = strtoul (optarg, & cp, 0);
-         if (! *cp && section >= 0)
-           request_dump_bynumber (section, DISASS_DUMP);
-         else
-           request_dump_byname (optarg, DISASS_DUMP);
+         request_dump (DISASS_DUMP);
+         break;
 #endif
        case 'v':
          print_version (program_name);
@@ -3264,9 +3311,10 @@ get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers)
   Elf_Internal_Phdr *   internal;
   unsigned int i;
 
-  phdrs = get_data (NULL, file, elf_header.e_phoff,
-                   elf_header.e_phentsize, elf_header.e_phnum,
-                   _("program headers"));
+  phdrs = (Elf32_External_Phdr *) get_data (NULL, file, elf_header.e_phoff,
+                                            elf_header.e_phentsize,
+                                            elf_header.e_phnum,
+                                            _("program headers"));
   if (!phdrs)
     return 0;
 
@@ -3297,9 +3345,10 @@ get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers)
   Elf_Internal_Phdr *   internal;
   unsigned int i;
 
-  phdrs = get_data (NULL, file, elf_header.e_phoff,
-                   elf_header.e_phentsize, elf_header.e_phnum,
-                   _("program headers"));
+  phdrs = (Elf64_External_Phdr *) get_data (NULL, file, elf_header.e_phoff,
+                                            elf_header.e_phentsize,
+                                            elf_header.e_phnum,
+                                            _("program headers"));
   if (!phdrs)
     return 0;
 
@@ -3333,7 +3382,8 @@ get_program_headers (FILE * file)
   if (program_headers != NULL)
     return 1;
 
-  phdrs = cmalloc (elf_header.e_phnum, sizeof (Elf_Internal_Phdr));
+  phdrs = (Elf_Internal_Phdr *) cmalloc (elf_header.e_phnum,
+                                         sizeof (Elf_Internal_Phdr));
 
   if (phdrs == NULL)
     {
@@ -3626,12 +3676,14 @@ get_32bit_section_headers (FILE * file, unsigned int num)
   Elf_Internal_Shdr *   internal;
   unsigned int i;
 
-  shdrs = get_data (NULL, file, elf_header.e_shoff,
-                   elf_header.e_shentsize, num, _("section headers"));
+  shdrs = (Elf32_External_Shdr *) get_data (NULL, file, elf_header.e_shoff,
+                                            elf_header.e_shentsize, num,
+                                            _("section headers"));
   if (!shdrs)
     return 0;
 
-  section_headers = cmalloc (num, sizeof (Elf_Internal_Shdr));
+  section_headers = (Elf_Internal_Shdr *) cmalloc (num,
+                                                   sizeof (Elf_Internal_Shdr));
 
   if (section_headers == NULL)
     {
@@ -3667,12 +3719,14 @@ get_64bit_section_headers (FILE * file, unsigned int num)
   Elf_Internal_Shdr *   internal;
   unsigned int i;
 
-  shdrs = get_data (NULL, file, elf_header.e_shoff,
-                   elf_header.e_shentsize, num, _("section headers"));
+  shdrs = (Elf64_External_Shdr *) get_data (NULL, file, elf_header.e_shoff,
+                                            elf_header.e_shentsize, num,
+                                            _("section headers"));
   if (!shdrs)
     return 0;
 
-  section_headers = cmalloc (num, sizeof (Elf_Internal_Shdr));
+  section_headers = (Elf_Internal_Shdr *) cmalloc (num,
+                                                   sizeof (Elf_Internal_Shdr));
 
   if (section_headers == NULL)
     {
@@ -3711,8 +3765,8 @@ get_32bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section)
   Elf_Internal_Sym * psym;
   unsigned int j;
 
-  esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
-                   _("symbols"));
+  esyms = (Elf32_External_Sym *) get_data (NULL, file, section->sh_offset, 1,
+                                           section->sh_size, _("symbols"));
   if (!esyms)
     return NULL;
 
@@ -3721,8 +3775,10 @@ get_32bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section)
       && (symtab_shndx_hdr->sh_link
          == (unsigned long) (section - section_headers)))
     {
-      shndx = get_data (NULL, file, symtab_shndx_hdr->sh_offset,
-                       1, symtab_shndx_hdr->sh_size, _("symtab shndx"));
+      shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file,
+                                                   symtab_shndx_hdr->sh_offset,
+                                                   1, symtab_shndx_hdr->sh_size,
+                                                   _("symtab shndx"));
       if (!shndx)
        {
          free (esyms);
@@ -3731,7 +3787,7 @@ get_32bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section)
     }
 
   number = section->sh_size / section->sh_entsize;
-  isyms = cmalloc (number, sizeof (Elf_Internal_Sym));
+  isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym));
 
   if (isyms == NULL)
     {
@@ -3776,8 +3832,8 @@ get_64bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section)
   Elf_Internal_Sym * psym;
   unsigned int j;
 
-  esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
-                   _("symbols"));
+  esyms = (Elf64_External_Sym *) get_data (NULL, file, section->sh_offset, 1,
+                                           section->sh_size, _("symbols"));
   if (!esyms)
     return NULL;
 
@@ -3786,8 +3842,10 @@ get_64bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section)
       && (symtab_shndx_hdr->sh_link
          == (unsigned long) (section - section_headers)))
     {
-      shndx = get_data (NULL, file, symtab_shndx_hdr->sh_offset,
-                       1, symtab_shndx_hdr->sh_size, _("symtab shndx"));
+      shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file,
+                                                   symtab_shndx_hdr->sh_offset,
+                                                   1, symtab_shndx_hdr->sh_size,
+                                                   _("symtab shndx"));
       if (!shndx)
        {
          free (esyms);
@@ -3796,7 +3854,7 @@ get_64bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section)
     }
 
   number = section->sh_size / section->sh_entsize;
-  isyms = cmalloc (number, sizeof (Elf_Internal_Sym));
+  isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym));
 
   if (isyms == NULL)
     {
@@ -3848,26 +3906,29 @@ get_elf_section_flags (bfd_vma sh_flags)
     }
   flags [] =
     {
-       { "WRITE", 5 },
-       { "ALLOC", 5 },
-       { "EXEC", 4 },
-       { "MERGE", 5 },
-       { "STRINGS", 7 },
-       { "INFO LINK", 9 },
-       { "LINK ORDER", 10 },
-       { "OS NONCONF", 10 },
-       { "GROUP", 5 },
-       { "TLS", 3 },
-       /* IA-64 specific.  */
-       { "SHORT", 5 },
-       { "NORECOV", 7 },
-       /* IA-64 OpenVMS specific.  */
-       { "VMS_GLOBAL", 10 },
-       { "VMS_OVERLAID", 12 },
-       { "VMS_SHARED", 10 },
-       { "VMS_VECTOR", 10 },
-       { "VMS_ALLOC_64BIT", 15 },
-       { "VMS_PROTECTED", 13}
+      /*  0 */ { STRING_COMMA_LEN ("WRITE") },
+      /*  1 */ { STRING_COMMA_LEN ("ALLOC") },
+      /*  2 */ { STRING_COMMA_LEN ("EXEC") },
+      /*  3 */ { STRING_COMMA_LEN ("MERGE") },
+      /*  4 */ { STRING_COMMA_LEN ("STRINGS") },
+      /*  5 */ { STRING_COMMA_LEN ("INFO LINK") },
+      /*  6 */ { STRING_COMMA_LEN ("LINK ORDER") },
+      /*  7 */ { STRING_COMMA_LEN ("OS NONCONF") },
+      /*  8 */ { STRING_COMMA_LEN ("GROUP") },
+      /*  9 */ { STRING_COMMA_LEN ("TLS") },
+      /* IA-64 specific.  */
+      /* 10 */ { STRING_COMMA_LEN ("SHORT") },
+      /* 11 */ { STRING_COMMA_LEN ("NORECOV") },
+      /* IA-64 OpenVMS specific.  */
+      /* 12 */ { STRING_COMMA_LEN ("VMS_GLOBAL") },
+      /* 13 */ { STRING_COMMA_LEN ("VMS_OVERLAID") },
+      /* 14 */ { STRING_COMMA_LEN ("VMS_SHARED") },
+      /* 15 */ { STRING_COMMA_LEN ("VMS_VECTOR") },
+      /* 16 */ { STRING_COMMA_LEN ("VMS_ALLOC_64BIT") },
+      /* 17 */ { STRING_COMMA_LEN ("VMS_PROTECTED") },
+      /* SPARC specific.  */
+      /* 18 */ { STRING_COMMA_LEN ("EXCLUDE") },
+      /* 19 */ { STRING_COMMA_LEN ("ORDERED") }
     };
 
   if (do_section_details)
@@ -3901,8 +3962,9 @@ get_elf_section_flags (bfd_vma sh_flags)
 
            default:
              index = -1;
-             if (elf_header.e_machine == EM_IA_64)
+             switch (elf_header.e_machine)
                {
+               case EM_IA_64:
                  if (flag == SHF_IA_64_SHORT)
                    index = 10;
                  else if (flag == SHF_IA_64_NORECOV)
@@ -3920,8 +3982,23 @@ get_elf_section_flags (bfd_vma sh_flags)
                      default:                        break;
                      }
 #endif
+                 break;
+
+               case EM_386:
+               case EM_486:
+               case EM_X86_64:
+               case EM_OLD_SPARCV9:
+               case EM_SPARC32PLUS:
+               case EM_SPARCV9:
+               case EM_SPARC:
+                 if (flag == SHF_EXCLUDE)
+                   index = 18;
+                 else if (flag == SHF_ORDERED)
+                   index = 19;
+                 break;
+               default:
+                 break;
                }
-             break;
            }
 
          if (index != -1)
@@ -3961,7 +4038,8 @@ get_elf_section_flags (bfd_vma sh_flags)
            case SHF_TLS:               *p = 'T'; break;
 
            default:
-             if (elf_header.e_machine == EM_X86_64
+             if ((elf_header.e_machine == EM_X86_64
+                  || elf_header.e_machine == EM_L1OM)
                  && flag == SHF_X86_64_LARGE)
                *p = 'l';
              else if (flag & SHF_MASKOS)
@@ -4071,8 +4149,9 @@ process_section_headers (FILE * file)
 
       if (section->sh_size != 0)
        {
-         string_table = get_data (NULL, file, section->sh_offset,
-                                  1, section->sh_size, _("string table"));
+         string_table = (char *) get_data (NULL, file, section->sh_offset,
+                                            1, section->sh_size,
+                                            _("string table"));
 
          string_table_length = string_table != NULL ? section->sh_size : 0;
        }
@@ -4176,8 +4255,9 @@ process_section_headers (FILE * file)
              continue;
            }
 
-         dynamic_strings = get_data (NULL, file, section->sh_offset,
-                                     1, section->sh_size, _("dynamic strings"));
+         dynamic_strings = (char *) get_data (NULL, file, section->sh_offset,
+                                               1, section->sh_size,
+                                               _("dynamic strings"));
          dynamic_strings_length = section->sh_size;
        }
       else if (section->sh_type == SHT_SYMTAB_SHNDX)
@@ -4211,6 +4291,7 @@ process_section_headers (FILE * file)
 
          if (do_debugging
              || (do_debug_info     && streq (name, "info"))
+             || (do_debug_info     && streq (name, "types"))
              || (do_debug_abbrevs  && streq (name, "abbrev"))
              || (do_debug_lines    && streq (name, "line"))
              || (do_debug_pubnames && streq (name, "pubnames"))
@@ -4301,6 +4382,8 @@ process_section_headers (FILE * file)
 
       if (is_32bit_elf)
        {
+         const char * link_too_big = NULL;
+
          print_vma (section->sh_addr, LONG_HEX);
 
          printf ( " %6.6lx %6.6lx %2.2lx",
@@ -4313,10 +4396,48 @@ process_section_headers (FILE * file)
          else
            printf (" %3s ", get_elf_section_flags (section->sh_flags));
 
-         printf ("%2u %3u %2lu\n",
-                 section->sh_link,
-                 section->sh_info,
-                 (unsigned long) section->sh_addralign);
+         if (section->sh_link >= elf_header.e_shnum)
+           {
+             link_too_big = "";
+             /* The sh_link value is out of range.  Normally this indicates
+                an error but it can have special values in Solaris binaries.  */
+             switch (elf_header.e_machine)
+               {
+               case EM_386:
+               case EM_486:
+               case EM_X86_64:
+               case EM_OLD_SPARCV9:
+               case EM_SPARC32PLUS:
+               case EM_SPARCV9:
+               case EM_SPARC:
+                 if (section->sh_link == (SHN_BEFORE & 0xffff))
+                   link_too_big = "BEFORE";
+                 else if (section->sh_link == (SHN_AFTER & 0xffff))
+                   link_too_big = "AFTER";
+                 break;
+               default:
+                 break;
+               }
+           }
+
+         if (do_section_details)
+           {
+             if (link_too_big != NULL && * link_too_big)
+               printf ("<%s> ", link_too_big);
+             else
+               printf ("%2u ", section->sh_link);
+             printf ("%3u %2lu\n", section->sh_info,
+                     (unsigned long) section->sh_addralign);
+           }
+         else
+           printf ("%2u %3u %2lu\n",
+                   section->sh_link,
+                   section->sh_info,
+                   (unsigned long) section->sh_addralign);
+
+         if (link_too_big && ! * link_too_big)
+           warn (_("section %u: sh_link value of %u is larger than the number of sections\n"),
+                 i, section->sh_link);
        }
       else if (do_wide)
        {
@@ -4465,8 +4586,8 @@ process_section_groups (FILE * file)
       abort ();
     }
 
-  section_headers_groups = calloc (elf_header.e_shnum,
-                                  sizeof (struct group *));
+  section_headers_groups = (struct group **) calloc (elf_header.e_shnum,
+                                                     sizeof (struct group *));
 
   if (section_headers_groups == NULL)
     {
@@ -4490,7 +4611,7 @@ process_section_groups (FILE * file)
       return 1;
     }
 
-  section_groups = calloc (group_count, sizeof (struct group));
+  section_groups = (struct group *) calloc (group_count, sizeof (struct group));
 
   if (section_groups == NULL)
     {
@@ -4569,17 +4690,18 @@ process_section_groups (FILE * file)
                  strtab_sec = sec;
                  if (strtab)
                    free (strtab);
-                 strtab = get_data (NULL, file, strtab_sec->sh_offset,
-                                    1, strtab_sec->sh_size,
-                                    _("string table"));
+                 strtab = (char *) get_data (NULL, file, strtab_sec->sh_offset,
+                                              1, strtab_sec->sh_size,
+                                              _("string table"));
                  strtab_size = strtab != NULL ? strtab_sec->sh_size : 0;
                }
              group_name = sym->st_name < strtab_size
                           ? strtab + sym->st_name : "<corrupt>";
            }
 
-         start = get_data (NULL, file, section->sh_offset,
-                           1, section->sh_size, _("section data"));
+         start = (unsigned char *) get_data (NULL, file, section->sh_offset,
+                                              1, section->sh_size,
+                                              _("section data"));
 
          indices = start;
          size = (section->sh_size / section->sh_entsize) - 1;
@@ -4642,7 +4764,7 @@ process_section_groups (FILE * file)
                  printf ("   [%5u]   %s\n", entry, SECTION_NAME (sec));
                }
 
-             g = xmalloc (sizeof (struct group_list));
+             g = (struct group_list *) xmalloc (sizeof (struct group_list));
              g->section_index = entry;
              g->next = group->root;
              group->root = g;
@@ -4795,9 +4917,9 @@ process_relocs (FILE * file)
                    {
                      strsec = section_headers + symsec->sh_link;
 
-                     strtab = get_data (NULL, file, strsec->sh_offset,
-                                        1, strsec->sh_size,
-                                        _("string table"));
+                     strtab = (char *) get_data (NULL, file, strsec->sh_offset,
+                                                  1, strsec->sh_size,
+                                                  _("string table"));
                      strtablen = strtab == NULL ? 0 : strsec->sh_size;
                    }
 
@@ -4841,15 +4963,17 @@ struct absaddr
    ? section_headers [(a).section].sh_addr + (a).offset \
    : (a).offset)
 
+struct ia64_unw_table_entry
+  {
+    struct absaddr start;
+    struct absaddr end;
+    struct absaddr info;
+  };
+
 struct ia64_unw_aux_info
   {
-    struct ia64_unw_table_entry
-      {
-       struct absaddr start;
-       struct absaddr end;
-       struct absaddr info;
-      }
-    *table;                    /* Unwind table.  */
+
+    struct ia64_unw_table_entry *table;        /* Unwind table.  */
     unsigned long table_len;   /* Length of unwind table.  */
     unsigned char * info;      /* Unwind info.  */
     unsigned long info_size;   /* Size of unwind info.  */
@@ -4998,11 +5122,13 @@ slurp_ia64_unwind_table (FILE * file,
 
   /* Second, build the unwind table from the contents of the unwind section:  */
   size = sec->sh_size;
-  table = get_data (NULL, file, sec->sh_offset, 1, size, _("unwind table"));
+  table = (unsigned char *) get_data (NULL, file, sec->sh_offset, 1, size,
+                                      _("unwind table"));
   if (!table)
     return 0;
 
-  aux->table = xcmalloc (size / (3 * eh_addr_size), sizeof (aux->table[0]));
+  aux->table = (struct ia64_unw_table_entry *)
+      xcmalloc (size / (3 * eh_addr_size), sizeof (aux->table[0]));
   tep = aux->table;
   for (tp = table; tp < table + size; ++tep)
     {
@@ -5091,8 +5217,9 @@ ia64_process_unwind (FILE * file)
          aux.symtab = GET_ELF_SYMBOLS (file, sec);
 
          strsec = section_headers + sec->sh_link;
-         aux.strtab = get_data (NULL, file, strsec->sh_offset,
-                                1, strsec->sh_size, _("string table"));
+         aux.strtab = (char *) get_data (NULL, file, strsec->sh_offset,
+                                          1, strsec->sh_size,
+                                          _("string table"));
          aux.strtab_size = aux.strtab != NULL ? strsec->sh_size : 0;
        }
       else if (sec->sh_type == SHT_IA_64_UNWIND)
@@ -5174,8 +5301,9 @@ ia64_process_unwind (FILE * file)
        {
          aux.info_size = sec->sh_size;
          aux.info_addr = sec->sh_addr;
-         aux.info = get_data (NULL, file, sec->sh_offset, 1, aux.info_size,
-                              _("unwind info"));
+         aux.info = (unsigned char *) get_data (NULL, file, sec->sh_offset, 1,
+                                                 aux.info_size,
+                                                 _("unwind info"));
 
          printf (_("\nUnwind section "));
 
@@ -5210,45 +5338,46 @@ ia64_process_unwind (FILE * file)
   return 1;
 }
 
+struct hppa_unw_table_entry
+  {
+    struct absaddr start;
+    struct absaddr end;
+    unsigned int Cannot_unwind:1;                      /* 0 */
+    unsigned int Millicode:1;                  /* 1 */
+    unsigned int Millicode_save_sr0:1;         /* 2 */
+    unsigned int Region_description:2;         /* 3..4 */
+    unsigned int reserved1:1;                  /* 5 */
+    unsigned int Entry_SR:1;                   /* 6 */
+    unsigned int Entry_FR:4;     /* number saved */    /* 7..10 */
+    unsigned int Entry_GR:5;     /* number saved */    /* 11..15 */
+    unsigned int Args_stored:1;                        /* 16 */
+    unsigned int Variable_Frame:1;                     /* 17 */
+    unsigned int Separate_Package_Body:1;              /* 18 */
+    unsigned int Frame_Extension_Millicode:1;  /* 19 */
+    unsigned int Stack_Overflow_Check:1;               /* 20 */
+    unsigned int Two_Instruction_SP_Increment:1;       /* 21 */
+    unsigned int Ada_Region:1;                 /* 22 */
+    unsigned int cxx_info:1;                   /* 23 */
+    unsigned int cxx_try_catch:1;                      /* 24 */
+    unsigned int sched_entry_seq:1;                    /* 25 */
+    unsigned int reserved2:1;                  /* 26 */
+    unsigned int Save_SP:1;                            /* 27 */
+    unsigned int Save_RP:1;                            /* 28 */
+    unsigned int Save_MRP_in_frame:1;          /* 29 */
+    unsigned int extn_ptr_defined:1;           /* 30 */
+    unsigned int Cleanup_defined:1;                    /* 31 */
+
+    unsigned int MPE_XL_interrupt_marker:1;            /* 0 */
+    unsigned int HP_UX_interrupt_marker:1;             /* 1 */
+    unsigned int Large_frame:1;                        /* 2 */
+    unsigned int Pseudo_SP_Set:1;                      /* 3 */
+    unsigned int reserved4:1;                  /* 4 */
+    unsigned int Total_frame_size:27;          /* 5..31 */
+  };
+
 struct hppa_unw_aux_info
   {
-    struct hppa_unw_table_entry
-      {
-       struct absaddr start;
-       struct absaddr end;
-       unsigned int Cannot_unwind:1;                   /* 0 */
-       unsigned int Millicode:1;                       /* 1 */
-       unsigned int Millicode_save_sr0:1;              /* 2 */
-       unsigned int Region_description:2;              /* 3..4 */
-       unsigned int reserved1:1;                       /* 5 */
-       unsigned int Entry_SR:1;                        /* 6 */
-       unsigned int Entry_FR:4;     /* number saved */ /* 7..10 */
-       unsigned int Entry_GR:5;     /* number saved */ /* 11..15 */
-       unsigned int Args_stored:1;                     /* 16 */
-       unsigned int Variable_Frame:1;                  /* 17 */
-       unsigned int Separate_Package_Body:1;           /* 18 */
-       unsigned int Frame_Extension_Millicode:1;       /* 19 */
-       unsigned int Stack_Overflow_Check:1;            /* 20 */
-       unsigned int Two_Instruction_SP_Increment:1;    /* 21 */
-       unsigned int Ada_Region:1;                      /* 22 */
-       unsigned int cxx_info:1;                        /* 23 */
-       unsigned int cxx_try_catch:1;                   /* 24 */
-       unsigned int sched_entry_seq:1;                 /* 25 */
-       unsigned int reserved2:1;                       /* 26 */
-       unsigned int Save_SP:1;                         /* 27 */
-       unsigned int Save_RP:1;                         /* 28 */
-       unsigned int Save_MRP_in_frame:1;               /* 29 */
-       unsigned int extn_ptr_defined:1;                /* 30 */
-       unsigned int Cleanup_defined:1;                 /* 31 */
-
-       unsigned int MPE_XL_interrupt_marker:1;         /* 0 */
-       unsigned int HP_UX_interrupt_marker:1;          /* 1 */
-       unsigned int Large_frame:1;                     /* 2 */
-       unsigned int Pseudo_SP_Set:1;                   /* 3 */
-       unsigned int reserved4:1;                       /* 4 */
-       unsigned int Total_frame_size:27;               /* 5..31 */
-      }
-    *table;                    /* Unwind table.  */
+    struct hppa_unw_table_entry *table;        /* Unwind table.  */
     unsigned long table_len;   /* Length of unwind table.  */
     bfd_vma seg_base;          /* Starting address of segment.  */
     Elf_Internal_Sym * symtab; /* The symbol table.  */
@@ -5366,7 +5495,8 @@ slurp_hppa_unwind_table (FILE * file,
   /* Second, build the unwind table from the contents of the unwind
      section.  */
   size = sec->sh_size;
-  table = get_data (NULL, file, sec->sh_offset, 1, size, _("unwind table"));
+  table = (unsigned char *) get_data (NULL, file, sec->sh_offset, 1, size,
+                                      _("unwind table"));
   if (!table)
     return 0;
 
@@ -5374,7 +5504,8 @@ slurp_hppa_unwind_table (FILE * file,
   nentries = size / unw_ent_size;
   size = unw_ent_size * nentries;
 
-  tep = aux->table = xcmalloc (nentries, sizeof (aux->table[0]));
+  tep = aux->table = (struct hppa_unw_table_entry *)
+      xcmalloc (nentries, sizeof (aux->table[0]));
 
   for (tp = table; tp < table + size; tp += unw_ent_size, ++tep)
     {
@@ -5499,8 +5630,9 @@ hppa_process_unwind (FILE * file)
          aux.symtab = GET_ELF_SYMBOLS (file, sec);
 
          strsec = section_headers + sec->sh_link;
-         aux.strtab = get_data (NULL, file, strsec->sh_offset,
-                                1, strsec->sh_size, _("string table"));
+         aux.strtab = (char *) get_data (NULL, file, strsec->sh_offset,
+                                          1, strsec->sh_size,
+                                          _("string table"));
          aux.strtab_size = aux.strtab != NULL ? strsec->sh_size : 0;
        }
       else if (streq (SECTION_NAME (sec), ".PARISC.unwind"))
@@ -5726,8 +5858,8 @@ get_32bit_dynamic_section (FILE * file)
   Elf32_External_Dyn * ext;
   Elf_Internal_Dyn * entry;
 
-  edyn = get_data (NULL, file, dynamic_addr, 1, dynamic_size,
-                  _("dynamic section"));
+  edyn = (Elf32_External_Dyn *) get_data (NULL, file, dynamic_addr, 1,
+                                          dynamic_size, _("dynamic section"));
   if (!edyn)
     return 0;
 
@@ -5743,7 +5875,8 @@ get_32bit_dynamic_section (FILE * file)
        break;
     }
 
-  dynamic_section = cmalloc (dynamic_nent, sizeof (* entry));
+  dynamic_section = (Elf_Internal_Dyn *) cmalloc (dynamic_nent,
+                                                  sizeof (* entry));
   if (dynamic_section == NULL)
     {
       error (_("Out of memory\n"));
@@ -5771,8 +5904,8 @@ get_64bit_dynamic_section (FILE * file)
   Elf64_External_Dyn * ext;
   Elf_Internal_Dyn * entry;
 
-  edyn = get_data (NULL, file, dynamic_addr, 1, dynamic_size,
-                  _("dynamic section"));
+  edyn = (Elf64_External_Dyn *) get_data (NULL, file, dynamic_addr, 1,
+                                          dynamic_size, _("dynamic section"));
   if (!edyn)
     return 0;
 
@@ -5788,7 +5921,8 @@ get_64bit_dynamic_section (FILE * file)
        break;
     }
 
-  dynamic_section = cmalloc (dynamic_nent, sizeof (* entry));
+  dynamic_section = (Elf_Internal_Dyn *) cmalloc (dynamic_nent,
+                                                  sizeof (* entry));
   if (dynamic_section == NULL)
     {
       error (_("Out of memory\n"));
@@ -5946,8 +6080,9 @@ process_dynamic_section (FILE * file)
              continue;
            }
 
-         dynamic_strings = get_data (NULL, file, offset, 1, str_tab_len,
-                                     _("dynamic string table"));
+         dynamic_strings = (char *) get_data (NULL, file, offset, 1,
+                                               str_tab_len,
+                                               _("dynamic string table"));
          dynamic_strings_length = str_tab_len;
          break;
        }
@@ -5982,12 +6117,13 @@ process_dynamic_section (FILE * file)
          Elf_Internal_Syminfo * syminfo;
 
          /* There is a syminfo section.  Read the data.  */
-         extsyminfo = get_data (NULL, file, dynamic_syminfo_offset, 1,
-                                syminsz, _("symbol information"));
+         extsyminfo = (Elf_External_Syminfo *)
+              get_data (NULL, file, dynamic_syminfo_offset, 1, syminsz,
+                        _("symbol information"));
          if (!extsyminfo)
            return 0;
 
-         dynamic_syminfo = malloc (syminsz);
+         dynamic_syminfo = (Elf_Internal_Syminfo *) malloc (syminsz);
          if (dynamic_syminfo == NULL)
            {
              error (_("Out of memory\n"));
@@ -6436,6 +6572,7 @@ get_ver_flags (unsigned int flags)
 }
 
 /* Display the contents of the version sections.  */
+
 static int
 process_version_sections (FILE * file)
 {
@@ -6473,9 +6610,9 @@ process_version_sections (FILE * file)
                    ? SECTION_NAME (section_headers + section->sh_link)
                    : "<corrupt>");
 
-           edefs = get_data (NULL, file, section->sh_offset, 1,
-                             section->sh_size,
-                             _("version definition section"));
+           edefs = (Elf_External_Verdef *)
+                get_data (NULL, file, section->sh_offset, 1,section->sh_size,
+                          _("version definition section"));
            endbuf = (char *) edefs + section->sh_size;
            if (!edefs)
              break;
@@ -6575,9 +6712,10 @@ process_version_sections (FILE * file)
                    ? SECTION_NAME (section_headers + section->sh_link)
                    : "<corrupt>");
 
-           eneed = get_data (NULL, file, section->sh_offset, 1,
-                             section->sh_size,
-                             _("version need section"));
+           eneed = (Elf_External_Verneed *) get_data (NULL, file,
+                                                       section->sh_offset, 1,
+                                                       section->sh_size,
+                                                       _("version need section"));
            endbuf = (char *) eneed + section->sh_size;
            if (!eneed)
              break;
@@ -6680,8 +6818,9 @@ process_version_sections (FILE * file)
 
            string_sec = section_headers + link_section->sh_link;
 
-           strtab = get_data (NULL, file, string_sec->sh_offset, 1,
-                              string_sec->sh_size, _("version string table"));
+           strtab = (char *) get_data (NULL, file, string_sec->sh_offset, 1,
+                                        string_sec->sh_size,
+                                        _("version string table"));
            if (!strtab)
              break;
 
@@ -6697,15 +6836,16 @@ process_version_sections (FILE * file)
            off = offset_from_vma (file,
                                   version_info[DT_VERSIONTAGIDX (DT_VERSYM)],
                                   total * sizeof (short));
-           edata = get_data (NULL, file, off, total, sizeof (short),
-                             _("version symbol data"));
+           edata = (unsigned char *) get_data (NULL, file, off, total,
+                                                sizeof (short),
+                                                _("version symbol data"));
            if (!edata)
              {
                free (strtab);
                break;
              }
 
-           data = cmalloc (total, sizeof (short));
+           data = (short unsigned int *) cmalloc (total, sizeof (short));
 
            for (cnt = total; cnt --;)
              data[cnt] = byte_get (edata + cnt * sizeof (short),
@@ -6733,8 +6873,8 @@ process_version_sections (FILE * file)
                      break;
 
                    default:
-                     nn = printf ("%4x%c", data[cnt + j] & 0x7fff,
-                                  data[cnt + j] & 0x8000 ? 'h' : ' ');
+                     nn = printf ("%4x%c", data[cnt + j] & VERSYM_VERSION,
+                                  data[cnt + j] & VERSYM_HIDDEN ? 'h' : ' ');
 
                      check_def = 1;
                      check_need = 1;
@@ -6828,10 +6968,10 @@ process_version_sections (FILE * file)
 
                              offset += ivd.vd_next;
                            }
-                         while (ivd.vd_ndx != (data[cnt + j] & 0x7fff)
+                         while (ivd.vd_ndx != (data[cnt + j] & VERSYM_VERSION)
                                 && ivd.vd_next != 0);
 
-                         if (ivd.vd_ndx == (data[cnt + j] & 0x7fff))
+                         if (ivd.vd_ndx == (data[cnt + j] & VERSYM_VERSION))
                            {
                              Elf_External_Verdaux evda;
                              Elf_Internal_Verdaux ivda;
@@ -6895,7 +7035,14 @@ get_symbol_binding (unsigned int binding)
        snprintf (buff, sizeof (buff), _("<processor specific>: %d"),
                  binding);
       else if (binding >= STB_LOOS && binding <= STB_HIOS)
-       snprintf (buff, sizeof (buff), _("<OS specific>: %d"), binding);
+       {
+         if (binding == STB_GNU_UNIQUE
+             && (elf_header.e_ident[EI_OSABI] == ELFOSABI_LINUX
+                 /* GNU/Linux is still using the default value 0.  */
+                 || elf_header.e_ident[EI_OSABI] == ELFOSABI_NONE))
+           return "UNIQUE";
+         snprintf (buff, sizeof (buff), _("<OS specific>: %d"), binding);
+       }
       else
        snprintf (buff, sizeof (buff), _("<unknown>: %d"), binding);
       return buff;
@@ -7021,7 +7168,8 @@ get_symbol_index_type (unsigned int type)
          && elf_header.e_machine == EM_IA_64
          && elf_header.e_ident[EI_OSABI] == ELFOSABI_HPUX)
        return "ANSI_COM";
-      else if (elf_header.e_machine == EM_X86_64
+      else if ((elf_header.e_machine == EM_X86_64
+               || elf_header.e_machine == EM_L1OM)
               && type == SHN_X86_64_LCOMMON)
        return "LARGE_COM";
       else if (type == SHN_MIPS_SCOMMON
@@ -7050,7 +7198,7 @@ get_dynamic_data (FILE * file, unsigned int number, unsigned int ent_size)
   unsigned char * e_data;
   bfd_vma * i_data;
 
-  e_data = cmalloc (number, ent_size);
+  e_data = (unsigned char *) cmalloc (number, ent_size);
 
   if (e_data == NULL)
     {
@@ -7064,7 +7212,7 @@ get_dynamic_data (FILE * file, unsigned int number, unsigned int ent_size)
       return NULL;
     }
 
-  i_data = cmalloc (number, sizeof (*i_data));
+  i_data = (bfd_vma *) cmalloc (number, sizeof (*i_data));
 
   if (i_data == NULL)
     {
@@ -7097,9 +7245,9 @@ print_dynamic_symbol (bfd_vma si, unsigned long hn)
   putchar (' ');
   print_vma (psym->st_size, DEC_5);
 
-  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 (" %-7s", get_symbol_type (ELF_ST_TYPE (psym->st_info)));
+  printf (" %-6s",  get_symbol_binding (ELF_ST_BIND (psym->st_info)));
+  printf (" %-7s",  get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other)));
   /* Check to see if any other bits in the st_other field are set.
      Note - displaying this information disrupts the layout of the
      table being generated, but for the moment this case is very
@@ -7152,19 +7300,19 @@ process_symbol_table (FILE * file)
                 SEEK_SET))
        {
          error (_("Unable to seek to start of dynamic information\n"));
-         return 0;
+         goto no_hash;
        }
 
       if (fread (nb, hash_ent_size, 1, file) != 1)
        {
          error (_("Failed to read in number of buckets\n"));
-         return 0;
+         goto no_hash;
        }
 
       if (fread (nc, hash_ent_size, 1, file) != 1)
        {
          error (_("Failed to read in number of chains\n"));
-         return 0;
+         goto no_hash;
        }
 
       nbuckets = byte_get (nb, hash_ent_size);
@@ -7173,8 +7321,18 @@ process_symbol_table (FILE * file)
       buckets = get_dynamic_data (file, nbuckets, hash_ent_size);
       chains  = get_dynamic_data (file, nchains, hash_ent_size);
 
+    no_hash:
       if (buckets == NULL || chains == NULL)
-       return 0;
+       {
+         if (do_using_dynamic)
+           return 0;
+         free (buckets);
+         free (chains);
+         buckets = NULL;
+         chains = NULL;
+         nbuckets = 0;
+         nchains = 0;
+       }
     }
 
   if (dynamic_info_DT_GNU_HASH
@@ -7192,13 +7350,13 @@ process_symbol_table (FILE * file)
                 SEEK_SET))
        {
          error (_("Unable to seek to start of dynamic information\n"));
-         return 0;
+         goto no_gnu_hash;
        }
 
       if (fread (nb, 16, 1, file) != 1)
        {
          error (_("Failed to read in number of buckets\n"));
-         return 0;
+         goto no_gnu_hash;
        }
 
       ngnubuckets = byte_get (nb, 4);
@@ -7216,13 +7374,13 @@ process_symbol_table (FILE * file)
                 SEEK_SET))
        {
          error (_("Unable to seek to start of dynamic information\n"));
-         return 0;
+         goto no_gnu_hash;
        }
 
       gnubuckets = get_dynamic_data (file, ngnubuckets, 4);
 
       if (gnubuckets == NULL)
-       return 0;
+       goto no_gnu_hash;
 
       for (i = 0; i < ngnubuckets; i++)
        if (gnubuckets[i] != 0)
@@ -7235,7 +7393,7 @@ process_symbol_table (FILE * file)
          }
 
       if (maxchain == 0xffffffff)
-       return 0;
+       goto no_gnu_hash;
 
       maxchain -= gnusymidx;
 
@@ -7246,7 +7404,7 @@ process_symbol_table (FILE * file)
                 SEEK_SET))
        {
          error (_("Unable to seek to start of dynamic information\n"));
-         return 0;
+         goto no_gnu_hash;
        }
 
       do
@@ -7254,11 +7412,11 @@ process_symbol_table (FILE * file)
          if (fread (nb, 4, 1, file) != 1)
            {
              error (_("Failed to determine last chain length\n"));
-             return 0;
+             goto no_gnu_hash;
            }
 
          if (maxchain + 1 == 0)
-           return 0;
+           goto no_gnu_hash;
 
          ++maxchain;
        }
@@ -7270,13 +7428,20 @@ process_symbol_table (FILE * file)
                 SEEK_SET))
        {
          error (_("Unable to seek to start of dynamic information\n"));
-         return 0;
+         goto no_gnu_hash;
        }
 
       gnuchains = get_dynamic_data (file, maxchain, 4);
 
+    no_gnu_hash:
       if (gnuchains == NULL)
-       return 0;
+       {
+         free (gnubuckets);
+         gnubuckets = NULL;
+         ngnubuckets = 0;
+         if (do_using_dynamic)
+           return 0;
+       }
     }
 
   if ((dynamic_info[DT_HASH] || dynamic_info_DT_GNU_HASH)
@@ -7370,8 +7535,9 @@ process_symbol_table (FILE * file)
 
              string_sec = section_headers + section->sh_link;
 
-             strtab = get_data (NULL, file, string_sec->sh_offset,
-                                1, string_sec->sh_size, _("string table"));
+             strtab = (char *) get_data (NULL, file, string_sec->sh_offset,
+                                          1, string_sec->sh_size,
+                                          _("string table"));
              strtab_size = strtab != NULL ? string_sec->sh_size : 0;
            }
 
@@ -7385,7 +7551,7 @@ process_symbol_table (FILE * file)
              print_vma (psym->st_size, DEC_5);
              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 (" %-7s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other)));
              /* Check to see if any other bits in the st_other field are set.
                 Note - displaying this information disrupts the layout of the
                 table being generated, but for the moment this case is very rare.  */
@@ -7419,7 +7585,7 @@ process_symbol_table (FILE * file)
 
                  check_def = (psym->st_shndx != SHN_UNDEF);
 
-                 if ((vers_data & 0x8000) || vers_data > 1)
+                 if ((vers_data & VERSYM_HIDDEN) || vers_data > 1)
                    {
                      if (version_info[DT_VERSIONTAGIDX (DT_VERNEED)]
                          && (is_nobits || ! check_def))
@@ -7511,7 +7677,7 @@ process_symbol_table (FILE * file)
 
                                  offset += ivd.vd_next;
                                }
-                             while (ivd.vd_ndx != (vers_data & 0x7fff)
+                             while (ivd.vd_ndx != (vers_data & VERSYM_VERSION)
                                     && ivd.vd_next != 0);
 
                              offset -= ivd.vd_next;
@@ -7523,7 +7689,7 @@ process_symbol_table (FILE * file)
                              ivda.vda_name = BYTE_GET (evda.vda_name);
 
                              if (psym->st_name != ivda.vda_name)
-                               printf ((vers_data & 0x8000)
+                               printf ((vers_data & VERSYM_HIDDEN)
                                        ? "@%s" : "@@%s",
                                        ivda.vda_name < strtab_size
                                        ? strtab + ivda.vda_name : "<corrupt>");
@@ -7558,7 +7724,7 @@ process_symbol_table (FILE * file)
              (unsigned long) nbuckets);
       printf (_(" Length  Number     %% of total  Coverage\n"));
 
-      lengths = calloc (nbuckets, sizeof (*lengths));
+      lengths = (unsigned long *) calloc (nbuckets, sizeof (*lengths));
       if (lengths == NULL)
        {
          error (_("Out of memory\n"));
@@ -7574,7 +7740,7 @@ process_symbol_table (FILE * file)
            }
        }
 
-      counts = calloc (maxlength + 1, sizeof (*counts));
+      counts = (unsigned long *) calloc (maxlength + 1, sizeof (*counts));
       if (counts == NULL)
        {
          error (_("Out of memory\n"));
@@ -7608,7 +7774,7 @@ process_symbol_table (FILE * file)
       free (chains);
     }
 
-  if (do_histogram && dynamic_info_DT_GNU_HASH)
+  if (do_histogram && gnubuckets != NULL)
     {
       unsigned long * lengths;
       unsigned long * counts;
@@ -7617,7 +7783,7 @@ process_symbol_table (FILE * file)
       unsigned long nzero_counts = 0;
       unsigned long nsyms = 0;
 
-      lengths = calloc (ngnubuckets, sizeof (*lengths));
+      lengths = (unsigned long *) calloc (ngnubuckets, sizeof (*lengths));
       if (lengths == NULL)
        {
          error (_("Out of memory\n"));
@@ -7642,7 +7808,7 @@ process_symbol_table (FILE * file)
            nsyms += length;
          }
 
-      counts = calloc (maxlength + 1, sizeof (*counts));
+      counts = (unsigned long *) calloc (maxlength + 1, sizeof (*counts));
       if (counts == NULL)
        {
          error (_("Out of memory\n"));
@@ -7741,207 +7907,74 @@ process_syminfo (FILE * file ATTRIBUTE_UNUSED)
   return 1;
 }
 
-#ifdef SUPPORT_DISASSEMBLY
-static int
-disassemble_section (Elf_Internal_Shdr * section, FILE * file)
-{
-  printf (_("\nAssembly dump of section %s\n"),
-         SECTION_NAME (section));
-
-  /* XXX -- to be done --- XXX */
-
-  return 1;
-}
-#endif
+/* Check to see if the given reloc needs to be handled in a target specific
+   manner.  If so then process the reloc and return TRUE otherwise return
+   FALSE.  */
 
-static int
-dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file)
+static bfd_boolean
+target_specific_reloc_handling (Elf_Internal_Rela * reloc,
+                               unsigned char *     start,
+                               Elf_Internal_Sym *  symtab)
 {
-  Elf_Internal_Shdr * relsec;
-  bfd_size_type num_bytes;
-  bfd_vma addr;
-  char * data;
-  char * end;
-  char * start;
-  char * name = SECTION_NAME (section);
-  bfd_boolean some_strings_shown;
-
-  num_bytes = section->sh_size;
-
-  if (num_bytes == 0 || section->sh_type == SHT_NOBITS)
-    {
-      printf (_("\nSection '%s' has no data to dump.\n"), name);
-      return 0;
-    }
-
-  addr = section->sh_addr;
-
-  start = get_data (NULL, file, section->sh_offset, 1, num_bytes,
-                   _("section data"));
-  if (!start)
-    return 0;
-
-  printf (_("\nString dump of section '%s':\n"), name);
+  unsigned int reloc_type = get_reloc_type (reloc->r_info);
 
-  /* If the section being dumped has relocations against it the user might
-     be expecting these relocations to have been applied.  Check for this
-     case and issue a warning message in order to avoid confusion.
-     FIXME: Maybe we ought to have an option that dumps a section with
-     relocs applied ?  */
-  for (relsec = section_headers;
-       relsec < section_headers + elf_header.e_shnum;
-       ++relsec)
+  switch (elf_header.e_machine)
     {
-      if ((relsec->sh_type != SHT_RELA && relsec->sh_type != SHT_REL)
-         || relsec->sh_info >= elf_header.e_shnum
-         || section_headers + relsec->sh_info != section
-         || relsec->sh_size == 0
-         || relsec->sh_link >= elf_header.e_shnum)
-       continue;
+    case EM_MN10300:
+    case EM_CYGNUS_MN10300:
+      {
+       static Elf_Internal_Sym * saved_sym = NULL;
 
-      printf (_("  Note: This section has relocations against it, but these have NOT been applied to this dump.\n"));
-      break;
-    }
+       switch (reloc_type)
+         {
+         case 34: /* R_MN10300_ALIGN */
+           return TRUE;
+         case 33: /* R_MN10300_SYM_DIFF */
+           saved_sym = symtab + get_reloc_symindex (reloc->r_info);
+           return TRUE;
+         case 1: /* R_MN10300_32 */
+         case 2: /* R_MN10300_16 */
+           if (saved_sym != NULL)
+             {
+               bfd_vma value;
 
-  data = start;
-  end  = start + num_bytes;
-  some_strings_shown = FALSE;
+               value = reloc->r_addend
+                 + (symtab[get_reloc_symindex (reloc->r_info)].st_value
+                    - saved_sym->st_value);
 
-  while (data < end)
-    {
-      while (!ISPRINT (* data))
-       if (++ data >= end)
-         break;
+               byte_put (start + reloc->r_offset, value, reloc_type == 1 ? 4 : 2);
 
-      if (data < end)
-       {
-#ifndef __MSVCRT__
-         printf ("  [%6tx]  %s\n", data - start, data);
-#else
-         printf ("  [%6Ix]  %s\n", (size_t) (data - start), data);
-#endif
-         data += strlen (data);
-         some_strings_shown = TRUE;
-       }
+               saved_sym = NULL;
+               return TRUE;
+             }
+           break;
+         default:
+           if (saved_sym != NULL)
+             error (_("Unhandled MN10300 reloc type found after SYM_DIFF reloc"));
+           break;
+         }
+       break;
+      }
     }
 
-  if (! some_strings_shown)
-    printf (_("  No strings found in this section."));
-
-  free (start);
-
-  putchar ('\n');
-  return 1;
+  return FALSE;
 }
 
+/* Returns TRUE iff RELOC_TYPE is a 32-bit absolute RELA relocation used in
+   DWARF debug sections.  This is a target specific test.  Note - we do not
+   go through the whole including-target-headers-multiple-times route, (as
+   we have already done with <elf/h8.h>) because this would become very
+   messy and even then this function would have to contain target specific
+   information (the names of the relocs instead of their numeric values).
+   FIXME: This is not the correct way to solve this problem.  The proper way
+   is to have target specific reloc sizing and typing functions created by
+   the reloc-macros.h header, in the same way that it already creates the
+   reloc naming functions.  */
 
-static int
-dump_section_as_bytes (Elf_Internal_Shdr * section, FILE * file)
+static bfd_boolean
+is_32bit_abs_reloc (unsigned int reloc_type)
 {
-  Elf_Internal_Shdr * relsec;
-  bfd_size_type bytes;
-  bfd_vma addr;
-  unsigned char * data;
-  unsigned char * start;
-
-  bytes = section->sh_size;
-
-  if (bytes == 0 || section->sh_type == SHT_NOBITS)
-    {
-      printf (_("\nSection '%s' has no data to dump.\n"),
-             SECTION_NAME (section));
-      return 0;
-    }
-  else
-    printf (_("\nHex dump of section '%s':\n"), SECTION_NAME (section));
-
-  addr = section->sh_addr;
-
-  start = get_data (NULL, file, section->sh_offset, 1, bytes,
-                   _("section data"));
-  if (!start)
-    return 0;
-
-  /* If the section being dumped has relocations against it the user might
-     be expecting these relocations to have been applied.  Check for this
-     case and issue a warning message in order to avoid confusion.
-     FIXME: Maybe we ought to have an option that dumps a section with
-     relocs applied ?  */
-  for (relsec = section_headers;
-       relsec < section_headers + elf_header.e_shnum;
-       ++relsec)
-    {
-      if ((relsec->sh_type != SHT_RELA && relsec->sh_type != SHT_REL)
-         || relsec->sh_info >= elf_header.e_shnum
-         || section_headers + relsec->sh_info != section
-         || relsec->sh_size == 0
-         || relsec->sh_link >= elf_header.e_shnum)
-       continue;
-
-      printf (_(" NOTE: This section has relocations against it, but these have NOT been applied to this dump.\n"));
-      break;
-    }
-
-  data = start;
-
-  while (bytes)
-    {
-      int j;
-      int k;
-      int lbytes;
-
-      lbytes = (bytes > 16 ? 16 : bytes);
-
-      printf ("  0x%8.8lx ", (unsigned long) addr);
-
-      for (j = 0; j < 16; j++)
-       {
-         if (j < lbytes)
-           printf ("%2.2x", data[j]);
-         else
-           printf ("  ");
-
-         if ((j & 3) == 3)
-           printf (" ");
-       }
-
-      for (j = 0; j < lbytes; j++)
-       {
-         k = data[j];
-         if (k >= ' ' && k < 0x7f)
-           printf ("%c", k);
-         else
-           printf (".");
-       }
-
-      putchar ('\n');
-
-      data  += lbytes;
-      addr  += lbytes;
-      bytes -= lbytes;
-    }
-
-  free (start);
-
-  putchar ('\n');
-  return 1;
-}
-
-/* Returns TRUE iff RELOC_TYPE is a 32-bit absolute RELA relocation used in
-   DWARF debug sections.  This is a target specific test.  Note - we do not
-   go through the whole including-target-headers-multiple-times route, (as
-   we have already done with <elf/h8.h>) because this would become very
-   messy and even then this function would have to contain target specific
-   information (the names of the relocs instead of their numeric values).
-   FIXME: This is not the correct way to solve this problem.  The proper way
-   is to have target specific reloc sizing and typing functions created by
-   the reloc-macros.h header, in the same way that it already creates the
-   reloc naming functions.  */
-
-static bfd_boolean
-is_32bit_abs_reloc (unsigned int reloc_type)
-{
-  switch (elf_header.e_machine)
+  switch (elf_header.e_machine)
     {
     case EM_386:
     case EM_486:
@@ -8025,7 +8058,8 @@ is_32bit_abs_reloc (unsigned int reloc_type)
     case EM_OR32:
       return reloc_type == 1; /* R_OR32_32.  */
     case EM_PARISC:
-      return reloc_type == 1; /* R_PARISC_DIR32.  */
+      return (reloc_type == 1 /* R_PARISC_DIR32.  */
+             || reloc_type == 41); /* R_PARISC_SECREL32.  */
     case EM_PJ:
     case EM_PJ_OLD:
       return reloc_type == 1; /* R_PJ_DATA_DIR32.  */
@@ -8033,6 +8067,8 @@ is_32bit_abs_reloc (unsigned int reloc_type)
       return reloc_type == 1; /* R_PPC64_ADDR32.  */
     case EM_PPC:
       return reloc_type == 1; /* R_PPC_ADDR32.  */
+    case EM_RX:
+      return reloc_type == 1; /* R_RX_DIR32.  */
     case EM_S370:
       return reloc_type == 1; /* R_I370_ADDR31.  */
     case EM_S390_OLD:
@@ -8055,6 +8091,7 @@ is_32bit_abs_reloc (unsigned int reloc_type)
     case EM_VAX:
       return reloc_type == 1; /* R_VAX_32.  */
     case EM_X86_64:
+    case EM_L1OM:
       return reloc_type == 10; /* R_X86_64_32.  */
     case EM_XSTORMY16:
       return reloc_type == 1; /* R_XSTROMY16_32.  */
@@ -8104,6 +8141,7 @@ is_32bit_pcrel_reloc (unsigned int reloc_type)
     case EM_SPU:
       return reloc_type == 13; /* R_SPU_REL32.  */
     case EM_X86_64:
+    case EM_L1OM:
       return reloc_type == 2;  /* R_X86_64_PC32.  */
     case EM_XTENSA_OLD:
     case EM_XTENSA:
@@ -8112,8 +8150,8 @@ is_32bit_pcrel_reloc (unsigned int reloc_type)
       /* Do not abort or issue an error message here.  Not all targets use
         pc-relative 32-bit relocs in their DWARF debug information and we
         have already tested for target coverage in is_32bit_abs_reloc.  A
-        more helpful warning message will be generated by
-        debug_apply_relocations anyway, so just return.  */
+        more helpful warning message will be generated by apply_relocations
+        anyway, so just return.  */
       return FALSE;
     }
 }
@@ -8139,6 +8177,7 @@ is_64bit_abs_reloc (unsigned int reloc_type)
     case EM_SPARC:
       return reloc_type == 54; /* R_SPARC_UA64.  */
     case EM_X86_64:
+    case EM_L1OM:
       return reloc_type == 1; /* R_X86_64_64.  */
     case EM_S390_OLD:
     case EM_S390:
@@ -8171,6 +8210,7 @@ is_64bit_pcrel_reloc (unsigned int reloc_type)
     case EM_SPARC:
       return reloc_type == 46; /* R_SPARC_DISP64 */
     case EM_X86_64:
+    case EM_L1OM:
       return reloc_type == 24; /* R_X86_64_PC64 */
     case EM_S390_OLD:
     case EM_S390:
@@ -8180,6 +8220,22 @@ is_64bit_pcrel_reloc (unsigned int reloc_type)
     }
 }
 
+/* Like is_32bit_abs_reloc except that it returns TRUE iff RELOC_TYPE is
+   a 24-bit absolute RELA relocation used in DWARF debug sections.  */
+
+static bfd_boolean
+is_24bit_abs_reloc (unsigned int reloc_type)
+{
+  switch (elf_header.e_machine)
+    {
+    case EM_CYGNUS_MN10200:
+    case EM_MN10200:
+      return reloc_type == 4; /* R_MN10200_24.  */
+    default:
+      return FALSE;
+    }
+}
+
 /* Like is_32bit_abs_reloc except that it returns TRUE iff RELOC_TYPE is
    a 16-bit absolute RELA relocation used in DWARF debug sections.  */
 
@@ -8240,92 +8296,29 @@ is_none_reloc (unsigned int reloc_type)
     case EM_S390:    /* R_390_NONE.  */
     case EM_CRIS:    /* R_CRIS_NONE.  */
     case EM_X86_64:  /* R_X86_64_NONE.  */
+    case EM_L1OM:    /* R_X86_64_NONE.  */
     case EM_MN10300: /* R_MN10300_NONE.  */
     case EM_M32R:    /* R_M32R_NONE.  */
       return reloc_type == 0;
+    case EM_XTENSA_OLD:
+    case EM_XTENSA:
+      return (reloc_type == 0      /* R_XTENSA_NONE.  */
+             || reloc_type == 17  /* R_XTENSA_DIFF8.  */
+             || reloc_type == 18  /* R_XTENSA_DIFF16.  */
+             || reloc_type == 19  /* R_XTENSA_DIFF32.  */);
     }
   return FALSE;
 }
 
-/* Uncompresses a section that was compressed using zlib, in place.
-   This is a copy of bfd_uncompress_section_contents, in bfd/compress.c  */
-
-static int
-uncompress_section_contents (unsigned char ** buffer, dwarf_size_type * size)
-{
-#ifndef HAVE_ZLIB_H
-  /* These are just to quiet gcc.  */
-  buffer = 0;
-  size = 0;
-  return FALSE;
-#else
-  dwarf_size_type compressed_size = *size;
-  unsigned char * compressed_buffer = *buffer;
-  dwarf_size_type uncompressed_size;
-  unsigned char * uncompressed_buffer;
-  z_stream strm;
-  int rc;
-  dwarf_size_type header_size = 12;
-
-  /* Read the zlib header.  In this case, it should be "ZLIB" followed
-     by the uncompressed section size, 8 bytes in big-endian order.  */
-  if (compressed_size < header_size
-      || ! streq ((char *) compressed_buffer, "ZLIB"))
-    return 0;
-
-  uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8;
-  uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8;
-  uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8;
-  uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8;
-  uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8;
-  uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8;
-  uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8;
-  uncompressed_size += compressed_buffer[11];
-
-  /* It is possible the section consists of several compressed
-     buffers concatenated together, so we uncompress in a loop.  */
-  strm.zalloc = NULL;
-  strm.zfree = NULL;
-  strm.opaque = NULL;
-  strm.avail_in = compressed_size - header_size;
-  strm.next_in = (Bytef *) compressed_buffer + header_size;
-  strm.avail_out = uncompressed_size;
-  uncompressed_buffer = xmalloc (uncompressed_size);
-
-  rc = inflateInit (& strm);
-  while (strm.avail_in > 0)
-    {
-      if (rc != Z_OK)
-        goto fail;
-      strm.next_out = ((Bytef *) uncompressed_buffer
-                       + (uncompressed_size - strm.avail_out));
-      rc = inflate (&strm, Z_FINISH);
-      if (rc != Z_STREAM_END)
-        goto fail;
-      rc = inflateReset (& strm);
-    }
-  rc = inflateEnd (& strm);
-  if (rc != Z_OK
-      || strm.avail_out != 0)
-    goto fail;
-
-  free (compressed_buffer);
-  *buffer = uncompressed_buffer;
-  *size = uncompressed_size;
-  return 1;
-
- fail:
-  free (uncompressed_buffer);
-  return 0;
-#endif  /* HAVE_ZLIB_H */
-}
-
-/* Apply relocations to a debug section.  */
+/* Apply relocations to a section.
+   Note: So far support has been added only for those relocations
+   which can be found in debug sections.
+   FIXME: Add support for more relocations ?  */
 
 static void
-debug_apply_relocations (void * file,
-                        Elf_Internal_Shdr * section,
-                        unsigned char * start)
+apply_relocations (void * file,
+                  Elf_Internal_Shdr * section,
+                  unsigned char * start)
 {
   Elf_Internal_Shdr * relsec;
   unsigned char * end = start + section->sh_size;
@@ -8333,7 +8326,7 @@ debug_apply_relocations (void * file,
   if (elf_header.e_type != ET_REL)
     return;
 
-  /* Find the reloc section associated with the debug section.  */
+  /* Find the reloc section associated with the section.  */
   for (relsec = section_headers;
        relsec < section_headers + elf_header.e_shnum;
        ++relsec)
@@ -8357,14 +8350,14 @@ debug_apply_relocations (void * file,
 
       if (is_rela)
        {
-         if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size,
-                                 & relocs, & num_relocs))
+         if (!slurp_rela_relocs ((FILE *) file, relsec->sh_offset,
+                                  relsec->sh_size, & relocs, & num_relocs))
            return;
        }
       else
        {
-         if (!slurp_rel_relocs (file, relsec->sh_offset, relsec->sh_size,
-                                & relocs, & num_relocs))
+         if (!slurp_rel_relocs ((FILE *) file, relsec->sh_offset,
+                                 relsec->sh_size, & relocs, & num_relocs))
            return;
        }
 
@@ -8373,7 +8366,7 @@ debug_apply_relocations (void * file,
        is_rela = FALSE;
 
       symsec = section_headers + relsec->sh_link;
-      symtab = GET_ELF_SYMBOLS (file, symsec);
+      symtab = GET_ELF_SYMBOLS ((FILE *) file, symsec);
 
       for (rp = relocs; rp < relocs + num_relocs; ++rp)
        {
@@ -8384,15 +8377,18 @@ debug_apply_relocations (void * file,
 
          reloc_type = get_reloc_type (rp->r_info);
 
-         if (is_none_reloc (reloc_type))
+         if (target_specific_reloc_handling (rp, start, symtab))
            continue;
-
-         if (is_32bit_abs_reloc (reloc_type)
-             || is_32bit_pcrel_reloc (reloc_type))
+         else if (is_none_reloc (reloc_type))
+           continue;
+         else if (is_32bit_abs_reloc (reloc_type)
+                  || is_32bit_pcrel_reloc (reloc_type))
            reloc_size = 4;
          else if (is_64bit_abs_reloc (reloc_type)
                   || is_64bit_pcrel_reloc (reloc_type))
            reloc_size = 8;
+         else if (is_24bit_abs_reloc (reloc_type))
+           reloc_size = 3;
          else if (is_16bit_abs_reloc (reloc_type))
            reloc_size = 2;
          else
@@ -8436,7 +8432,17 @@ debug_apply_relocations (void * file,
              continue;
            }
 
-         addend = is_rela ? rp->r_addend : byte_get (loc, reloc_size);
+         addend = 0;
+         if (is_rela)
+           addend += rp->r_addend;
+         /* R_XTENSA_32 and R_PJ_DATA_DIR32 are partial_inplace.  */
+         if (!is_rela
+             || (elf_header.e_machine == EM_XTENSA
+                 && reloc_type == 1)
+             || ((elf_header.e_machine == EM_PJ
+                  || elf_header.e_machine == EM_PJ_OLD)
+                 && reloc_type == 1))
+           addend += byte_get (loc, reloc_size);
 
          if (is_32bit_pcrel_reloc (reloc_type)
              || is_64bit_pcrel_reloc (reloc_type))
@@ -8457,6 +8463,274 @@ debug_apply_relocations (void * file,
     }
 }
 
+#ifdef SUPPORT_DISASSEMBLY
+static int
+disassemble_section (Elf_Internal_Shdr * section, FILE * file)
+{
+  printf (_("\nAssembly dump of section %s\n"),
+         SECTION_NAME (section));
+
+  /* XXX -- to be done --- XXX */
+
+  return 1;
+}
+#endif
+
+/* Reads in the contents of SECTION from FILE, returning a pointer
+   to a malloc'ed buffer or NULL if something went wrong.  */
+
+static char *
+get_section_contents (Elf_Internal_Shdr * section, FILE * file)
+{
+  bfd_size_type num_bytes;
+
+  num_bytes = section->sh_size;
+
+  if (num_bytes == 0 || section->sh_type == SHT_NOBITS)
+    {
+      printf (_("\nSection '%s' has no data to dump.\n"),
+             SECTION_NAME (section));
+      return NULL;
+    }
+
+  return  (char *) get_data (NULL, file, section->sh_offset, 1, num_bytes,
+                             _("section contents"));
+}
+
+                     
+static void
+dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file)
+{
+  Elf_Internal_Shdr * relsec;
+  bfd_size_type num_bytes;
+  bfd_vma addr;
+  char * data;
+  char * end;
+  char * start;
+  char * name = SECTION_NAME (section);
+  bfd_boolean some_strings_shown;
+
+  start = get_section_contents (section, file);
+  if (start == NULL)
+    return;
+
+  printf (_("\nString dump of section '%s':\n"), name);
+
+  /* If the section being dumped has relocations against it the user might
+     be expecting these relocations to have been applied.  Check for this
+     case and issue a warning message in order to avoid confusion.
+     FIXME: Maybe we ought to have an option that dumps a section with
+     relocs applied ?  */
+  for (relsec = section_headers;
+       relsec < section_headers + elf_header.e_shnum;
+       ++relsec)
+    {
+      if ((relsec->sh_type != SHT_RELA && relsec->sh_type != SHT_REL)
+         || relsec->sh_info >= elf_header.e_shnum
+         || section_headers + relsec->sh_info != section
+         || relsec->sh_size == 0
+         || relsec->sh_link >= elf_header.e_shnum)
+       continue;
+
+      printf (_("  Note: This section has relocations against it, but these have NOT been applied to this dump.\n"));
+      break;
+    }
+
+  num_bytes = section->sh_size;
+  addr = section->sh_addr;
+  data = start;
+  end  = start + num_bytes;
+  some_strings_shown = FALSE;
+
+  while (data < end)
+    {
+      while (!ISPRINT (* data))
+       if (++ data >= end)
+         break;
+
+      if (data < end)
+       {
+#ifndef __MSVCRT__
+         printf ("  [%6tx]  %s\n", data - start, data);
+#else
+         printf ("  [%6Ix]  %s\n", (size_t) (data - start), data);
+#endif
+         data += strlen (data);
+         some_strings_shown = TRUE;
+       }
+    }
+
+  if (! some_strings_shown)
+    printf (_("  No strings found in this section."));
+
+  free (start);
+
+  putchar ('\n');
+}
+
+static void
+dump_section_as_bytes (Elf_Internal_Shdr * section,
+                      FILE * file,
+                      bfd_boolean relocate)
+{
+  Elf_Internal_Shdr * relsec;
+  bfd_size_type bytes;
+  bfd_vma addr;
+  unsigned char * data;
+  unsigned char * start;
+
+  start = (unsigned char *) get_section_contents (section, file);
+  if (start == NULL)
+    return;
+
+  printf (_("\nHex dump of section '%s':\n"), SECTION_NAME (section));
+
+  if (relocate)
+    {
+      apply_relocations (file, section, start);
+    }
+  else
+    {
+      /* If the section being dumped has relocations against it the user might
+        be expecting these relocations to have been applied.  Check for this
+        case and issue a warning message in order to avoid confusion.
+        FIXME: Maybe we ought to have an option that dumps a section with
+        relocs applied ?  */
+      for (relsec = section_headers;
+          relsec < section_headers + elf_header.e_shnum;
+          ++relsec)
+       {
+         if ((relsec->sh_type != SHT_RELA && relsec->sh_type != SHT_REL)
+             || relsec->sh_info >= elf_header.e_shnum
+             || section_headers + relsec->sh_info != section
+             || relsec->sh_size == 0
+             || relsec->sh_link >= elf_header.e_shnum)
+           continue;
+
+         printf (_(" NOTE: This section has relocations against it, but these have NOT been applied to this dump.\n"));
+         break;
+       }
+    }
+
+  addr = section->sh_addr;
+  bytes = section->sh_size;
+  data = start;
+
+  while (bytes)
+    {
+      int j;
+      int k;
+      int lbytes;
+
+      lbytes = (bytes > 16 ? 16 : bytes);
+
+      printf ("  0x%8.8lx ", (unsigned long) addr);
+
+      for (j = 0; j < 16; j++)
+       {
+         if (j < lbytes)
+           printf ("%2.2x", data[j]);
+         else
+           printf ("  ");
+
+         if ((j & 3) == 3)
+           printf (" ");
+       }
+
+      for (j = 0; j < lbytes; j++)
+       {
+         k = data[j];
+         if (k >= ' ' && k < 0x7f)
+           printf ("%c", k);
+         else
+           printf (".");
+       }
+
+      putchar ('\n');
+
+      data  += lbytes;
+      addr  += lbytes;
+      bytes -= lbytes;
+    }
+
+  free (start);
+
+  putchar ('\n');
+}
+
+/* Uncompresses a section that was compressed using zlib, in place.
+   This is a copy of bfd_uncompress_section_contents, in bfd/compress.c  */
+
+static int
+uncompress_section_contents (unsigned char ** buffer, dwarf_size_type * size)
+{
+#ifndef HAVE_ZLIB_H
+  /* These are just to quiet gcc.  */
+  buffer = 0;
+  size = 0;
+  return FALSE;
+#else
+  dwarf_size_type compressed_size = *size;
+  unsigned char * compressed_buffer = *buffer;
+  dwarf_size_type uncompressed_size;
+  unsigned char * uncompressed_buffer;
+  z_stream strm;
+  int rc;
+  dwarf_size_type header_size = 12;
+
+  /* Read the zlib header.  In this case, it should be "ZLIB" followed
+     by the uncompressed section size, 8 bytes in big-endian order.  */
+  if (compressed_size < header_size
+      || ! streq ((char *) compressed_buffer, "ZLIB"))
+    return 0;
+
+  uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[11];
+
+  /* It is possible the section consists of several compressed
+     buffers concatenated together, so we uncompress in a loop.  */
+  strm.zalloc = NULL;
+  strm.zfree = NULL;
+  strm.opaque = NULL;
+  strm.avail_in = compressed_size - header_size;
+  strm.next_in = (Bytef *) compressed_buffer + header_size;
+  strm.avail_out = uncompressed_size;
+  uncompressed_buffer = (unsigned char *) xmalloc (uncompressed_size);
+
+  rc = inflateInit (& strm);
+  while (strm.avail_in > 0)
+    {
+      if (rc != Z_OK)
+        goto fail;
+      strm.next_out = ((Bytef *) uncompressed_buffer
+                       + (uncompressed_size - strm.avail_out));
+      rc = inflate (&strm, Z_FINISH);
+      if (rc != Z_STREAM_END)
+        goto fail;
+      rc = inflateReset (& strm);
+    }
+  rc = inflateEnd (& strm);
+  if (rc != Z_OK
+      || strm.avail_out != 0)
+    goto fail;
+
+  free (compressed_buffer);
+  *buffer = uncompressed_buffer;
+  *size = uncompressed_size;
+  return 1;
+
+ fail:
+  free (uncompressed_buffer);
+  return 0;
+#endif  /* HAVE_ZLIB_H */
+}
+
 static int
 load_specific_debug_section (enum dwarf_section_display_enum debug,
                             Elf_Internal_Shdr * sec, void * file)
@@ -8474,8 +8748,9 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
   snprintf (buf, sizeof (buf), _("%s section data"), section->name);
   section->address = sec->sh_addr;
   section->size = sec->sh_size;
-  section->start = get_data (NULL, file, sec->sh_offset, 1,
-                            sec->sh_size, buf);
+  section->start = (unsigned char *) get_data (NULL, (FILE *) file,
+                                               sec->sh_offset, 1,
+                                               sec->sh_size, buf);
   if (section->start == NULL)
     return 0;
 
@@ -8484,7 +8759,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
       return 0;
 
   if (debug_displays [debug].relocate)
-    debug_apply_relocations (file, sec, section->start);
+    apply_relocations ((FILE *) file, sec, section->start);
 
   return 1;
 }
@@ -8508,7 +8783,7 @@ load_debug_section (enum dwarf_section_display_enum debug, void * file)
   if (sec == NULL)
     return 0;
 
-  return load_specific_debug_section (debug, sec, file);
+  return load_specific_debug_section (debug, sec, (FILE *) file);
 }
 
 void
@@ -8531,7 +8806,7 @@ display_debug_section (Elf_Internal_Shdr * section, FILE * file)
   char * name = SECTION_NAME (section);
   bfd_size_type length;
   int result = 1;
-  enum dwarf_section_display_enum i;
+  int i;
 
   length = section->sh_size;
   if (length == 0)
@@ -8539,6 +8814,15 @@ display_debug_section (Elf_Internal_Shdr * section, FILE * file)
       printf (_("\nSection '%s' has no debugging data.\n"), name);
       return 0;
     }
+  if (section->sh_type == SHT_NOBITS)
+    {
+      /* There is no point in dumping the contents of a debugging section
+        which has the NOBITS type - the bits in the file will be random.
+        This can happen when a file containing a .eh_frame section is
+        stripped with the --only-keep-debug command line option.  */
+      printf (_("section '%s' has the NOBITS type - its contents are unreliable.\n"), name);
+      return 0;
+    }
 
   if (const_strneq (name, ".gnu.linkonce.wi."))
     name = ".debug_info";
@@ -8552,18 +8836,19 @@ display_debug_section (Elf_Internal_Shdr * section, FILE * file)
        int secondary = (section != find_section (name));
 
        if (secondary)
-         free_debug_section (i);
+         free_debug_section ((enum dwarf_section_display_enum) i);
 
-       if (streq (debug_displays[i].section.uncompressed_name, name))
+       if (streq (sec->uncompressed_name, name))
          sec->name = sec->uncompressed_name;
        else
          sec->name = sec->compressed_name;
-       if (load_specific_debug_section (i, section, file))
+       if (load_specific_debug_section ((enum dwarf_section_display_enum) i,
+                                         section, file))
          {
            result &= debug_displays[i].display (sec, file);
 
            if (secondary || (i != info && i != abbrev))
-             free_debug_section (i);
+             free_debug_section ((enum dwarf_section_display_enum) i);
          }
 
        break;
@@ -8624,13 +8909,16 @@ process_section_contents (FILE * file)
        disassemble_section (section, file);
 #endif
       if (dump_sects[i] & HEX_DUMP)
-       dump_section_as_bytes (section, file);
+       dump_section_as_bytes (section, file, FALSE);
 
-      if (dump_sects[i] & DEBUG_DUMP)
-       display_debug_section (section, file);
+      if (dump_sects[i] & RELOC_DUMP)
+       dump_section_as_bytes (section, file, TRUE);
 
       if (dump_sects[i] & STRING_DUMP)
        dump_section_as_strings (section, file);
+
+      if (dump_sects[i] & DEBUG_DUMP)
+       display_debug_section (section, file);
     }
 
   /* Check to see if the user requested a
@@ -9150,8 +9438,8 @@ process_attributes (FILE * file,
       if (sect->sh_type != proc_type && sect->sh_type != SHT_GNU_ATTRIBUTES)
        continue;
 
-      contents = get_data (NULL, file, sect->sh_offset, 1, sect->sh_size,
-                          _("attributes"));
+      contents = (unsigned char *) get_data (NULL, file, sect->sh_offset, 1,
+                                             sect->sh_size, _("attributes"));
       if (contents == NULL)
        continue;
 
@@ -9413,9 +9701,10 @@ process_mips_specific (FILE * file)
       Elf32_External_Lib * elib;
       size_t cnt;
 
-      elib = get_data (NULL, file, liblist_offset,
-                      liblistno, sizeof (Elf32_External_Lib),
-                      _("liblist"));
+      elib = (Elf32_External_Lib *) get_data (NULL, file, liblist_offset,
+                                              liblistno,
+                                              sizeof (Elf32_External_Lib),
+                                              _("liblist"));
       if (elib)
        {
          printf ("\nSection '.liblist' contains %lu entries:\n",
@@ -9501,11 +9790,12 @@ process_mips_specific (FILE * file)
       while (sect->sh_type != SHT_MIPS_OPTIONS)
        ++sect;
 
-      eopt = get_data (NULL, file, options_offset, 1, sect->sh_size,
-                      _("options"));
+      eopt = (Elf_External_Options *) get_data (NULL, file, options_offset, 1,
+                                                sect->sh_size, _("options"));
       if (eopt)
        {
-         iopt = cmalloc ((sect->sh_size / sizeof (eopt)), sizeof (* iopt));
+         iopt = (Elf_Internal_Options *)
+              cmalloc ((sect->sh_size / sizeof (eopt)), sizeof (* iopt));
          if (iopt == NULL)
            {
              error (_("Out of memory\n"));
@@ -9697,7 +9987,7 @@ process_mips_specific (FILE * file)
          return 0;
        }
 
-      iconf = cmalloc (conflictsno, sizeof (* iconf));
+      iconf = (Elf32_Conflict *) cmalloc (conflictsno, sizeof (* iconf));
       if (iconf == NULL)
        {
          error (_("Out of memory\n"));
@@ -9708,8 +9998,9 @@ process_mips_specific (FILE * file)
        {
          Elf32_External_Conflict * econf32;
 
-         econf32 = get_data (NULL, file, conflicts_offset,
-                             conflictsno, sizeof (* econf32), _("conflict"));
+         econf32 = (Elf32_External_Conflict *)
+              get_data (NULL, file, conflicts_offset, conflictsno,
+                        sizeof (* econf32), _("conflict"));
          if (!econf32)
            return 0;
 
@@ -9722,8 +10013,9 @@ process_mips_specific (FILE * file)
        {
          Elf64_External_Conflict * econf64;
 
-         econf64 = get_data (NULL, file, conflicts_offset,
-                             conflictsno, sizeof (* econf64), _("conflict"));
+         econf64 = (Elf64_External_Conflict *)
+              get_data (NULL, file, conflicts_offset, conflictsno,
+                        sizeof (* econf64), _("conflict"));
          if (!econf64)
            return 0;
 
@@ -9767,7 +10059,8 @@ process_mips_specific (FILE * file)
       global_end = local_end + (symtabno - gotsym) * addr_size;
 
       offset = offset_from_vma (file, pltgot, global_end - pltgot);
-      data = get_data (NULL, file, offset, global_end - pltgot, 1, _("GOT"));
+      data = (unsigned char *) get_data (NULL, file, offset,
+                                         global_end - pltgot, 1, _("GOT"));
       printf (_("\nPrimary GOT:\n"));
       printf (_(" Canonical gp value: "));
       print_vma (pltgot + 0x7ff0, LONG_HEX);
@@ -9862,7 +10155,8 @@ process_mips_specific (FILE * file)
       end = mips_pltgot + (2 + count) * addr_size;
 
       offset = offset_from_vma (file, mips_pltgot, end - mips_pltgot);
-      data = get_data (NULL, file, offset, end - mips_pltgot, 1, _("PLT GOT"));
+      data = (unsigned char *) get_data (NULL, file, offset, end - mips_pltgot,
+                                         1, _("PLT GOT"));
       printf (_("\nPLT GOT:\n\n"));
       printf (_(" Reserved entries:\n"));
       printf (_("  %*s %*s Purpose\n"),
@@ -9930,15 +10224,17 @@ process_gnu_liblist (FILE * file)
          if (section->sh_link >= elf_header.e_shnum)
            break;
 
-         elib = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
-                          _("liblist"));
+         elib = (Elf32_External_Lib *)
+              get_data (NULL, file, section->sh_offset, 1, section->sh_size,
+                        _("liblist"));
 
          if (elib == NULL)
            break;
          string_sec = section_headers + section->sh_link;
 
-         strtab = get_data (NULL, file, string_sec->sh_offset, 1,
-                            string_sec->sh_size, _("liblist string table"));
+         strtab = (char *) get_data (NULL, file, string_sec->sh_offset, 1,
+                                      string_sec->sh_size,
+                                      _("liblist string table"));
          strtab_size = string_sec->sh_size;
 
          if (strtab == NULL
@@ -10182,7 +10478,8 @@ process_corefile_note_segment (FILE * file, bfd_vma offset, bfd_vma length)
   if (length <= 0)
     return 0;
 
-  pnotes = get_data (NULL, file, offset, 1, length, _("notes"));
+  pnotes = (Elf_External_Note *) get_data (NULL, file, offset, 1, length,
+                                           _("notes"));
   if (!pnotes)
     return 0;
 
@@ -10224,7 +10521,7 @@ process_corefile_note_segment (FILE * file, bfd_vma offset, bfd_vma length)
         namesz.  */
       if (inote.namedata[inote.namesz] != '\0')
        {
-         temp = malloc (inote.namesz + 1);
+         temp = (char *) malloc (inote.namesz + 1);
 
          if (temp == NULL)
            {
@@ -10599,7 +10896,7 @@ adjust_relative_path (char * file_name, char * name, int name_len)
      archive is located.  */
   if (IS_ABSOLUTE_PATH (name) || base_name == file_name)
     {
-      member_file_name = malloc (name_len + 1);
+      member_file_name = (char *) malloc (name_len + 1);
       if (member_file_name == NULL)
         {
           error (_("Out of memory\n"));
@@ -10613,7 +10910,7 @@ adjust_relative_path (char * file_name, char * name, int name_len)
       /* Concatenate the path components of the archive file name
          to the relative path name from the extended name table.  */
       size_t prefix_len = base_name - file_name;
-      member_file_name = malloc (prefix_len + name_len + 1);
+      member_file_name = (char *) malloc (prefix_len + name_len + 1);
       if (member_file_name == NULL)
         {
           error (_("Out of memory\n"));
@@ -10723,7 +11020,8 @@ setup_archive (struct archive_info * arch, char * file_name, FILE * file,
                     file_name, arch->index_num);
              return 1;
            }
-         index_buffer = malloc (arch->index_num * SIZEOF_AR_INDEX_NUMBERS);
+         index_buffer = (unsigned char *)
+              malloc (arch->index_num * SIZEOF_AR_INDEX_NUMBERS);
          if (index_buffer == NULL)
            {
              error (_("Out of memory whilst trying to read archive symbol index\n"));
@@ -10739,7 +11037,8 @@ setup_archive (struct archive_info * arch, char * file_name, FILE * file,
          size -= arch->index_num * SIZEOF_AR_INDEX_NUMBERS;
 
          /* Convert the index numbers into the host's numeric format.  */
-         arch->index_array = malloc (arch->index_num * sizeof (* arch->index_array));
+         arch->index_array = (long unsigned int *)
+              malloc (arch->index_num * sizeof (* arch->index_array));
          if (arch->index_array == NULL)
            {
              free (index_buffer);
@@ -10758,7 +11057,7 @@ setup_archive (struct archive_info * arch, char * file_name, FILE * file,
              error (_("%s: the archive has an index but no symbols\n"), file_name);
              return 1;
            }
-         arch->sym_table = malloc (size);
+         arch->sym_table = (char *) malloc (size);
          arch->sym_size = size;
          if (arch->sym_table == NULL)
            {
@@ -10800,7 +11099,7 @@ setup_archive (struct archive_info * arch, char * file_name, FILE * file,
       arch->longnames_size = strtoul (arch->arhdr.ar_size, NULL, 10);
       arch->next_arhdr_offset += sizeof arch->arhdr + arch->longnames_size;
 
-      arch->longnames = malloc (arch->longnames_size);
+      arch->longnames = (char *) malloc (arch->longnames_size);
       if (arch->longnames == NULL)
        {
          error (_("Out of memory reading long symbol names in archive\n"));
@@ -10972,7 +11271,7 @@ make_qualified_name (struct archive_info * arch,
   if (arch->is_thin_archive && arch->nested_member_origin != 0)
     len += strlen (nested_arch->file_name) + 2;
 
-  name = malloc (len);
+  name = (char *) malloc (len);
   if (name == NULL)
     {
       error (_("Out of memory\n"));
@@ -11307,7 +11606,8 @@ main (int argc, char ** argv)
   if (num_dump_sects > 0)
     {
       /* Make a copy of the dump_sects array.  */
-      cmdline_dump_sects = malloc (num_dump_sects * sizeof (* dump_sects));
+      cmdline_dump_sects = (dump_type *)
+          malloc (num_dump_sects * sizeof (* dump_sects));
       if (cmdline_dump_sects == NULL)
        error (_("Out of memory allocating dump request table.\n"));
       else
This page took 0.05501 seconds and 4 git commands to generate.