case EM_NONE:        	return _("None"); case EM_M32:         	return "WE32100"; case EM_SPARC:       	return "Sparc"; case EM_386:         	return "Intel 80386"; case EM_68K:         	return "MC68000"; case EM_88K:         	return "MC88000"; case EM_486:         	return "Intel 80486"; case EM_860:         	return "Intel 80860"; case EM_MIPS:        	return "MIPS R3000"; case EM_S370:        	return "IBM System/370"; case EM_MIPS_RS4_BE: 	return "MIPS R4000 big-endian";
case EM_NONE:	return _("None"); case EM_M32:	return "WE32100"; case EM_SPARC:	return "Sparc"; case EM_386:	return "Intel 80386"; case EM_68K:	return "MC68000"; case EM_88K:	return "MC88000"; case EM_486:	return "Intel 80486"; case EM_860:	return "Intel 80860"; case EM_MIPS:	return "MIPS R3000"; case EM_S370:	return "IBM System/370"; case EM_MIPS_RS3_LE:	return "MIPS R4000 big-endian";
static const char *       get_dynamic_flags 	      PARAMS ((bfd_vma));static void               usage                       PARAMS ((void));static void               parse_args                  PARAMS ((int, char **));static int                process_file_header         PARAMS ((void));static int                process_program_headers     PARAMS ((FILE *));static int                process_section_headers     PARAMS ((FILE *));static void               dynamic_segment_mips_val    PARAMS ((Elf_Internal_Dyn *));static void               dynamic_segment_parisc_val  PARAMS ((Elf_Internal_Dyn *));static int                process_dynamic_segment     PARAMS ((FILE *));static int                process_symbol_table        PARAMS ((FILE *));static int                process_section_contents    PARAMS ((FILE *));static void               process_file                PARAMS ((char *));static int                process_relocs              PARAMS ((FILE *));static int                process_version_sections    PARAMS ((FILE *));static char *             get_ver_flags               PARAMS ((unsigned int));static int                get_32bit_section_headers   PARAMS ((FILE *));static int                get_64bit_section_headers   PARAMS ((FILE *));static int		  get_32bit_program_headers   PARAMS ((FILE *, Elf_Internal_Phdr *));static int		  get_64bit_program_headers   PARAMS ((FILE *, Elf_Internal_Phdr *));static int                get_file_header             PARAMS ((FILE *));static Elf_Internal_Sym * get_32bit_elf_symbols       PARAMS ((FILE *, unsigned long, unsigned long));static Elf_Internal_Sym * get_64bit_elf_symbols       PARAMS ((FILE *, unsigned long, unsigned long));static int *              get_dynamic_data            PARAMS ((FILE *, unsigned int));static int                get_32bit_dynamic_segment   PARAMS ((FILE *));static int                get_64bit_dynamic_segment   PARAMS ((FILE *));#ifdef SUPPORT_DISASSEMBLYstatic int 	          disassemble_section         PARAMS ((Elf32_Internal_Shdr *, FILE *));#endifstatic int 	          dump_section                PARAMS ((Elf32_Internal_Shdr *, FILE *));static int 	          display_debug_section       PARAMS ((Elf32_Internal_Shdr *, FILE *));static int                display_debug_info          PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));static int                display_debug_not_supported PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));static int                display_debug_lines         PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));static int                display_debug_abbrev        PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));static int                display_debug_aranges       PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));static unsigned char *    process_abbrev_section      PARAMS ((unsigned char *, unsigned char *));static unsigned long      read_leb128                 PARAMS ((unsigned char *, int *, int));static int                process_extended_line_op    PARAMS ((unsigned char *, int, int));static void               reset_state_machine         PARAMS ((int));static char *             get_TAG_name                PARAMS ((unsigned long));static char *             get_AT_name                 PARAMS ((unsigned long));static char *             get_FORM_name               PARAMS ((unsigned long));static void               free_abbrevs                PARAMS ((void));static void               add_abbrev                  PARAMS ((unsigned long, unsigned long, int));static void               add_abbrev_attr             PARAMS ((unsigned long, unsigned long));static unsigned char *    read_and_display_attr       PARAMS ((unsigned long, unsigned long, unsigned char *, unsigned long));static unsigned char *    display_block               PARAMS ((unsigned char *, unsigned long));static void               decode_location_expression  PARAMS ((unsigned char *, unsigned int));static void		  request_dump                PARAMS ((unsigned int, char));static const char *       get_elf_class               PARAMS ((unsigned char));static const char *       get_data_encoding           PARAMS ((unsigned char));static const char *       get_osabi_name              PARAMS ((unsigned char));static int		  guess_is_rela               PARAMS ((unsigned long));static char * 		  get_note_type		         PARAMS ((unsigned int));static int		  process_note		         PARAMS ((Elf32_Internal_Note *));static int		  process_corefile_note_segment  PARAMS ((FILE *, bfd_vma, bfd_vma));static int		  process_corefile_note_segments PARAMS ((FILE *));static int 		  process_corefile_contents	 PARAMS ((FILE *));typedef int Elf32_Word;#ifndef TRUE#define TRUE     1#define FALSE    0#endif#define UNKNOWN -1#define SECTION_NAME(X) 	(string_table + (X)->sh_name)#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))	/* Reverse order! */#define BYTE_GET(field) 	byte_get (field, sizeof (field))/* If we can support a 64 bit data type then BFD64 should be defined   and sizeof (bfd_vma) == 8.  In this case when translating from an   external 8 byte field to an internal field, we can assume that the   internal field is also 8 bytes wide and so we can extact all the data.   If, however, BFD64 is not defined, then we must assume that the   internal data structure only has 4 byte wide fields that are the   equivalent of the 8 byte wide external counterparts, and so we must   truncate the data.  */#ifdef  BFD64#define BYTE_GET8(field) 	byte_get (field, -8)#else#define BYTE_GET8(field) 	byte_get (field, 8)#endif#define NUM_ELEM(array) 	(sizeof (array) / sizeof ((array)[0]))#define GET_DATA_ALLOC(offset, size, var, type, reason)			\  if (fseek (file, offset, SEEK_SET))					\    {									\      error (_("Unable to seek to start of %s at %x\n"), reason, offset); \      return 0;								\    }									\									\  var = (type) malloc (size);						\									\  if (var == NULL)							\    {									\      error (_("Out of memory allocating %d bytes for %s\n"), size, reason); \      return 0;								\    } 									\ 									\  if (fread (var, size, 1, file) != 1) 					\    { 									\      error (_("Unable to read in %d bytes of %s\n"), size, reason); 	\      free (var); 							\      var = NULL;							\      return 0; 							\    }#define GET_DATA(offset, var, reason) 					\  if (fseek (file, offset, SEEK_SET))					\    { 									\      error (_("Unable to seek to %x for %s\n"), offset, reason);	\      return 0;								\    }									\  else if (fread (& var, sizeof (var), 1, file) != 1)			\    {									\      error (_("Unable to read data at %x for %s\n"), offset, reason);	\      return 0;								\    }#define GET_ELF_SYMBOLS(file, offset, size)			\  (is_32bit_elf ? get_32bit_elf_symbols (file, offset, size)	\   : get_64bit_elf_symbols (file, offset, size))#ifdef ANSI_PROTOTYPESstatic voiderror (const char * message, ...){  va_list args;  fprintf (stderr, _("%s: Error: "), program_name);  va_start (args, message);  vfprintf (stderr, message, args);  va_end (args);  return;}static voidwarn (const char * message, ...){  va_list args;  fprintf (stderr, _("%s: Warning: "), program_name);  va_start (args, message);  vfprintf (stderr, message, args);  va_end (args);  return;}#elsestatic voiderror (va_alist)     va_dcl{  char * message;  va_list args;  fprintf (stderr, _("%s: Error: "), program_name);  va_start (args);  message = va_arg (args, char *);  vfprintf (stderr, message, args);  va_end (args);  return;}static voidwarn (va_alist)     va_dcl{  char * message;  va_list args;  fprintf (stderr, _("%s: Warning: "), program_name);  va_start (args);  message = va_arg (args, char *);  vfprintf (stderr, message, args);  va_end (args);  return;}#endifstatic bfd_vmabyte_get_little_endian (field, size)     unsigned char * field;     int             size;{  switch (size)    {    case 1:      return * field;    case 2:      return  ((unsigned int) (field [0]))	|    (((unsigned int) (field [1])) << 8);    case 8:      /* We want to extract data from an 8 byte wide field and	 place it into a 4 byte wide field.  Since this is a little	 endian source we can juts use the 4 byte extraction code.  */      /* Fall through.  */    case 4:      return  ((unsigned long) (field [0]))	|    (((unsigned long) (field [1])) << 8)	|    (((unsigned long) (field [2])) << 16)	|    (((unsigned long) (field [3])) << 24);#ifdef BFD64    case -8:      /* This is a special case, generated by the BYTE_GET8 macro.	 It means that we are loading an 8 byte value from a field	 in an external structure into an 8 byte value in a field	 in an internal strcuture.  */      return  ((bfd_vma) (field [0]))	|    (((bfd_vma) (field [1])) << 8)	|    (((bfd_vma) (field [2])) << 16)	|    (((bfd_vma) (field [3])) << 24)	|    (((bfd_vma) (field [4])) << 32)	|    (((bfd_vma) (field [5])) << 40)	|    (((bfd_vma) (field [6])) << 48)	|    (((bfd_vma) (field [7])) << 56);#endif    default:      error (_("Unhandled data length: %d\n"), size);      abort ();    }}/* Print a VMA value.  */static voidprint_vma (vma, mode)     bfd_vma vma;     print_mode mode;{#ifdef BFD64  if (is_32bit_elf)#endif    {      switch (mode)	{	case FULL_HEX: printf ("0x"); /* drop through */	case LONG_HEX: printf ("%8.8lx", (unsigned long) vma); break;	case PREFIX_HEX: printf ("0x"); /* drop through */	case HEX: printf ("%lx", (unsigned long) vma); break;	case DEC: printf ("%ld", (unsigned long) vma); break;	case DEC_5: printf ("%5ld", (long) vma); break;	case UNSIGNED: printf ("%lu", (unsigned long) vma); break;	}    }#ifdef BFD64  else    {      switch (mode)	{	case FULL_HEX:	  printf ("0x");	  /* drop through */	  	case LONG_HEX:	  printf_vma (vma);	  break;	  	case PREFIX_HEX:	  printf ("0x");	  /* drop through */	  	case HEX:#if BFD_HOST_64BIT_LONG	  printf ("%lx", vma);#else	  if (_bfd_int64_high (vma))	    printf ("%lx%lx", _bfd_int64_high (vma), _bfd_int64_low (vma));	  else	    printf ("%lx", _bfd_int64_low (vma));#endif	  break;	case DEC:#if BFD_HOST_64BIT_LONG	  printf ("%ld", vma);#else	  if (_bfd_int64_high (vma))	    /* ugg */	    printf ("++%ld", _bfd_int64_low (vma));	  else	    printf ("%ld", _bfd_int64_low (vma));#endif	  	  break;	case DEC_5:#if BFD_HOST_64BIT_LONG	  printf ("%5ld", vma);#else	  if (_bfd_int64_high (vma))	    /* ugg */	    printf ("++%ld", _bfd_int64_low (vma));	  else	    printf ("%5ld", _bfd_int64_low (vma));#endif	  	  break;	  	case UNSIGNED:#if BFD_HOST_64BIT_LONG	  printf ("%lu", vma);#else	  	  if (_bfd_int64_high (vma))	    /* ugg */	    printf ("++%lu", _bfd_int64_low (vma));	  else	    printf ("%lu", _bfd_int64_low (vma));#endif	  break;	}    }#endif}static bfd_vmabyte_get_big_endian (field, size)     unsigned char * field;     int             size;{  switch (size)    {    case 1:      return * field;    case 2:      return ((unsigned int) (field [1])) | (((int) (field [0])) << 8);    case 4:      return ((unsigned long) (field [3]))	|   (((unsigned long) (field [2])) << 8)	|   (((unsigned long) (field [1])) << 16)	|   (((unsigned long) (field [0])) << 24);    case 8:      /* Although we are extracing data from an 8 byte wide field, we	 are returning only 4 bytes of data.  */      return ((unsigned long) (field [7]))	|   (((unsigned long) (field [6])) << 8)	|   (((unsigned long) (field [5])) << 16)	|   (((unsigned long) (field [4])) << 24);#ifdef BFD64    case -8:      /* This is a special case, generated by the BYTE_GET8 macro.	 It means that we are loading an 8 byte value from a field	 in an external structure into an 8 byte value in a field	 in an internal strcuture.  */      return ((bfd_vma) (field [7]))	|   (((bfd_vma) (field [6])) << 8)	|   (((bfd_vma) (field [5])) << 16)	|   (((bfd_vma) (field [4])) << 24)	|   (((bfd_vma) (field [3])) << 32)	|   (((bfd_vma) (field [2])) << 40)	|   (((bfd_vma) (field [1])) << 48)	|   (((bfd_vma) (field [0])) << 56);#endif    default:      error (_("Unhandled data length: %d\n"), size);      abort ();    }}/* Guess the relocation sized based on the sized commonly used by the specific machine.  */static intguess_is_rela (e_machine)     unsigned long e_machine;{  switch (e_machine)    {      /* Targets that use REL relocations.  */    case EM_ARM:    case EM_386:    case EM_486:    case EM_960:    case EM_CYGNUS_M32R:    case EM_CYGNUS_D10V:    case EM_MIPS:    case EM_MIPS_RS4_BE:      return FALSE;      /* Targets that use RELA relocations.  */    case EM_68K:    case EM_SPARC32PLUS:    case EM_SPARCV9:    case EM_SPARC:    case EM_PPC:    case EM_CYGNUS_V850:    case EM_CYGNUS_D30V:    case EM_CYGNUS_MN10200:    case EM_CYGNUS_MN10300:    case EM_CYGNUS_FR30:    case EM_SH:    case EM_ALPHA:    case EM_MCORE:      return TRUE;    case EM_MMA:    case EM_PCP:    case EM_NCPU:    case EM_NDR1:    case EM_STARCORE:    case EM_ME16:    case EM_ST100:    case EM_TINYJ:    case EM_FX66:    case EM_ST9PLUS:    case EM_ST7:    case EM_68HC16:    case EM_68HC11:    case EM_68HC08:    case EM_68HC05:    case EM_SVX:    case EM_ST19:    case EM_VAX:    default:      warn (_("Don't know about relocations on this machine architecture\n"));      return FALSE;    }}/* Display the contents of the relocation data found at the specified offset.  */static intdump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)     FILE *             file;     unsigned long      rel_offset;     unsigned long      rel_size;     Elf_Internal_Sym * symtab;     unsigned long      nsyms;     char *             strtab;     int                is_rela;{  unsigned int        i;  Elf_Internal_Rel *  rels;  Elf_Internal_Rela * relas;  if (is_rela == UNKNOWN)    is_rela = guess_is_rela (elf_header.e_machine);  if (is_rela)    {      if (is_32bit_elf)	{	  Elf32_External_Rela * erelas;	  GET_DATA_ALLOC (rel_offset, rel_size, erelas,			  Elf32_External_Rela *, "relocs");	  rel_size = rel_size / sizeof (Elf32_External_Rela);	  relas = (Elf_Internal_Rela *)	    malloc (rel_size * sizeof (Elf_Internal_Rela));	  if (relas == NULL)	    {	      error(_("out of memory parsing relocs"));	      return 0;	    }	  for (i = 0; i < rel_size; i++)	    {	      relas[i].r_offset = BYTE_GET (erelas[i].r_offset);	      relas[i].r_info   = BYTE_GET (erelas[i].r_info);	      relas[i].r_addend = BYTE_GET (erelas[i].r_addend);	    }	  free (erelas);	  rels = (Elf_Internal_Rel *) relas;	}      else	{	  Elf64_External_Rela * erelas;	  GET_DATA_ALLOC (rel_offset, rel_size, erelas,			  Elf64_External_Rela *, "relocs");	  rel_size = rel_size / sizeof (Elf64_External_Rela);	  relas = (Elf_Internal_Rela *)	    malloc (rel_size * sizeof (Elf_Internal_Rela));	  if (relas == NULL)	    {	      error(_("out of memory parsing relocs"));	      return 0;	    }	  for (i = 0; i < rel_size; i++)	    {	      relas[i].r_offset = BYTE_GET8 (erelas[i].r_offset);	      relas[i].r_info   = BYTE_GET8 (erelas[i].r_info);	      relas[i].r_addend = BYTE_GET8 (erelas[i].r_addend);	    }	  free (erelas);	  rels = (Elf_Internal_Rel *) relas;	}    }  else    {      if (is_32bit_elf)	{	  Elf32_External_Rel * erels;	  GET_DATA_ALLOC (rel_offset, rel_size, erels,			  Elf32_External_Rel *, "relocs");	  rel_size = rel_size / sizeof (Elf32_External_Rel);	  rels = (Elf_Internal_Rel *)	    malloc (rel_size * sizeof (Elf_Internal_Rel));	  if (rels == NULL)	    {	      error(_("out of memory parsing relocs"));	      return 0;	    }	  for (i = 0; i < rel_size; i++)	    {	      rels[i].r_offset = BYTE_GET (erels[i].r_offset);	      rels[i].r_info   = BYTE_GET (erels[i].r_info);	    }	  free (erels);	  relas = (Elf_Internal_Rela *) rels;	}      else	{	  Elf64_External_Rel * erels;	  GET_DATA_ALLOC (rel_offset, rel_size, erels,			  Elf64_External_Rel *, "relocs");	  rel_size = rel_size / sizeof (Elf64_External_Rel);	  rels = (Elf_Internal_Rel *)	    malloc (rel_size * sizeof (Elf_Internal_Rel));	  if (rels == NULL)	    {	      error(_("out of memory parsing relocs"));	      return 0;	    }	  for (i = 0; i < rel_size; i++)	    {	      rels[i].r_offset = BYTE_GET8 (erels[i].r_offset);	      rels[i].r_info   = BYTE_GET8 (erels[i].r_info);	    }	  free (erels);	  relas = (Elf_Internal_Rela *) rels;	}    }  if (is_rela)    printf      (_("  Offset    Info  Type            Symbol's Value  Symbol's Name          Addend\n"));  else    printf      (_("  Offset    Info  Type            Symbol's Value  Symbol's Name\n"));  for (i = 0; i < rel_size; i++)    {      const char * rtype;      bfd_vma      offset;      bfd_vma      info;      bfd_vma      symtab_index;      bfd_vma      type;      if (is_rela)	{	  offset = relas [i].r_offset;	  info   = relas [i].r_info;	}      else	{	  offset = rels [i].r_offset;	  info   = rels [i].r_info;	}      if (is_32bit_elf)	{	  type         = ELF32_R_TYPE (info);	  symtab_index = ELF32_R_SYM  (info);	}      else	{	  if (elf_header.e_machine == EM_SPARCV9)	    type       = ELF64_R_TYPE_ID (info);	  else	    type       = ELF64_R_TYPE (info);	  /* The #ifdef BFD64 below is to prevent a compile time warning.	     We know that if we do not have a 64 bit data type that we	     will never execute this code anyway.  */#ifdef BFD64	  symtab_index = ELF64_R_SYM  (info);#endif	}#ifdef _bfd_int64_low      printf ("  %8.8lx  %5.5lx ", _bfd_int64_low (offset), _bfd_int64_low (info));#else      printf ("  %8.8lx  %5.5lx ", offset, info);#endif      switch (elf_header.e_machine)	{	default:	  rtype = NULL;	  break;	case EM_CYGNUS_M32R:	  rtype = elf_m32r_reloc_type (type);	  break;	case EM_386:	case EM_486:	  rtype = elf_i386_reloc_type (type);	  break;	case EM_68K:	  rtype = elf_m68k_reloc_type (type);	  break;	case EM_960:	  rtype = elf_i960_reloc_type (type);	  break;	case EM_AVR:	  rtype = elf_avr_reloc_type (type);	  break;	case EM_OLD_SPARCV9:	case EM_SPARC32PLUS:	case EM_SPARCV9:	case EM_SPARC:	  rtype = elf_sparc_reloc_type (type);	  break;	case EM_CYGNUS_V850:	  rtype = v850_reloc_type (type);	  break;	case EM_CYGNUS_D10V:	  rtype = elf_d10v_reloc_type (type);	  break;	case EM_CYGNUS_D30V:	  rtype = elf_d30v_reloc_type (type);	  break;	case EM_SH:	  rtype = elf_sh_reloc_type (type);	  break;	case EM_CYGNUS_MN10300:	  rtype = elf_mn10300_reloc_type (type);	  break;	case EM_CYGNUS_MN10200:	  rtype = elf_mn10200_reloc_type (type);	  break;	case EM_CYGNUS_FR30:	  rtype = elf_fr30_reloc_type (type);	  break;	case EM_MCORE:	  rtype = elf_mcore_reloc_type (type);	  break;	case EM_PPC:	  rtype = elf_ppc_reloc_type (type);	  break;	case EM_MIPS:	case EM_MIPS_RS4_BE:	  rtype = elf_mips_reloc_type (type);	  break;	case EM_ALPHA:	  rtype = elf_alpha_reloc_type (type);	  break;	case EM_ARM:	  rtype = elf_arm_reloc_type (type);	  break;	case EM_CYGNUS_ARC:	  rtype = elf_arc_reloc_type (type);	  break;	case EM_PARISC:	  rtype = elf_hppa_reloc_type (type);	  break;	case EM_PJ:	  rtype = elf_pj_reloc_type (type);	  break;	}      if (rtype == NULL)#ifdef _bfd_int64_low	printf (_("unrecognised: %-7lx"), _bfd_int64_low (type));#else	printf (_("unrecognised: %-7lx"), type);#endif      else	printf ("%-21.21s", rtype);      if (symtab_index)	{	  if (symtab != NULL)	    {	      if (symtab_index >= nsyms)		printf (" bad symbol index: %08lx", (unsigned long) symtab_index);	      else		{		  Elf_Internal_Sym * psym;		  psym = symtab + symtab_index;		  printf (" ");		  print_vma (psym->st_value, LONG_HEX);		  printf ("  ");		  if (psym->st_name == 0)		    printf ("%-25.25s",			    SECTION_NAME (section_headers + psym->st_shndx));		  else if (strtab == NULL)		    printf (_("<string table index %3ld>"), psym->st_name);		  else		    printf ("%-25.25s", strtab + psym->st_name);		  if (is_rela)		    printf (" + %lx", (unsigned long) relas [i].r_addend);		}	    }	}      else if (is_rela)	{	  printf ("%*c", is_32bit_elf ? 34 : 26, ' ');	  print_vma (relas[i].r_addend, LONG_HEX);	}      if (elf_header.e_machine == EM_SPARCV9	  && !strcmp (rtype, "R_SPARC_OLO10"))	printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (info));      putchar ('\n');    }  free (relas);  return 1;}static const char *get_mips_dynamic_type (type)     unsigned long type;{  switch (type)    {    case DT_MIPS_RLD_VERSION: return "MIPS_RLD_VERSION";    case DT_MIPS_TIME_STAMP: return "MIPS_TIME_STAMP";    case DT_MIPS_ICHECKSUM: return "MIPS_ICHECKSUM";    case DT_MIPS_IVERSION: return "MIPS_IVERSION";    case DT_MIPS_FLAGS: return "MIPS_FLAGS";    case DT_MIPS_BASE_ADDRESS: return "MIPS_BASE_ADDRESS";    case DT_MIPS_MSYM: return "MIPS_MSYM";    case DT_MIPS_CONFLICT: return "MIPS_CONFLICT";    case DT_MIPS_LIBLIST: return "MIPS_LIBLIST";    case DT_MIPS_LOCAL_GOTNO: return "MIPS_LOCAL_GOTNO";    case DT_MIPS_CONFLICTNO: return "MIPS_CONFLICTNO";    case DT_MIPS_LIBLISTNO: return "MIPS_LIBLISTNO";    case DT_MIPS_SYMTABNO: return "MIPS_SYMTABNO";    case DT_MIPS_UNREFEXTNO: return "MIPS_UNREFEXTNO";    case DT_MIPS_GOTSYM: return "MIPS_GOTSYM";    case DT_MIPS_HIPAGENO: return "MIPS_HIPAGENO";    case DT_MIPS_RLD_MAP: return "MIPS_RLD_MAP";    case DT_MIPS_DELTA_CLASS: return "MIPS_DELTA_CLASS";    case DT_MIPS_DELTA_CLASS_NO: return "MIPS_DELTA_CLASS_NO";    case DT_MIPS_DELTA_INSTANCE: return "MIPS_DELTA_INSTANCE";    case DT_MIPS_DELTA_INSTANCE_NO: return "MIPS_DELTA_INSTANCE_NO";    case DT_MIPS_DELTA_RELOC: return "MIPS_DELTA_RELOC";    case DT_MIPS_DELTA_RELOC_NO: return "MIPS_DELTA_RELOC_NO";    case DT_MIPS_DELTA_SYM: return "MIPS_DELTA_SYM";    case DT_MIPS_DELTA_SYM_NO: return "MIPS_DELTA_SYM_NO";    case DT_MIPS_DELTA_CLASSSYM: return "MIPS_DELTA_CLASSSYM";    case DT_MIPS_DELTA_CLASSSYM_NO: return "MIPS_DELTA_CLASSSYM_NO";    case DT_MIPS_CXX_FLAGS: return "MIPS_CXX_FLAGS";    case DT_MIPS_PIXIE_INIT: return "MIPS_PIXIE_INIT";    case DT_MIPS_SYMBOL_LIB: return "MIPS_SYMBOL_LIB";    case DT_MIPS_LOCALPAGE_GOTIDX: return "MIPS_LOCALPAGE_GOTIDX";    case DT_MIPS_LOCAL_GOTIDX: return "MIPS_LOCAL_GOTIDX";    case DT_MIPS_HIDDEN_GOTIDX: return "MIPS_HIDDEN_GOTIDX";    case DT_MIPS_PROTECTED_GOTIDX: return "MIPS_PROTECTED_GOTIDX";    case DT_MIPS_OPTIONS: return "MIPS_OPTIONS";    case DT_MIPS_INTERFACE: return "MIPS_INTERFACE";    case DT_MIPS_DYNSTR_ALIGN: return "MIPS_DYNSTR_ALIGN";    case DT_MIPS_INTERFACE_SIZE: return "MIPS_INTERFACE_SIZE";    case DT_MIPS_RLD_TEXT_RESOLVE_ADDR: return "MIPS_RLD_TEXT_RESOLVE_ADDR";    case DT_MIPS_PERF_SUFFIX: return "MIPS_PERF_SUFFIX";    case DT_MIPS_COMPACT_SIZE: return "MIPS_COMPACT_SIZE";    case DT_MIPS_GP_VALUE: return "MIPS_GP_VALUE";    case DT_MIPS_AUX_DYNAMIC: return "MIPS_AUX_DYNAMIC";    default:      return NULL;    }}static const char *get_sparc64_dynamic_type (type)     unsigned long type;{  switch (type)    {    case DT_SPARC_REGISTER: return "SPARC_REGISTER";    default:      return NULL;    }}static const char *get_parisc_dynamic_type (type)     unsigned long type;{  switch (type)    {    case DT_HP_LOAD_MAP:	return "HP_LOAD_MAP";    case DT_HP_DLD_FLAGS:	return "HP_DLD_FLAGS";    case DT_HP_DLD_HOOK:	return "HP_DLD_HOOK";    case DT_HP_UX10_INIT:	return "HP_UX10_INIT";    case DT_HP_UX10_INITSZ:	return "HP_UX10_INITSZ";    case DT_HP_PREINIT:		return "HP_PREINIT";    case DT_HP_PREINITSZ:	return "HP_PREINITSZ";    case DT_HP_NEEDED:		return "HP_NEEDED";    case DT_HP_TIME_STAMP:	return "HP_TIME_STAMP";    case DT_HP_CHECKSUM:	return "HP_CHECKSUM";    case DT_HP_GST_SIZE:	return "HP_GST_SIZE";    case DT_HP_GST_VERSION:	return "HP_GST_VERSION";    case DT_HP_GST_HASHVAL:	return "HP_GST_HASHVAL";    default:      return NULL;    }}static const char *get_dynamic_type (type)     unsigned long type;{  static char buff [32];  switch (type)    {    case DT_NULL:	return "NULL";    case DT_NEEDED:	return "NEEDED";    case DT_PLTRELSZ:	return "PLTRELSZ";    case DT_PLTGOT:	return "PLTGOT";    case DT_HASH:	return "HASH";    case DT_STRTAB:	return "STRTAB";    case DT_SYMTAB:	return "SYMTAB";    case DT_RELA:	return "RELA";    case DT_RELASZ:	return "RELASZ";    case DT_RELAENT:	return "RELAENT";    case DT_STRSZ:	return "STRSZ";    case DT_SYMENT:	return "SYMENT";    case DT_INIT:	return "INIT";    case DT_FINI:	return "FINI";    case DT_SONAME:	return "SONAME";    case DT_RPATH:	return "RPATH";    case DT_SYMBOLIC:	return "SYMBOLIC";    case DT_REL:	return "REL";    case DT_RELSZ:	return "RELSZ";    case DT_RELENT:	return "RELENT";    case DT_PLTREL:	return "PLTREL";    case DT_DEBUG:	return "DEBUG";    case DT_TEXTREL:	return "TEXTREL";    case DT_JMPREL:	return "JMPREL";    case DT_BIND_NOW:   return "BIND_NOW";    case DT_INIT_ARRAY: return "INIT_ARRAY";    case DT_FINI_ARRAY: return "FINI_ARRAY";    case DT_INIT_ARRAYSZ: return "INIT_ARRAYSZ";    case DT_FINI_ARRAYSZ: return "FINI_ARRAYSZ";    case DT_RUNPATH:    return "RUNPATH";    case DT_FLAGS:      return "FLAGS";    case DT_PREINIT_ARRAY: return "PREINIT_ARRAY";    case DT_PREINIT_ARRAYSZ: return "PREINIT_ARRAYSZ";    case DT_PLTPADSZ:	return "PLTPADSZ";    case DT_MOVEENT:	return "MOVEENT";    case DT_MOVESZ:	return "MOVESZ";    case DT_FEATURE_1:	return "FEATURE_1";    case DT_POSFLAG_1:	return "POSFLAG_1";    case DT_SYMINSZ:	return "SYMINSZ";    case DT_SYMINENT:	return "SYMINENT"; /* aka VALRNGHI */    case DT_ADDRRNGLO:  return "ADDRRNGLO";    case DT_SYMINFO:	return "SYMINFO"; /* aka ADDRRNGHI */    case DT_VERSYM:	return "VERSYM";    case DT_RELACOUNT:	return "RELACOUNT";    case DT_RELCOUNT:	return "RELCOUNT";    case DT_FLAGS_1:	return "FLAGS_1";    case DT_VERDEF:	return "VERDEF";    case DT_VERDEFNUM:	return "VERDEFNUM";    case DT_VERNEED:	return "VERNEED";    case DT_VERNEEDNUM:	return "VERNEEDNUM";    case DT_AUXILIARY:	return "AUXILARY";    case DT_USED:	return "USED";    case DT_FILTER:	return "FILTER";    default:      if ((type >= DT_LOPROC) && (type <= DT_HIPROC))	{	  const char * result;	  switch (elf_header.e_machine)	    {	    case EM_MIPS:	    case EM_MIPS_RS4_BE:	      result = get_mips_dynamic_type (type);	      break;	    case EM_SPARCV9:	      result = get_sparc64_dynamic_type (type);	      break;	    default:	      result = NULL;	      break;	    }	  if (result != NULL)	    return result;	  sprintf (buff, _("Processor Specific: %lx"), type);	}      else if ((type >= DT_LOOS) && (type <= DT_HIOS))	{	  const char * result;	  switch (elf_header.e_machine)	    {	    case EM_PARISC:	      result = get_parisc_dynamic_type (type);	      break;	    default:	      result = NULL;	      break;	    }	  if (result != NULL)	    return result;	  sprintf (buff, _("Operating System specific: %lx"), type);	}      else	sprintf (buff, _("<unknown>: %lx"), type);      return buff;    }}static char *get_file_type (e_type)     unsigned e_type;{  static char buff [32];  switch (e_type)    {    case ET_NONE:	return _("NONE (None)");    case ET_REL:	return _("REL (Relocatable file)");    case ET_EXEC:       return _("EXEC (Executable file)");    case ET_DYN:        return _("DYN (Shared object file)");    case ET_CORE:       return _("CORE (Core file)");    default:      if ((e_type >= ET_LOPROC) && (e_type <= ET_HIPROC))	sprintf (buff, _("Processor Specific: (%x)"), e_type);      else if ((e_type >= ET_LOOS) && (e_type <= ET_HIOS))	sprintf (buff, _("OS Specific: (%x)"), e_type);      else	sprintf (buff, _("<unknown>: %x"), e_type);      return buff;    }}static char *get_machine_name (e_machine)     unsigned e_machine;{  static char buff [64]; /* XXX */  switch (e_machine)    {    case EM_NONE:        	return _("None");    case EM_M32:         	return "WE32100";    case EM_SPARC:       	return "Sparc";    case EM_386:         	return "Intel 80386";    case EM_68K:         	return "MC68000";    case EM_88K:         	return "MC88000";    case EM_486:         	return "Intel 80486";    case EM_860:         	return "Intel 80860";    case EM_MIPS:        	return "MIPS R3000";    case EM_S370:        	return "IBM System/370";    case EM_MIPS_RS4_BE: 	return "MIPS R4000 big-endian";    case EM_OLD_SPARCV9:	return "Sparc v9 (old)";    case EM_PARISC:      	return "HPPA";    case EM_PPC_OLD:		return "Power PC (old)";    case EM_SPARC32PLUS: 	return "Sparc v8+" ;    case EM_960:         	return "Intel 90860";    case EM_PPC:         	return "PowerPC";    case EM_V800:         	return "NEC V800";    case EM_FR20:         	return "Fujitsu FR20";    case EM_RH32:         	return "TRW RH32";    case EM_MCORE:	        return "MCORE";    case EM_ARM:	 	return "ARM";    case EM_OLD_ALPHA:	 	return "Digital Alpha (old)";    case EM_SH:		 	return "Hitachi SH";    case EM_SPARCV9:     	return "Sparc v9";    case EM_TRICORE:    	return "Siemens Tricore";    case EM_ARC:		return "Argonaut RISC Core";    case EM_H8_300:		return "Hitachi H8/300";    case EM_H8_300H:		return "Hitachi H8/300H";    case EM_H8S:		return "Hitachi H8S";    case EM_H8_500:		return "Hitachi H8/500";    case EM_IA_64:		return "Intel IA-64";    case EM_MIPS_X:		return "Stanford MIPS-X";    case EM_COLDFIRE:		return "Motorola Coldfire";    case EM_68HC12:		return "Motorola M68HC12";    case EM_ALPHA:       	return "Alpha";    case EM_CYGNUS_D10V:        return "d10v";    case EM_CYGNUS_D30V:        return "d30v";    case EM_CYGNUS_ARC:		return "Arc";    case EM_CYGNUS_M32R:	return "Mitsubishi M32r";    case EM_CYGNUS_V850:	return "NEC v850";    case EM_CYGNUS_MN10300:	return "mn10300";    case EM_CYGNUS_MN10200:	return "mn10200";    case EM_CYGNUS_FR30:	return "Fujitsu FR30";    case EM_PJ:                 return "picoJava";    case EM_MMA:      		return "Fujitsu Multimedia Accelerator";    case EM_PCP:      		return "Siemens PCP";    case EM_NCPU:     		return "Sony nCPU embedded RISC processor";    case EM_NDR1:     		return "Denso NDR1 microprocesspr";    case EM_STARCORE: 		return "Motorola Star*Core processor";    case EM_ME16:     		return "Toyota ME16 processor";    case EM_ST100:    		return "STMicroelectronics ST100 processor";    case EM_TINYJ:    		return "Advanced Logic Corp. TinyJ embedded processor";    case EM_FX66:     		return "Siemens FX66 microcontroller";    case EM_ST9PLUS:  		return "STMicroelectronics ST9+ 8/16 bit microcontroller";    case EM_ST7:      		return "STMicroelectronics ST7 8-bit microcontroller";    case EM_68HC16:   		return "Motorola MC68HC16 Microcontroller";    case EM_68HC11:   		return "Motorola MC68HC11 Microcontroller";    case EM_68HC08:   		return "Motorola MC68HC08 Microcontroller";    case EM_68HC05:   		return "Motorola MC68HC05 Microcontroller";    case EM_SVX:      		return "Silicon Graphics SVx";    case EM_ST19:     		return "STMicroelectronics ST19 8-bit microcontroller";    case EM_VAX:      		return "Digital VAX";    default:      sprintf (buff, _("<unknown>: %x"), e_machine);      return buff;    }}static char *get_machine_flags (e_flags, e_machine)     unsigned e_flags;     unsigned e_machine;{  static char buf [1024];  buf[0] = '\0';    if (e_flags)    {      switch (e_machine)	{	default:	  break;        case EM_68K:          if (e_flags & EF_CPU32)            strcat (buf, ", cpu32");          break;	case EM_PPC:	  if (e_flags & EF_PPC_EMB)	    strcat (buf, ", emb");	  if (e_flags & EF_PPC_RELOCATABLE)	    strcat (buf, ", relocatable");	  if (e_flags & EF_PPC_RELOCATABLE_LIB)	    strcat (buf, ", relocatable-lib");	  break;	case EM_CYGNUS_V850:	  switch (e_flags & EF_V850_ARCH)	    {	    case E_V850E_ARCH:	      strcat (buf, ", v850e");	      break;	    case E_V850EA_ARCH:	      strcat (buf, ", v850ea");	      break;	    case E_V850_ARCH:	      strcat (buf, ", v850");	      break;	    default:	      strcat (buf, ", unknown v850 architecture variant");	      break;	    }	  break;	case EM_CYGNUS_M32R:	  if ((e_flags & EF_M32R_ARCH) == E_M32R_ARCH)	    strcat (buf, ", m32r");	  break;	case EM_MIPS:	case EM_MIPS_RS4_BE:	  if (e_flags & EF_MIPS_NOREORDER)	    strcat (buf, ", noreorder");	  if (e_flags & EF_MIPS_PIC)	    strcat (buf, ", pic");	  if (e_flags & EF_MIPS_CPIC)	    strcat (buf, ", cpic");	  if (e_flags & EF_MIPS_ABI2)	    strcat (buf, ", abi2");	  if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1)	    strcat (buf, ", mips1");	  if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2)	    strcat (buf, ", mips2");	  if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3)	    strcat (buf, ", mips3");	  if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4)	    strcat (buf, ", mips4");	  break;	case EM_SPARCV9:	  if (e_flags & EF_SPARC_32PLUS)	    strcat (buf, ", v8+");	  if (e_flags & EF_SPARC_SUN_US1)	    strcat (buf, ", ultrasparcI");	  if (e_flags & EF_SPARC_SUN_US3)	    strcat (buf, ", ultrasparcIII");	  if (e_flags & EF_SPARC_HAL_R1)	    strcat (buf, ", halr1");	  if (e_flags & EF_SPARC_LEDATA)	    strcat (buf, ", ledata");	  if ((e_flags & EF_SPARCV9_MM) == EF_SPARCV9_TSO)	    strcat (buf, ", tso");	  if ((e_flags & EF_SPARCV9_MM) == EF_SPARCV9_PSO)	    strcat (buf, ", pso");	  if ((e_flags & EF_SPARCV9_MM) == EF_SPARCV9_RMO)	    strcat (buf, ", rmo");	  break;	case EM_PARISC:	  switch (e_flags & EF_PARISC_ARCH)	    {	    case EFA_PARISC_1_0:	      strcpy (buf, ", PA-RISC 1.0");	      break;	    case EFA_PARISC_1_1:	      strcpy (buf, ", PA-RISC 1.1");	      break;	    case EFA_PARISC_2_0:	      strcpy (buf, ", PA-RISC 2.0");	      break;	    default:	      break;	    }	  if (e_flags & EF_PARISC_TRAPNIL)	    strcat (buf, ", trapnil");	  if (e_flags & EF_PARISC_EXT)	    strcat (buf, ", ext");	  if (e_flags & EF_PARISC_LSB)	    strcat (buf, ", lsb");	  if (e_flags & EF_PARISC_WIDE)	    strcat (buf, ", wide");	  if (e_flags & EF_PARISC_NO_KABP)	    strcat (buf, ", no kabp");	  if (e_flags & EF_PARISC_LAZYSWAP)	    strcat (buf, ", lazyswap");	  break;	  	case EM_PJ:	  if ((e_flags & EF_PICOJAVA_NEWCALLS) == EF_PICOJAVA_NEWCALLS)	    strcat (buf, ", new calling convention");	  if ((e_flags & EF_PICOJAVA_GNUCALLS) == EF_PICOJAVA_GNUCALLS)	    strcat (buf, ", gnu calling convention");	  break;	}    }  return buf;}static const char *get_mips_segment_type (type)     unsigned long type;{  switch (type)    {    case PT_MIPS_REGINFO:      return "REGINFO";    case PT_MIPS_RTPROC:      return "RTPROC";    case PT_MIPS_OPTIONS:      return "OPTIONS";    default:      break;    }  return NULL;}static const char *get_parisc_segment_type (type)     unsigned long type;{  switch (type)    {    case PT_HP_TLS:		return "HP_TLS";    case PT_HP_CORE_NONE:	return "HP_CORE_NONE";    case PT_HP_CORE_VERSION:	return "HP_CORE_VERSION";    case PT_HP_CORE_KERNEL:	return "HP_CORE_KERNEL";    case PT_HP_CORE_COMM:	return "HP_CORE_COMM";    case PT_HP_CORE_PROC:	return "HP_CORE_PROC";    case PT_HP_CORE_LOADABLE:	return "HP_CORE_LOADABLE";    case PT_HP_CORE_STACK:	return "HP_CORE_STACK";    case PT_HP_CORE_SHM:	return "HP_CORE_SHM";    case PT_HP_CORE_MMF:	return "HP_CORE_MMF";    case PT_HP_PARALLEL:	return "HP_PARALLEL";    case PT_HP_FASTBIND:	return "HP_FASTBIND";    case PT_PARISC_ARCHEXT:	return "PARISC_ARCHEXT";    case PT_PARISC_UNWIND:	return "PARISC_UNWIND";    default:      break;    }  return NULL;}static const char *get_segment_type (p_type)     unsigned long p_type;{  static char buff [32];  switch (p_type)    {    case PT_NULL:       return "NULL";    case PT_LOAD:       return "LOAD";    case PT_DYNAMIC:	return "DYNAMIC";    case PT_INTERP:     return "INTERP";    case PT_NOTE:       return "NOTE";    case PT_SHLIB:      return "SHLIB";    case PT_PHDR:       return "PHDR";    default:      if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))	{	  const char * result;	  switch (elf_header.e_machine)	    {	    case EM_MIPS:	    case EM_MIPS_RS4_BE:	      result = get_mips_segment_type (p_type);	      break;	    case EM_PARISC:	      result = get_parisc_segment_type (p_type);	      break;	    default:	      result = NULL;	      break;	    }	  if (result != NULL)	    return result;	  sprintf (buff, "LOPROC+%lx", p_type - PT_LOPROC);	}      else if ((p_type >= PT_LOOS) && (p_type <= PT_HIOS))	{	  const char * result;	  switch (elf_header.e_machine)	    {	    case EM_PARISC:	      result = get_parisc_segment_type (p_type);	      break;	    default:	      result = NULL;	      break;	    }	  if (result != NULL)	    return result;	  sprintf (buff, "LOOS+%lx", p_type - PT_LOOS);	}      else	sprintf (buff, _("<unknown>: %lx"), p_type);      return buff;    }}static const char *get_mips_section_type_name (sh_type)     unsigned int sh_type;{  switch (sh_type)    {    case SHT_MIPS_LIBLIST:       return "MIPS_LIBLIST";    case SHT_MIPS_MSYM:          return "MIPS_MSYM";    case SHT_MIPS_CONFLICT:      return "MIPS_CONFLICT";    case SHT_MIPS_GPTAB:         return "MIPS_GPTAB";    case SHT_MIPS_UCODE:         return "MIPS_UCODE";    case SHT_MIPS_DEBUG:         return "MIPS_DEBUG";    case SHT_MIPS_REGINFO:       return "MIPS_REGINFO";    case SHT_MIPS_PACKAGE:       return "MIPS_PACKAGE";    case SHT_MIPS_PACKSYM:       return "MIPS_PACKSYM";    case SHT_MIPS_RELD:          return "MIPS_RELD";    case SHT_MIPS_IFACE:         return "MIPS_IFACE";    case SHT_MIPS_CONTENT:       return "MIPS_CONTENT";    case SHT_MIPS_OPTIONS:       return "MIPS_OPTIONS";    case SHT_MIPS_SHDR:          return "MIPS_SHDR";    case SHT_MIPS_FDESC:         return "MIPS_FDESC";    case SHT_MIPS_EXTSYM:        return "MIPS_EXTSYM";    case SHT_MIPS_DENSE:         return "MIPS_DENSE";    case SHT_MIPS_PDESC:         return "MIPS_PDESC";    case SHT_MIPS_LOCSYM:        return "MIPS_LOCSYM";    case SHT_MIPS_AUXSYM:        return "MIPS_AUXSYM";    case SHT_MIPS_OPTSYM:        return "MIPS_OPTSYM";    case SHT_MIPS_LOCSTR:        return "MIPS_LOCSTR";    case SHT_MIPS_LINE:          return "MIPS_LINE";    case SHT_MIPS_RFDESC:        return "MIPS_RFDESC";    case SHT_MIPS_DELTASYM:      return "MIPS_DELTASYM";    case SHT_MIPS_DELTAINST:     return "MIPS_DELTAINST";    case SHT_MIPS_DELTACLASS:    return "MIPS_DELTACLASS";    case SHT_MIPS_DWARF:         return "MIPS_DWARF";    case SHT_MIPS_DELTADECL:     return "MIPS_DELTADECL";    case SHT_MIPS_SYMBOL_LIB:    return "MIPS_SYMBOL_LIB";    case SHT_MIPS_EVENTS:        return "MIPS_EVENTS";    case SHT_MIPS_TRANSLATE:     return "MIPS_TRANSLATE";    case SHT_MIPS_PIXIE:         return "MIPS_PIXIE";    case SHT_MIPS_XLATE:         return "MIPS_XLATE";    case SHT_MIPS_XLATE_DEBUG:   return "MIPS_XLATE_DEBUG";    case SHT_MIPS_WHIRL:         return "MIPS_WHIRL";    case SHT_MIPS_EH_REGION:     return "MIPS_EH_REGION";    case SHT_MIPS_XLATE_OLD:     return "MIPS_XLATE_OLD";    case SHT_MIPS_PDR_EXCEPTION: return "MIPS_PDR_EXCEPTION";    default:      break;    }  return NULL;}static const char *get_parisc_section_type_name (sh_type)     unsigned int sh_type;{  switch (sh_type)    {    case SHT_PARISC_EXT:	return "PARISC_EXT";    case SHT_PARISC_UNWIND:	return "PARISC_UNWIND";    case SHT_PARISC_DOC:	return "PARISC_DOC";    default:      break;    }  return NULL;}static const char *get_section_type_name (sh_type)     unsigned int sh_type;{  static char buff [32];  switch (sh_type)    {    case SHT_NULL:		return "NULL";    case SHT_PROGBITS:		return "PROGBITS";    case SHT_SYMTAB:		return "SYMTAB";    case SHT_STRTAB:		return "STRTAB";    case SHT_RELA:		return "RELA";    case SHT_HASH:		return "HASH";    case SHT_DYNAMIC:		return "DYNAMIC";    case SHT_NOTE:		return "NOTE";    case SHT_NOBITS:		return "NOBITS";    case SHT_REL:		return "REL";    case SHT_SHLIB:		return "SHLIB";    case SHT_DYNSYM:		return "DYNSYM";    case SHT_INIT_ARRAY:	return "INIT_ARRAY";    case SHT_FINI_ARRAY:	return "FINI_ARRAY";    case SHT_PREINIT_ARRAY:	return "PREINIT_ARRAY";    case SHT_GNU_verdef:	return "VERDEF";    case SHT_GNU_verneed:	return "VERNEED";    case SHT_GNU_versym:	return "VERSYM";    case 0x6ffffff0:	        return "VERSYM";    case 0x6ffffffc:	        return "VERDEF";    case 0x7ffffffd:		return "AUXILIARY";    case 0x7fffffff:		return "FILTER";    default:      if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC))	{	  const char * result;	  switch (elf_header.e_machine)	    {	    case EM_MIPS:	    case EM_MIPS_RS4_BE:	      result = get_mips_section_type_name (sh_type);	      break;	    case EM_PARISC:	      result = get_parisc_section_type_name (sh_type);	      break;	    default:	      result = NULL;	      break;	    }	  if (result != NULL)	    return result;	  sprintf (buff, "SHT_LOPROC+%x", sh_type - SHT_LOPROC);	}      else if ((sh_type >= SHT_LOOS) && (sh_type <= SHT_HIOS))	sprintf (buff, "SHT_LOOS+%x", sh_type - SHT_LOOS);      else if ((sh_type >= SHT_LOUSER) && (sh_type <= SHT_HIUSER))	sprintf (buff, "SHT_LOUSER+%x", sh_type - SHT_LOUSER);      else	sprintf (buff, _("<unknown>: %x"), sh_type);      return buff;    }}struct option options [] ={  {"all",              no_argument, 0, 'a'},  {"file-header",      no_argument, 0, 'h'},  {"program-headers",  no_argument, 0, 'l'},  {"headers",          no_argument, 0, 'e'},  {"histogram",        no_argument, 0, 'I'},  {"segments",         no_argument, 0, 'l'},  {"sections",         no_argument, 0, 'S'},  {"section-headers",  no_argument, 0, 'S'},  {"symbols",          no_argument, 0, 's'},  {"syms",             no_argument, 0, 's'},  {"relocs",           no_argument, 0, 'r'},  {"notes",            no_argument, 0, 'n'},  {"dynamic",          no_argument, 0, 'd'},  {"arch-specific",    no_argument, 0, 'A'},  {"version-info",     no_argument, 0, 'V'},  {"use-dynamic",      no_argument, 0, 'D'},  {"hex-dump",         required_argument, 0, 'x'},  {"debug-dump",       optional_argument, 0, 'w'},#ifdef SUPPORT_DISASSEMBLY  {"instruction-dump", required_argument, 0, 'i'},#endif  {"version",          no_argument, 0, 'v'},  {"help",             no_argument, 0, 'H'},  {0,                  no_argument, 0, 0}};static voidusage (){  fprintf (stdout, _("Usage: readelf {options} elf-file(s)\n"));  fprintf (stdout, _("  Options are:\n"));  fprintf (stdout, _("  -a or --all               Equivalent to: -h -l -S -s -r -d -V -A -I\n"));  fprintf (stdout, _("  -h or --file-header       Display the ELF file header\n"));  fprintf (stdout, _("  -l or --program-headers or --segments\n"));  fprintf (stdout, _("                            Display the program headers\n"));  fprintf (stdout, _("  -S or --section-headers or --sections\n"));  fprintf (stdout, _("                            Display the sections' header\n"));  fprintf (stdout, _("  -e or --headers           Equivalent to: -h -l -S\n"));  fprintf (stdout, _("  -s or --syms or --symbols Display the symbol table\n"));  fprintf (stdout, _("  -n or --notes             Display the core notes (if present)\n"));  fprintf (stdout, _("  -r or --relocs            Display the relocations (if present)\n"));  fprintf (stdout, _("  -d or --dynamic           Display the dynamic segment (if present)\n"));  fprintf (stdout, _("  -V or --version-info      Display the version sections (if present)\n"));  fprintf (stdout, _("  -A or --arch-specific     Display architecture specific information (if any).\n"));  fprintf (stdout, _("  -D or --use-dynamic       Use the dynamic section info when displaying symbols\n"));  fprintf (stdout, _("  -x <number> or --hex-dump=<number>\n"));  fprintf (stdout, _("                            Dump the contents of section <number>\n"));  fprintf (stdout, _("  -w[liapr] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges]\n"));  fprintf (stdout, _("                            Display the contents of DWARF2 debug sections\n"));#ifdef SUPPORT_DISASSEMBLY  fprintf (stdout, _("  -i <number> or --instruction-dump=<number>\n"));  fprintf (stdout, _("                            Disassemble the contents of section <number>\n"));#endif  fprintf (stdout, _("  -I or --histogram         Display histogram of bucket list lengths\n"));  fprintf (stdout, _("  -v or --version           Display the version number of readelf\n"));  fprintf (stdout, _("  -H or --help              Display this information\n"));  fprintf (stdout, _("Report bugs to %s\n"), REPORT_BUGS_TO);  exit (0);}static voidrequest_dump (section, type)     unsigned int section;     char         type;{  if (section >= num_dump_sects)    {      char * new_dump_sects;      new_dump_sects = (char *) calloc (section + 1, 1);      if (new_dump_sects == NULL)	error (_("Out of memory allocating dump request table."));      else	{	  /* Copy current flag settings.  */	  memcpy (new_dump_sects, dump_sects, num_dump_sects);	  free (dump_sects);	  dump_sects = new_dump_sects;	  num_dump_sects = section + 1;	}    }  if (dump_sects)    dump_sects [section] |= type;  return;}static voidparse_args (argc, argv)     int argc;     char ** argv;{  int c;  if (argc < 2)    usage ();  while ((c = getopt_long	  (argc, argv, "ersahnldSDAIw::x:i:vV", options, NULL)) != EOF)    {      char *    cp;      int	section;      switch (c)	{	case 0:	  /* Long options.  */	  break;	case 'H':	  usage ();	  break;	case 'a':	  do_syms ++;	  do_reloc ++;	  do_dynamic ++;	  do_header ++;	  do_sections ++;	  do_segments ++;	  do_version ++;	  do_histogram ++;	  do_arch ++;	  do_notes ++;	  break;	case 'e':	  do_header ++;	  do_sections ++;	  do_segments ++;	  break;	case 'A':	  do_arch ++;	  break;	case 'D':	  do_using_dynamic ++;	  break;	case 'r':	  do_reloc ++;	  break;	case 'h':	  do_header ++;	  break;	case 'l':	  do_segments ++;	  break;	case 's':	  do_syms ++;	  break;	case 'S':	  do_sections ++;	  break;	case 'd':	  do_dynamic ++;	  break;	case 'I':	  do_histogram ++;	  break;	case 'n':	  do_notes ++;	  break;	case 'x':	  do_dump ++;	  section = strtoul (optarg, & cp, 0);	  if (! * cp && section >= 0)	    {	      request_dump (section, HEX_DUMP);	      break;	    }	  goto oops;	case 'w':	  do_dump ++;	  if (optarg == 0)	    do_debugging = 1;	  else	    {	      do_debugging = 0;	      switch (optarg[0])		{		case 'i':		case 'I':		  do_debug_info = 1;		  break;		case 'a':		case 'A':		  do_debug_abbrevs = 1;		  break;		case 'l':		case 'L':		  do_debug_lines = 1;		  break;		case 'p':		case 'P':		  do_debug_pubnames = 1;		  break;		case 'r':		case 'R':		  do_debug_aranges = 1;		  break;		default:		  warn (_("Unrecognised debug option '%s'\n"), optarg);		  break;		}	    }	  break;#ifdef SUPPORT_DISASSEMBLY	case 'i':	  do_dump ++;	  section = strtoul (optarg, & cp, 0);	  if (! * cp && section >= 0)	    {	      request_dump (section, DISASS_DUMP);	      break;	    }	  goto oops;#endif	case 'v':	  print_version (program_name);	  break;	case 'V':	  do_version ++;	  break;	default:	oops:	  /* xgettext:c-format */	  error (_("Invalid option '-%c'\n"), c);	  /* Drop through.  */	case '?':	  usage ();	}    }  if (!do_dynamic && !do_syms && !do_reloc && !do_sections      && !do_segments && !do_header && !do_dump && !do_version      && !do_histogram && !do_debugging && !do_arch && !do_notes)    usage ();  else if (argc < 3)    {      warn (_("Nothing to do.\n"));      usage();    }}static const char *get_elf_class (elf_class)     unsigned char elf_class;{  static char buff [32];  switch (elf_class)    {    case ELFCLASSNONE: return _("none");    case ELFCLASS32:   return _("ELF32");    case ELFCLASS64:   return _("ELF64");    default:      sprintf (buff, _("<unknown: %x>"), elf_class);      return buff;    }}static const char *get_data_encoding (encoding)     unsigned char encoding;{  static char buff [32];  switch (encoding)    {    case ELFDATANONE: return _("none");    case ELFDATA2LSB: return _("2's complement, little endian");    case ELFDATA2MSB: return _("2's complement, big endian");    default:      sprintf (buff, _("<unknown: %x>"), encoding);      return buff;    }}static const char *get_osabi_name (osabi)     unsigned char osabi;{  static char buff [32];  switch (osabi)    {    case ELFOSABI_NONE:       return _("UNIX - System V");    case ELFOSABI_HPUX:       return _("UNIX - HP-UX");    case ELFOSABI_NETBSD:     return _("UNIX - NetBSD");    case ELFOSABI_LINUX:      return _("UNIX - Linux");    case ELFOSABI_HURD:       return _("GNU/Hurd");    case ELFOSABI_SOLARIS:    return _("UNIX - Solaris");    case ELFOSABI_MONTEREY:   return _("UNIX - Monterey");    case ELFOSABI_IRIX:       return _("UNIX - IRIX");    case ELFOSABI_FREEBSD:    return _("UNIX - FreeBSD");    case ELFOSABI_TRU64:      return _("UNIX - TRU64");    case ELFOSABI_MODESTO:    return _("Novell - Modesto");    case ELFOSABI_OPENBSD:    return _("UNIX - OpenBSD");    case ELFOSABI_STANDALONE: return _("Standalone App");    case ELFOSABI_ARM:        return _("ARM");    default:      sprintf (buff, _("<unknown: %x>"), osabi);      return buff;    }}/* Decode the data held in 'elf_header'.  */static intprocess_file_header (){  if (   elf_header.e_ident [EI_MAG0] != ELFMAG0      || elf_header.e_ident [EI_MAG1] != ELFMAG1      || elf_header.e_ident [EI_MAG2] != ELFMAG2      || elf_header.e_ident [EI_MAG3] != ELFMAG3)    {      error	(_("Not an ELF file - it has the wrong magic bytes at the start\n"));      return 0;    }  if (do_header)    {      int i;      printf (_("ELF Header:\n"));      printf (_("  Magic:   "));      for (i = 0; i < EI_NIDENT; i ++)	printf ("%2.2x ", elf_header.e_ident [i]);      printf ("\n");      printf (_("  Class:                             %s\n"),	      get_elf_class (elf_header.e_ident [EI_CLASS]));      printf (_("  Data:                              %s\n"),	      get_data_encoding (elf_header.e_ident [EI_DATA]));      printf (_("  Version:                           %d %s\n"),	      elf_header.e_ident [EI_VERSION],	      (elf_header.e_ident [EI_VERSION] == EV_CURRENT	       ? "(current)"	       : (elf_header.e_ident [EI_VERSION] != EV_NONE		  ? "<unknown: %lx>"		  : "")));      printf (_("  OS/ABI:                            %s\n"),	      get_osabi_name (elf_header.e_ident [EI_OSABI]));      printf (_("  ABI Version:                       %d\n"),	      elf_header.e_ident [EI_ABIVERSION]);      printf (_("  Type:                              %s\n"),	      get_file_type (elf_header.e_type));      printf (_("  Machine:                           %s\n"),	      get_machine_name (elf_header.e_machine));      printf (_("  Version:                           0x%lx\n"),	      (unsigned long) elf_header.e_version);            printf (_("  Entry point address:               "));      print_vma ((bfd_vma) elf_header.e_entry, PREFIX_HEX);      printf (_("\n  Start of program headers:          "));      print_vma ((bfd_vma) elf_header.e_phoff, DEC);      printf (_(" (bytes into file)\n  Start of section headers:          "));      print_vma ((bfd_vma) elf_header.e_shoff, DEC);      printf (_(" (bytes into file)\n"));	      printf (_("  Flags:                             0x%lx%s\n"),	      (unsigned long) elf_header.e_flags,	      get_machine_flags (elf_header.e_flags, elf_header.e_machine));      printf (_("  Size of this header:               %ld (bytes)\n"),	      (long) elf_header.e_ehsize);      printf (_("  Size of program headers:           %ld (bytes)\n"),	      (long) elf_header.e_phentsize);      printf (_("  Number of program headers:         %ld\n"),	      (long) elf_header.e_phnum);      printf (_("  Size of section headers:           %ld (bytes)\n"),	      (long) elf_header.e_shentsize);      printf (_("  Number of section headers:         %ld\n"),	      (long) elf_header.e_shnum);      printf (_("  Section header string table index: %ld\n"),	      (long) elf_header.e_shstrndx);    }  return 1;}static intget_32bit_program_headers (file, program_headers)     FILE * file;     Elf_Internal_Phdr * program_headers;{  Elf32_External_Phdr * phdrs;  Elf32_External_Phdr * external;  Elf32_Internal_Phdr * internal;  unsigned int          i;  GET_DATA_ALLOC (elf_header.e_phoff,		  elf_header.e_phentsize * elf_header.e_phnum,		  phdrs, Elf32_External_Phdr *, "program headers");  for (i = 0, internal = program_headers, external = phdrs;       i < elf_header.e_phnum;       i ++, internal ++, external ++)    {      internal->p_type   = BYTE_GET (external->p_type);      internal->p_offset = BYTE_GET (external->p_offset);      internal->p_vaddr  = BYTE_GET (external->p_vaddr);      internal->p_paddr  = BYTE_GET (external->p_paddr);      internal->p_filesz = BYTE_GET (external->p_filesz);      internal->p_memsz  = BYTE_GET (external->p_memsz);      internal->p_flags  = BYTE_GET (external->p_flags);      internal->p_align  = BYTE_GET (external->p_align);    }  free (phdrs);  return 1;}static intget_64bit_program_headers (file, program_headers)     FILE * file;     Elf_Internal_Phdr * program_headers;{  Elf64_External_Phdr * phdrs;  Elf64_External_Phdr * external;  Elf64_Internal_Phdr * internal;  unsigned int          i;  GET_DATA_ALLOC (elf_header.e_phoff,		  elf_header.e_phentsize * elf_header.e_phnum,		  phdrs, Elf64_External_Phdr *, "program headers");  for (i = 0, internal = program_headers, external = phdrs;       i < elf_header.e_phnum;       i ++, internal ++, external ++)    {      internal->p_type   = BYTE_GET (external->p_type);      internal->p_flags  = BYTE_GET (external->p_flags);      internal->p_offset = BYTE_GET8 (external->p_offset);      internal->p_vaddr  = BYTE_GET8 (external->p_vaddr);      internal->p_paddr  = BYTE_GET8 (external->p_paddr);      internal->p_filesz = BYTE_GET8 (external->p_filesz);      internal->p_memsz  = BYTE_GET8 (external->p_memsz);      internal->p_align  = BYTE_GET8 (external->p_align);    }  free (phdrs);  return 1;}static intprocess_program_headers (file)     FILE * file;{  Elf_Internal_Phdr * program_headers;  Elf_Internal_Phdr * segment;  unsigned int	      i;  if (elf_header.e_phnum == 0)    {      if (do_segments)	printf (_("\nThere are no program headers in this file.\n"));      return 1;    }  if (do_segments && !do_header)    {      printf (_("\nElf file type is %s\n"), get_file_type (elf_header.e_type));      printf (_("Entry point "));      print_vma ((bfd_vma) elf_header.e_entry, PREFIX_HEX);      printf (_("\nThere are %d program headers, starting at offset "),	      elf_header.e_phnum);      print_vma ((bfd_vma) elf_header.e_phoff, DEC);      printf ("\n");    }  program_headers = (Elf_Internal_Phdr *) malloc    (elf_header.e_phnum * sizeof (Elf_Internal_Phdr));  if (program_headers == NULL)    {      error (_("Out of memory\n"));      return 0;    }  if (is_32bit_elf)    i = get_32bit_program_headers (file, program_headers);  else    i = get_64bit_program_headers (file, program_headers);  if (i == 0)    {      free (program_headers);      return 0;    }  if (do_segments)    {      printf	(_("\nProgram Header%s:\n"), elf_header.e_phnum > 1 ? "s" : "");            if (is_32bit_elf)	printf	  (_("  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align\n"));      else	{	  printf	    (_("  Type           Offset             VirtAddr           PhysAddr\n"));	  printf	    (_("                 FileSiz            MemSiz              Flags  Align\n"));	}    }  loadaddr = -1;  dynamic_addr = 0;  dynamic_size = 0;  for (i = 0, segment = program_headers;       i < elf_header.e_phnum;       i ++, segment ++)    {      if (do_segments)	{	  printf ("  %-14.14s ", get_segment_type (segment->p_type));	  if (is_32bit_elf)	    {	      printf ("0x%6.6lx ", (unsigned long) segment->p_offset);	      printf ("0x%8.8lx ", (unsigned long) segment->p_vaddr);	      printf ("0x%8.8lx ", (unsigned long) segment->p_paddr);	      printf ("0x%5.5lx ", (unsigned long) segment->p_filesz);	      printf ("0x%5.5lx ", (unsigned long) segment->p_memsz);	      printf ("%c%c%c ",		      (segment->p_flags & PF_R ? 'R' : ' '),		      (segment->p_flags & PF_W ? 'W' : ' '),		      (segment->p_flags & PF_X ? 'E' : ' '));	      printf ("%#lx", (unsigned long) segment->p_align);	    }	  else	    {	      print_vma (segment->p_offset, FULL_HEX);	      putchar (' ');	      print_vma (segment->p_vaddr, FULL_HEX);	      putchar (' ');	      print_vma (segment->p_paddr, FULL_HEX);	      printf ("\n                 ");	      print_vma (segment->p_filesz, FULL_HEX);	      putchar (' ');	      print_vma (segment->p_memsz, FULL_HEX);	      printf ("  %c%c%c    ",		      (segment->p_flags & PF_R ? 'R' : ' '),		      (segment->p_flags & PF_W ? 'W' : ' '),		      (segment->p_flags & PF_X ? 'E' : ' '));	      print_vma (segment->p_align, HEX);	    }	}      switch (segment->p_type)	{	case PT_LOAD:	  if (loadaddr == -1)	    loadaddr = (segment->p_vaddr & 0xfffff000)	      - (segment->p_offset & 0xfffff000);	  break;	case PT_DYNAMIC:	  if (dynamic_addr)	    error (_("more than one dynamic segment\n"));	  dynamic_addr = segment->p_offset;	  dynamic_size = segment->p_filesz;	  break;	case PT_INTERP:	  if (fseek (file, (long) segment->p_offset, SEEK_SET))	    error (_("Unable to find program interpreter name\n"));	  else	    {	      program_interpreter[0] = 0;	      fscanf (file, "%63s", program_interpreter);	      if (do_segments)		printf (_("\n      [Requesting program interpreter: %s]"),		    program_interpreter);	    }	  break;	}      if (do_segments)	putc ('\n', stdout);    }  if (loadaddr == -1)    {      /* Very strange. */      loadaddr = 0;    }  if (do_segments && section_headers != NULL)    {      printf (_("\n Section to Segment mapping:\n"));      printf (_("  Segment Sections...\n"));      assert (string_table != NULL);      for (i = 0; i < elf_header.e_phnum; i++)	{	  int                 j;	  Elf_Internal_Shdr * section;	  segment = program_headers + i;	  section = section_headers;	  printf ("   %2.2d     ", i);	  for (j = 0; j < elf_header.e_shnum; j++, section ++)	    {	      if (section->sh_size > 0		  /* Compare allocated sections by VMA, unallocated		     sections by file offset.  */		  && (section->sh_flags & SHF_ALLOC		      ? (section->sh_addr >= segment->p_vaddr			 && section->sh_addr + section->sh_size			 <= segment->p_vaddr + segment->p_memsz)		      : ((bfd_vma) section->sh_offset >= segment->p_offset			 && (section->sh_offset + section->sh_size			     <= segment->p_offset + segment->p_filesz))))		printf ("%s ", SECTION_NAME (section));	    }	  putc ('\n',stdout);	}    }  free (program_headers);  return 1;}static intget_32bit_section_headers (file)     FILE * file;{  Elf32_External_Shdr * shdrs;  Elf32_Internal_Shdr * internal;  unsigned int          i;  GET_DATA_ALLOC (elf_header.e_shoff,		  elf_header.e_shentsize * elf_header.e_shnum,		  shdrs, Elf32_External_Shdr *, "section headers");  section_headers = (Elf_Internal_Shdr *) malloc    (elf_header.e_shnum * sizeof (Elf_Internal_Shdr));  if (section_headers == NULL)    {      error (_("Out of memory\n"));      return 0;    }  for (i = 0, internal = section_headers;       i < elf_header.e_shnum;       i ++, internal ++)    {      internal->sh_name      = BYTE_GET (shdrs[i].sh_name);      internal->sh_type      = BYTE_GET (shdrs[i].sh_type);      internal->sh_flags     = BYTE_GET (shdrs[i].sh_flags);      internal->sh_addr      = BYTE_GET (shdrs[i].sh_addr);      internal->sh_offset    = BYTE_GET (shdrs[i].sh_offset);      internal->sh_size      = BYTE_GET (shdrs[i].sh_size);      internal->sh_link      = BYTE_GET (shdrs[i].sh_link);      internal->sh_info      = BYTE_GET (shdrs[i].sh_info);      internal->sh_addralign = BYTE_GET (shdrs[i].sh_addralign);      internal->sh_entsize   = BYTE_GET (shdrs[i].sh_entsize);    }  free (shdrs);  return 1;}static intget_64bit_section_headers (file)     FILE * file;{  Elf64_External_Shdr * shdrs;  Elf64_Internal_Shdr * internal;  unsigned int          i;  GET_DATA_ALLOC (elf_header.e_shoff,		  elf_header.e_shentsize * elf_header.e_shnum,		  shdrs, Elf64_External_Shdr *, "section headers");  section_headers = (Elf_Internal_Shdr *) malloc    (elf_header.e_shnum * sizeof (Elf_Internal_Shdr));  if (section_headers == NULL)    {      error (_("Out of memory\n"));      return 0;    }  for (i = 0, internal = section_headers;       i < elf_header.e_shnum;       i ++, internal ++)    {      internal->sh_name      = BYTE_GET (shdrs[i].sh_name);      internal->sh_type      = BYTE_GET (shdrs[i].sh_type);      internal->sh_flags     = BYTE_GET8 (shdrs[i].sh_flags);      internal->sh_addr      = BYTE_GET8 (shdrs[i].sh_addr);      internal->sh_size      = BYTE_GET8 (shdrs[i].sh_size);      internal->sh_entsize   = BYTE_GET8 (shdrs[i].sh_entsize);      internal->sh_link      = BYTE_GET (shdrs[i].sh_link);      internal->sh_info      = BYTE_GET (shdrs[i].sh_info);      internal->sh_offset    = BYTE_GET (shdrs[i].sh_offset);      internal->sh_addralign = BYTE_GET (shdrs[i].sh_addralign);    }  free (shdrs);  return 1;}static Elf_Internal_Sym *get_32bit_elf_symbols (file, offset, number)     FILE * file;     unsigned long offset;     unsigned long number;{  Elf32_External_Sym * esyms;  Elf_Internal_Sym *   isyms;  Elf_Internal_Sym *   psym;  unsigned int         j;  GET_DATA_ALLOC (offset, number * sizeof (Elf32_External_Sym),		  esyms, Elf32_External_Sym *, "symbols");  isyms = (Elf_Internal_Sym *) malloc (number * sizeof (Elf_Internal_Sym));  if (isyms == NULL)    {      error (_("Out of memory\n"));      free (esyms);      return NULL;    }  for (j = 0, psym = isyms;       j < number;       j ++, psym ++)    {      psym->st_name  = BYTE_GET (esyms[j].st_name);      psym->st_value = BYTE_GET (esyms[j].st_value);      psym->st_size  = BYTE_GET (esyms[j].st_size);      psym->st_shndx = BYTE_GET (esyms[j].st_shndx);      psym->st_info  = BYTE_GET (esyms[j].st_info);      psym->st_other = BYTE_GET (esyms[j].st_other);    }  free (esyms);  return isyms;}static Elf_Internal_Sym *get_64bit_elf_symbols (file, offset, number)     FILE * file;     unsigned long offset;     unsigned long number;{  Elf64_External_Sym * esyms;  Elf_Internal_Sym *   isyms;  Elf_Internal_Sym *   psym;  unsigned int         j;  GET_DATA_ALLOC (offset, number * sizeof (Elf64_External_Sym),		  esyms, Elf64_External_Sym *, "symbols");  isyms = (Elf_Internal_Sym *) malloc (number * sizeof (Elf_Internal_Sym));  if (isyms == NULL)    {      error (_("Out of memory\n"));      free (esyms);      return NULL;    }  for (j = 0, psym = isyms;       j < number;       j ++, psym ++)    {      psym->st_name  = BYTE_GET (esyms[j].st_name);      psym->st_info  = BYTE_GET (esyms[j].st_info);      psym->st_other = BYTE_GET (esyms[j].st_other);      psym->st_shndx = BYTE_GET (esyms[j].st_shndx);      psym->st_value = BYTE_GET8 (esyms[j].st_value);      psym->st_size  = BYTE_GET8 (esyms[j].st_size);    }  free (esyms);  return isyms;}static const char *get_elf_section_flags (sh_flags)     bfd_vma sh_flags;{  static char buff [32];  * buff = 0;    while (sh_flags)    {      bfd_vma flag;      flag = sh_flags & - sh_flags;      sh_flags &= ~ flag;            switch (flag)	{	case SHF_WRITE:            strcat (buff, "W"); break;	case SHF_ALLOC:            strcat (buff, "A"); break;	case SHF_EXECINSTR:        strcat (buff, "X"); break;	case SHF_MERGE:            strcat (buff, "M"); break;	case SHF_STRINGS:          strcat (buff, "S"); break;	case SHF_INFO_LINK:        strcat (buff, "I"); break;	case SHF_LINK_ORDER:       strcat (buff, "L"); break;	case SHF_OS_NONCONFORMING: strcat (buff, "O"); break;	  	default:	  if (flag & SHF_MASKOS)	    {	      strcat (buff, "o");	      sh_flags &= ~ SHF_MASKOS;	    }	  else if (flag & SHF_MASKPROC)	    {	      strcat (buff, "p");	      sh_flags &= ~ SHF_MASKPROC;	    }	  else	    strcat (buff, "x");	  break;	}    }    return buff;}static intprocess_section_headers (file)     FILE * file;{  Elf_Internal_Shdr * section;  int                 i;  section_headers = NULL;  if (elf_header.e_shnum == 0)    {      if (do_sections)	printf (_("\nThere are no sections in this file.\n"));      return 1;    }  if (do_sections && !do_header)    printf (_("There are %d section headers, starting at offset 0x%lx:\n"),	    elf_header.e_shnum, (unsigned long) elf_header.e_shoff);  if (is_32bit_elf)    {      if (! get_32bit_section_headers (file))	return 0;    }  else if (! get_64bit_section_headers (file))    return 0;  /* Read in the string table, so that we have names to display.  */  section = section_headers + elf_header.e_shstrndx;  if (section->sh_size != 0)    {      unsigned long string_table_offset;      string_table_offset = section->sh_offset;      GET_DATA_ALLOC (section->sh_offset, section->sh_size,		      string_table, char *, "string table");    }  /* Scan the sections for the dynamic symbol table     and dynamic string table and debug sections. */  dynamic_symbols = NULL;  dynamic_strings = NULL;  dynamic_syminfo = NULL;  for (i = 0, section = section_headers;       i < elf_header.e_shnum;       i ++, section ++)    {      char * name = SECTION_NAME (section);      if (section->sh_type == SHT_DYNSYM)	{	  if (dynamic_symbols != NULL)	    {	      error (_("File contains multiple dynamic symbol tables\n"));	      continue;	    }	  num_dynamic_syms = section->sh_size / section->sh_entsize;	  dynamic_symbols =	    GET_ELF_SYMBOLS (file, section->sh_offset, num_dynamic_syms);	}      else if (section->sh_type == SHT_STRTAB	       && strcmp (name, ".dynstr") == 0)	{	  if (dynamic_strings != NULL)	    {	      error (_("File contains multiple dynamic string tables\n"));	      continue;	    }	  GET_DATA_ALLOC (section->sh_offset, section->sh_size,			  dynamic_strings, char *, "dynamic strings");	}      else if ((do_debugging || do_debug_info || do_debug_abbrevs		|| do_debug_lines || do_debug_pubnames || do_debug_aranges)	       && strncmp (name, ".debug_", 7) == 0)	{	  name += 7;	  if (do_debugging	      || (do_debug_info     && (strcmp (name, "info") == 0))	      || (do_debug_abbrevs  && (strcmp (name, "abbrev") == 0))	      || (do_debug_lines    && (strcmp (name, "line") == 0))	      || (do_debug_pubnames && (strcmp (name, "pubnames") == 0))	      || (do_debug_aranges  && (strcmp (name, "aranges") == 0))	      )	    request_dump (i, DEBUG_DUMP);	}    }  if (! do_sections)    return 1;  printf (_("\nSection Header%s:\n"), elf_header.e_shnum > 1 ? "s" : "");    if (is_32bit_elf)    printf      (_("  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al\n"));  else    {      printf (_("  [Nr] Name              Type             Address           Offset\n"));      printf (_("       Size              EntSize          Flags  Link  Info  Align\n"));    }  for (i = 0, section = section_headers;       i < elf_header.e_shnum;       i ++, section ++)    {      printf ("  [%2d] %-17.17s %-15.15s ",	      i,	      SECTION_NAME (section),	      get_section_type_name (section->sh_type));      if (is_32bit_elf)	{	  print_vma (section->sh_addr, LONG_HEX);      	  printf ( " %6.6lx %6.6lx %2.2lx",		   (unsigned long) section->sh_offset,		   (unsigned long) section->sh_size,		   (unsigned long) section->sh_entsize);	  printf (" %3s ", get_elf_section_flags (section->sh_flags));		  	  printf (" %2ld %3lx %ld\n",		  (unsigned long) section->sh_link,		  (unsigned long) section->sh_info,		  (unsigned long) section->sh_addralign);	}      else	{	  putchar (' ');	  print_vma (section->sh_addr, LONG_HEX);	  printf ("  %8.8lx", section->sh_offset);	  printf ("\n       ");	  print_vma (section->sh_size, LONG_HEX);	  printf ("  ");	  print_vma (section->sh_entsize, LONG_HEX);	  	  printf (" %3s ", get_elf_section_flags (section->sh_flags));		  	  printf ("     %2ld   %3lx     %ld\n",		  (unsigned long) section->sh_link,		  (unsigned long) section->sh_info,		  (unsigned long) section->sh_addralign);	}    }  printf (_("Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings)\n"));  printf (_("              I (info), L (link order), O (extra OS processing required)\n"));  printf (_("              o (os specific), p (processor specific) x (unknown)\n"));  return 1;}/* Process the reloc section.  */static intprocess_relocs (file)     FILE * file;{  unsigned long    rel_size;  unsigned long	   rel_offset;  if (!do_reloc)    return 1;  if (do_using_dynamic)    {      int is_rela = FALSE;      rel_size   = 0;      rel_offset = 0;      if (dynamic_info[DT_REL])	{	  rel_offset = dynamic_info[DT_REL];	  rel_size   = dynamic_info[DT_RELSZ];	  is_rela    = FALSE;	}      else if (dynamic_info [DT_RELA])	{	  rel_offset = dynamic_info[DT_RELA];	  rel_size   = dynamic_info[DT_RELASZ];	  is_rela    = TRUE;	}      else if (dynamic_info[DT_JMPREL])	{	  rel_offset = dynamic_info[DT_JMPREL];	  rel_size   = dynamic_info[DT_PLTRELSZ];	  switch (dynamic_info[DT_PLTREL])	    {	    case DT_REL:	      is_rela = FALSE;	      break;	    case DT_RELA:	      is_rela = TRUE;	      break;	    default:	      is_rela = UNKNOWN;	      break;	    }	}      if (rel_size)	{	  printf	    (_("\nRelocation section at offset 0x%lx contains %ld bytes:\n"),	     rel_offset, rel_size);	  dump_relocations (file, rel_offset - loadaddr, rel_size,			    dynamic_symbols, num_dynamic_syms, dynamic_strings, is_rela);	}      else	printf (_("\nThere are no dynamic relocations in this file.\n"));    }  else    {      Elf32_Internal_Shdr *     section;      unsigned long 		i;      int           		found = 0;      for (i = 0, section = section_headers;	   i < elf_header.e_shnum;	   i++, section ++)	{	  if (   section->sh_type != SHT_RELA	      && section->sh_type != SHT_REL)	    continue;	  rel_offset = section->sh_offset;	  rel_size   = section->sh_size;	  if (rel_size)	    {	      Elf32_Internal_Shdr * strsec;	      Elf32_Internal_Shdr * symsec;	      Elf_Internal_Sym *    symtab;	      char *                strtab;	      int                   is_rela;	      unsigned long         nsyms;	      printf (_("\nRelocation section "));	      if (string_table == NULL)		printf ("%d", section->sh_name);	      else		printf ("'%s'", SECTION_NAME (section));	      printf (_(" at offset 0x%lx contains %lu entries:\n"),		 rel_offset, (unsigned long) (rel_size / section->sh_entsize));	      symsec = section_headers + section->sh_link;	      nsyms = symsec->sh_size / symsec->sh_entsize;	      symtab = GET_ELF_SYMBOLS (file, symsec->sh_offset, nsyms);	      if (symtab == NULL)		continue;	      strsec = section_headers + symsec->sh_link;	      GET_DATA_ALLOC (strsec->sh_offset, strsec->sh_size, strtab,			      char *, "string table");	      is_rela = section->sh_type == SHT_RELA;	      dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela);	      free (strtab);	      free (symtab);	      found = 1;	    }	}      if (! found)	printf (_("\nThere are no relocations in this file.\n"));    }  return 1;}static voiddynamic_segment_mips_val (entry)     Elf_Internal_Dyn * entry;{  switch (entry->d_tag)    {    case DT_MIPS_FLAGS:      if (entry->d_un.d_val == 0)	printf ("NONE\n");      else	{	  static const char * opts[] =	  {	    "QUICKSTART", "NOTPOT", "NO_LIBRARY_REPLACEMENT",	    "NO_MOVE", "SGI_ONLY", "GUARANTEE_INIT", "DELTA_C_PLUS_PLUS",	    "GUARANTEE_START_INIT", "PIXIE", "DEFAULT_DELAY_LOAD",	    "REQUICKSTART", "REQUICKSTARTED", "CORD", "NO_UNRES_UNDEF",	    "RLD_ORDER_SAFE"	  };	  unsigned int cnt;	  int first = 1;	  for (cnt = 0; cnt < NUM_ELEM (opts); ++ cnt)	    if (entry->d_un.d_val & (1 << cnt))	      {		printf ("%s%s", first ? "" : " ", opts[cnt]);		first = 0;	      }	  puts ("");	}      break;    case DT_MIPS_IVERSION:      if (dynamic_strings != NULL)	printf ("Interface Version: %s\n",		dynamic_strings + entry->d_un.d_val);      else	printf ("%ld\n", (long) entry->d_un.d_ptr);      break;    case DT_MIPS_TIME_STAMP:      {	char timebuf[20];	struct tm * tmp;	time_t time = entry->d_un.d_val;	tmp = gmtime (&time);	sprintf (timebuf, "%04u-%02u-%02uT%02u:%02u:%02u",		 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,		 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);	printf ("Time Stamp: %s\n", timebuf);      }      break;    case DT_MIPS_RLD_VERSION:    case DT_MIPS_LOCAL_GOTNO:    case DT_MIPS_CONFLICTNO:    case DT_MIPS_LIBLISTNO:    case DT_MIPS_SYMTABNO:    case DT_MIPS_UNREFEXTNO:    case DT_MIPS_HIPAGENO:    case DT_MIPS_DELTA_CLASS_NO:    case DT_MIPS_DELTA_INSTANCE_NO:    case DT_MIPS_DELTA_RELOC_NO:    case DT_MIPS_DELTA_SYM_NO:    case DT_MIPS_DELTA_CLASSSYM_NO:    case DT_MIPS_COMPACT_SIZE:      printf ("%ld\n", (long) entry->d_un.d_ptr);      break;    default:      printf ("%#lx\n", (long) entry->d_un.d_ptr);    }}static voiddynamic_segment_parisc_val (entry)     Elf_Internal_Dyn * entry;{  switch (entry->d_tag)    {    case DT_HP_DLD_FLAGS:      {	static struct	{	  long int bit;	  const char * str;	}	flags[] =	{	  { DT_HP_DEBUG_PRIVATE, "HP_DEBUG_PRIVATE" },	  { DT_HP_DEBUG_CALLBACK, "HP_DEBUG_CALLBACK" },	  { DT_HP_DEBUG_CALLBACK_BOR, "HP_DEBUG_CALLBACK_BOR" },	  { DT_HP_NO_ENVVAR, "HP_NO_ENVVAR" },	  { DT_HP_BIND_NOW, "HP_BIND_NOW" },	  { DT_HP_BIND_NONFATAL, "HP_BIND_NONFATAL" },	  { DT_HP_BIND_VERBOSE, "HP_BIND_VERBOSE" },	  { DT_HP_BIND_RESTRICTED, "HP_BIND_RESTRICTED" },	  { DT_HP_BIND_SYMBOLIC, "HP_BIND_SYMBOLIC" },	  { DT_HP_RPATH_FIRST, "HP_RPATH_FIRST" },	  { DT_HP_BIND_DEPTH_FIRST, "HP_BIND_DEPTH_FIRST" }	};	int first = 1;	size_t cnt;	bfd_vma val = entry->d_un.d_val;	for (cnt = 0; cnt < sizeof (flags) / sizeof (flags[0]); ++cnt)	  if (val & flags[cnt].bit)	    {	      if (! first)		putchar (' ');	      fputs (flags[cnt].str, stdout);	      first = 0;	      val ^= flags[cnt].bit;	    }		if (val != 0 || first)	  {	    if (! first)	      putchar (' ');	    print_vma (val, HEX);	  }      }      break;          default:      print_vma (entry->d_un.d_ptr, PREFIX_HEX);      break;    }}static intget_32bit_dynamic_segment (file)     FILE * file;{  Elf32_External_Dyn * edyn;  Elf_Internal_Dyn *   entry;  bfd_size_type        i;  GET_DATA_ALLOC (dynamic_addr, dynamic_size,		  edyn, Elf32_External_Dyn *, "dynamic segment");  /* SGI's ELF has more than one section in the DYNAMIC segment.  Determine     how large this .dynamic is now.  We can do this even before the byte     swapping since the DT_NULL tag is recognizable.  */  dynamic_size = 0;  while (*(Elf32_Word *) edyn [dynamic_size++].d_tag != DT_NULL)    ;  dynamic_segment = (Elf_Internal_Dyn *)    malloc (dynamic_size * sizeof (Elf_Internal_Dyn));  if (dynamic_segment == NULL)    {      error (_("Out of memory\n"));      free (edyn);      return 0;    }  for (i = 0, entry = dynamic_segment;       i < dynamic_size;       i ++, entry ++)    {      entry->d_tag      = BYTE_GET (edyn [i].d_tag);      entry->d_un.d_val = BYTE_GET (edyn [i].d_un.d_val);    }  free (edyn);  return 1;}static intget_64bit_dynamic_segment (file)     FILE * file;{  Elf64_External_Dyn * edyn;  Elf_Internal_Dyn *   entry;  bfd_size_type        i;  GET_DATA_ALLOC (dynamic_addr, dynamic_size,		  edyn, Elf64_External_Dyn *, "dynamic segment");  /* SGI's ELF has more than one section in the DYNAMIC segment.  Determine     how large this .dynamic is now.  We can do this even before the byte     swapping since the DT_NULL tag is recognizable.  */  dynamic_size = 0;  while (*(bfd_vma *) edyn [dynamic_size ++].d_tag != DT_NULL)    ;  dynamic_segment = (Elf_Internal_Dyn *)    malloc (dynamic_size * sizeof (Elf_Internal_Dyn));  if (dynamic_segment == NULL)    {      error (_("Out of memory\n"));      free (edyn);      return 0;    }  for (i = 0, entry = dynamic_segment;       i < dynamic_size;       i ++, entry ++)    {      entry->d_tag      = BYTE_GET8 (edyn [i].d_tag);      entry->d_un.d_val = BYTE_GET8 (edyn [i].d_un.d_val);    }  free (edyn);  return 1;}static const char *get_dynamic_flags (flags)     bfd_vma flags;{  static char buff [64];  while (flags)    {      bfd_vma flag;      flag = flags & - flags;      flags &= ~ flag;      switch (flag)	{	case DF_ORIGIN:   strcat (buff, "ORIGIN "); break;	case DF_SYMBOLIC: strcat (buff, "SYMBOLIC "); break;	case DF_TEXTREL:  strcat (buff, "TEXTREL "); break;	case DF_BIND_NOW: strcat (buff, "BIND_NOW "); break;	default:          strcat (buff, "unknown "); break;	}    }  return buff;}