OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [binutils/] [readelf.c] - Diff between revs 161 and 163

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 161 Rev 163
Line 101... Line 101...
#include "elf/cris.h"
#include "elf/cris.h"
#include "elf/crx.h"
#include "elf/crx.h"
#include "elf/d10v.h"
#include "elf/d10v.h"
#include "elf/d30v.h"
#include "elf/d30v.h"
#include "elf/dlx.h"
#include "elf/dlx.h"
 
#include "elf/epiphany.h"
#include "elf/fr30.h"
#include "elf/fr30.h"
#include "elf/frv.h"
#include "elf/frv.h"
#include "elf/h8.h"
#include "elf/h8.h"
#include "elf/hppa.h"
#include "elf/hppa.h"
#include "elf/i386.h"
#include "elf/i386.h"
Line 132... Line 133...
#include "elf/open8.h"
#include "elf/open8.h"
#include "elf/or32.h"
#include "elf/or32.h"
#include "elf/pj.h"
#include "elf/pj.h"
#include "elf/ppc.h"
#include "elf/ppc.h"
#include "elf/ppc64.h"
#include "elf/ppc64.h"
 
#include "elf/rl78.h"
#include "elf/rx.h"
#include "elf/rx.h"
#include "elf/s390.h"
#include "elf/s390.h"
#include "elf/score.h"
#include "elf/score.h"
#include "elf/sh.h"
#include "elf/sh.h"
#include "elf/sparc.h"
#include "elf/sparc.h"
Line 270... Line 272...
   : ((X)->sh_name >= string_table_length ? _("<corrupt>")      \
   : ((X)->sh_name >= string_table_length ? _("<corrupt>")      \
  : string_table + (X)->sh_name))
  : string_table + (X)->sh_name))
 
 
#define DT_VERSIONTAGIDX(tag)   (DT_VERNEEDNUM - (tag)) /* Reverse order!  */
#define DT_VERSIONTAGIDX(tag)   (DT_VERNEEDNUM - (tag)) /* Reverse order!  */
 
 
#define GET_ELF_SYMBOLS(file, section)                  \
#define GET_ELF_SYMBOLS(file, section, sym_count)                       \
  (is_32bit_elf ? get_32bit_elf_symbols (file, section) \
  (is_32bit_elf ? get_32bit_elf_symbols (file, section, sym_count)      \
   : get_64bit_elf_symbols (file, section))
   : get_64bit_elf_symbols (file, section, sym_count))
 
 
#define VALID_DYNAMIC_NAME(offset)      ((dynamic_strings != NULL) && (offset < dynamic_strings_length))
#define VALID_DYNAMIC_NAME(offset)      ((dynamic_strings != NULL) && (offset < dynamic_strings_length))
/* GET_DYNAMIC_NAME asssumes that VALID_DYNAMIC_NAME has
/* GET_DYNAMIC_NAME asssumes that VALID_DYNAMIC_NAME has
   already been called and verified that the string exists.  */
   already been called and verified that the string exists.  */
#define GET_DYNAMIC_NAME(offset)        (dynamic_strings + offset)
#define GET_DYNAMIC_NAME(offset)        (dynamic_strings + offset)
Line 551... Line 553...
      return FALSE;
      return FALSE;
 
 
      /* Targets that use RELA relocations.  */
      /* Targets that use RELA relocations.  */
    case EM_68K:
    case EM_68K:
    case EM_860:
    case EM_860:
 
    case EM_ADAPTEVA_EPIPHANY:
    case EM_ALPHA:
    case EM_ALPHA:
    case EM_ALTERA_NIOS2:
    case EM_ALTERA_NIOS2:
    case EM_AVR:
    case EM_AVR:
    case EM_AVR_OLD:
    case EM_AVR_OLD:
    case EM_BLACKFIN:
    case EM_BLACKFIN:
Line 591... Line 594...
    case EM_MT:
    case EM_MT:
    case EM_NIOS32:
    case EM_NIOS32:
    case EM_OPEN8:
    case EM_OPEN8:
    case EM_PPC64:
    case EM_PPC64:
    case EM_PPC:
    case EM_PPC:
 
    case EM_RL78:
    case EM_RX:
    case EM_RX:
    case EM_S390:
    case EM_S390:
    case EM_S390_OLD:
    case EM_S390_OLD:
    case EM_SH:
    case EM_SH:
    case EM_SPARC:
    case EM_SPARC:
Line 654... Line 658...
  if (is_32bit_elf)
  if (is_32bit_elf)
    {
    {
      Elf32_External_Rela * erelas;
      Elf32_External_Rela * erelas;
 
 
      erelas = (Elf32_External_Rela *) get_data (NULL, file, rel_offset, 1,
      erelas = (Elf32_External_Rela *) get_data (NULL, file, rel_offset, 1,
                                                 rel_size, _("relocs"));
                                                 rel_size, _("32-bit relocation data"));
      if (!erelas)
      if (!erelas)
        return 0;
        return 0;
 
 
      nrelas = rel_size / sizeof (Elf32_External_Rela);
      nrelas = rel_size / sizeof (Elf32_External_Rela);
 
 
Line 684... Line 688...
  else
  else
    {
    {
      Elf64_External_Rela * erelas;
      Elf64_External_Rela * erelas;
 
 
      erelas = (Elf64_External_Rela *) get_data (NULL, file, rel_offset, 1,
      erelas = (Elf64_External_Rela *) get_data (NULL, file, rel_offset, 1,
                                                 rel_size, _("relocs"));
                                                 rel_size, _("64-bit relocation data"));
      if (!erelas)
      if (!erelas)
        return 0;
        return 0;
 
 
      nrelas = rel_size / sizeof (Elf64_External_Rela);
      nrelas = rel_size / sizeof (Elf64_External_Rela);
 
 
Line 752... Line 756...
  if (is_32bit_elf)
  if (is_32bit_elf)
    {
    {
      Elf32_External_Rel * erels;
      Elf32_External_Rel * erels;
 
 
      erels = (Elf32_External_Rel *) get_data (NULL, file, rel_offset, 1,
      erels = (Elf32_External_Rel *) get_data (NULL, file, rel_offset, 1,
                                               rel_size, _("relocs"));
                                               rel_size, _("32-bit relocation data"));
      if (!erels)
      if (!erels)
        return 0;
        return 0;
 
 
      nrels = rel_size / sizeof (Elf32_External_Rel);
      nrels = rel_size / sizeof (Elf32_External_Rel);
 
 
Line 781... Line 785...
  else
  else
    {
    {
      Elf64_External_Rel * erels;
      Elf64_External_Rel * erels;
 
 
      erels = (Elf64_External_Rel *) get_data (NULL, file, rel_offset, 1,
      erels = (Elf64_External_Rel *) get_data (NULL, file, rel_offset, 1,
                                               rel_size, _("relocs"));
                                               rel_size, _("64-bit relocation data"));
      if (!erels)
      if (!erels)
        return 0;
        return 0;
 
 
      nrels = rel_size / sizeof (Elf64_External_Rel);
      nrels = rel_size / sizeof (Elf64_External_Rel);
 
 
Line 1172... Line 1176...
 
 
        case EM_VAX:
        case EM_VAX:
          rtype = elf_vax_reloc_type (type);
          rtype = elf_vax_reloc_type (type);
          break;
          break;
 
 
 
        case EM_ADAPTEVA_EPIPHANY:
 
          rtype = elf_epiphany_reloc_type (type);
 
          break;
 
 
        case EM_IP2K:
        case EM_IP2K:
        case EM_IP2K_OLD:
        case EM_IP2K_OLD:
          rtype = elf_ip2k_reloc_type (type);
          rtype = elf_ip2k_reloc_type (type);
          break;
          break;
 
 
Line 1217... Line 1225...
        case EM_MICROBLAZE:
        case EM_MICROBLAZE:
        case EM_MICROBLAZE_OLD:
        case EM_MICROBLAZE_OLD:
          rtype = elf_microblaze_reloc_type (type);
          rtype = elf_microblaze_reloc_type (type);
          break;
          break;
 
 
 
        case EM_RL78:
 
          rtype = elf_rl78_reloc_type (type);
 
          break;
 
 
        case EM_RX:
        case EM_RX:
          rtype = elf_rx_reloc_type (type);
          rtype = elf_rx_reloc_type (type);
          break;
          break;
 
 
        case EM_XC16X:
        case EM_XC16X:
Line 1916... Line 1928...
    case EM_XSTORMY16:          return "Sanyo XStormy16 CPU core";
    case EM_XSTORMY16:          return "Sanyo XStormy16 CPU core";
    case EM_OPENRISC:
    case EM_OPENRISC:
    case EM_OR32:               return "OpenRISC";
    case EM_OR32:               return "OpenRISC";
    case EM_ARC_A5:             return "ARC International ARCompact processor";
    case EM_ARC_A5:             return "ARC International ARCompact processor";
    case EM_CRX:                return "National Semiconductor CRX microprocessor";
    case EM_CRX:                return "National Semiconductor CRX microprocessor";
 
    case EM_ADAPTEVA_EPIPHANY:  return "Adapteva EPIPHANY";
    case EM_DLX:                return "OpenDLX";
    case EM_DLX:                return "OpenDLX";
    case EM_IP2K_OLD:
    case EM_IP2K_OLD:
    case EM_IP2K:               return "Ubicom IP2xxx 8-bit microcontrollers";
    case EM_IP2K:               return "Ubicom IP2xxx 8-bit microcontrollers";
    case EM_IQ2000:             return "Vitesse IQ2000";
    case EM_IQ2000:             return "Vitesse IQ2000";
    case EM_XTENSA_OLD:
    case EM_XTENSA_OLD:
Line 1976... Line 1989...
    case EM_CYGNUS_MEP:         return "Toshiba MeP Media Engine";
    case EM_CYGNUS_MEP:         return "Toshiba MeP Media Engine";
    case EM_CR16:
    case EM_CR16:
    case EM_CR16_OLD:           return "National Semiconductor's CR16";
    case EM_CR16_OLD:           return "National Semiconductor's CR16";
    case EM_MICROBLAZE:         return "Xilinx MicroBlaze";
    case EM_MICROBLAZE:         return "Xilinx MicroBlaze";
    case EM_MICROBLAZE_OLD:     return "Xilinx MicroBlaze";
    case EM_MICROBLAZE_OLD:     return "Xilinx MicroBlaze";
 
    case EM_RL78:               return "Renesas RL78";
    case EM_RX:                 return "Renesas RX";
    case EM_RX:                 return "Renesas RX";
    case EM_METAG:              return "Imagination Technologies META processor architecture";
    case EM_METAG:              return "Imagination Technologies META processor architecture";
    case EM_MCST_ELBRUS:        return "MCST Elbrus general purpose hardware architecture";
    case EM_MCST_ELBRUS:        return "MCST Elbrus general purpose hardware architecture";
    case EM_ECOG16:             return "Cyan Technology eCOG16 family";
    case EM_ECOG16:             return "Cyan Technology eCOG16 family";
    case EM_ETPU:               return "Freescale Extended Time Processing Unit";
    case EM_ETPU:               return "Freescale Extended Time Processing Unit";
Line 2600... Line 2614...
        case EM_RX:
        case EM_RX:
          if (e_flags & E_FLAG_RX_64BIT_DOUBLES)
          if (e_flags & E_FLAG_RX_64BIT_DOUBLES)
            strcat (buf, ", 64-bit doubles");
            strcat (buf, ", 64-bit doubles");
          if (e_flags & E_FLAG_RX_DSP)
          if (e_flags & E_FLAG_RX_DSP)
            strcat (buf, ", dsp");
            strcat (buf, ", dsp");
 
          if (e_flags & E_FLAG_RX_PID)
 
            strcat (buf, ", pid");
 
          break;
 
 
        case EM_S390:
        case EM_S390:
          if (e_flags & EF_S390_HIGH_GPRS)
          if (e_flags & EF_S390_HIGH_GPRS)
            strcat (buf, ", highgprs");
            strcat (buf, ", highgprs");
 
          break;
 
 
        case EM_TI_C6000:
        case EM_TI_C6000:
          if ((e_flags & EF_C6000_REL))
          if ((e_flags & EF_C6000_REL))
            strcat (buf, ", relocatable module");
            strcat (buf, ", relocatable module");
 
          break;
        }
        }
    }
    }
 
 
  return buf;
  return buf;
}
}
Line 3795... Line 3814...
 
 
              if ((unsigned long) segment->p_memsz == segment->p_memsz)
              if ((unsigned long) segment->p_memsz == segment->p_memsz)
                printf ("0x%6.6lx", (unsigned long) segment->p_memsz);
                printf ("0x%6.6lx", (unsigned long) segment->p_memsz);
              else
              else
                {
                {
                  print_vma (segment->p_offset, FULL_HEX);
                  print_vma (segment->p_memsz, FULL_HEX);
                }
                }
 
 
              printf (" %c%c%c ",
              printf (" %c%c%c ",
                      (segment->p_flags & PF_R ? 'R' : ' '),
                      (segment->p_flags & PF_R ? 'R' : ' '),
                      (segment->p_flags & PF_W ? 'W' : ' '),
                      (segment->p_flags & PF_W ? 'W' : ' '),
Line 4050... Line 4069...
 
 
  return 1;
  return 1;
}
}
 
 
static Elf_Internal_Sym *
static Elf_Internal_Sym *
get_32bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section)
get_32bit_elf_symbols (FILE * file,
 
                       Elf_Internal_Shdr * section,
 
                       unsigned long * num_syms_return)
{
{
  unsigned long number;
  unsigned long number = 0;
  Elf32_External_Sym * esyms = NULL;
  Elf32_External_Sym * esyms = NULL;
  Elf_External_Sym_Shndx * shndx;
  Elf_External_Sym_Shndx * shndx = NULL;
  Elf_Internal_Sym * isyms = NULL;
  Elf_Internal_Sym * isyms = NULL;
  Elf_Internal_Sym * psym;
  Elf_Internal_Sym * psym;
  unsigned int j;
  unsigned int j;
 
 
  /* Run some sanity checks first.  */
  /* Run some sanity checks first.  */
  if (section->sh_entsize == 0)
  if (section->sh_entsize == 0)
    {
    {
      error (_("sh_entsize is zero\n"));
      error (_("sh_entsize is zero\n"));
      return NULL;
      goto exit_point;
    }
    }
 
 
  number = section->sh_size / section->sh_entsize;
  number = section->sh_size / section->sh_entsize;
 
 
  if (number * sizeof (Elf32_External_Sym) > section->sh_size + 1)
  if (number * sizeof (Elf32_External_Sym) > section->sh_size + 1)
    {
    {
      error (_("Invalid sh_entsize\n"));
      error (_("Invalid sh_entsize\n"));
      return NULL;
      goto exit_point;
    }
    }
 
 
  esyms = (Elf32_External_Sym *) get_data (NULL, file, section->sh_offset, 1,
  esyms = (Elf32_External_Sym *) get_data (NULL, file, section->sh_offset, 1,
                                           section->sh_size, _("symbols"));
                                           section->sh_size, _("symbols"));
  if (esyms == NULL)
  if (esyms == NULL)
    return NULL;
    goto exit_point;
 
 
  shndx = NULL;
  shndx = NULL;
  if (symtab_shndx_hdr != NULL
  if (symtab_shndx_hdr != NULL
      && (symtab_shndx_hdr->sh_link
      && (symtab_shndx_hdr->sh_link
          == (unsigned long) (section - section_headers)))
          == (unsigned long) (section - section_headers)))
    {
    {
      shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file,
      shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file,
                                                   symtab_shndx_hdr->sh_offset,
                                                   symtab_shndx_hdr->sh_offset,
                                                   1, symtab_shndx_hdr->sh_size,
                                                   1, symtab_shndx_hdr->sh_size,
                                                   _("symtab shndx"));
                                                   _("symbol table section indicies"));
      if (shndx == NULL)
      if (shndx == NULL)
        goto exit_point;
        goto exit_point;
    }
    }
 
 
  isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym));
  isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym));
Line 4116... Line 4137...
      psym->st_info  = BYTE_GET (esyms[j].st_info);
      psym->st_info  = BYTE_GET (esyms[j].st_info);
      psym->st_other = BYTE_GET (esyms[j].st_other);
      psym->st_other = BYTE_GET (esyms[j].st_other);
    }
    }
 
 
 exit_point:
 exit_point:
  if (shndx)
  if (shndx != NULL)
    free (shndx);
    free (shndx);
  if (esyms)
  if (esyms != NULL)
    free (esyms);
    free (esyms);
 
 
 
  if (num_syms_return != NULL)
 
    * num_syms_return = isyms == NULL ? 0 : number;
 
 
  return isyms;
  return isyms;
}
}
 
 
static Elf_Internal_Sym *
static Elf_Internal_Sym *
get_64bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section)
get_64bit_elf_symbols (FILE * file,
 
                       Elf_Internal_Shdr * section,
 
                       unsigned long * num_syms_return)
{
{
  unsigned long number;
  unsigned long number = 0;
  Elf64_External_Sym * esyms;
  Elf64_External_Sym * esyms = NULL;
  Elf_External_Sym_Shndx * shndx;
  Elf_External_Sym_Shndx * shndx = NULL;
  Elf_Internal_Sym * isyms;
  Elf_Internal_Sym * isyms = NULL;
  Elf_Internal_Sym * psym;
  Elf_Internal_Sym * psym;
  unsigned int j;
  unsigned int j;
 
 
  /* Run some sanity checks first.  */
  /* Run some sanity checks first.  */
  if (section->sh_entsize == 0)
  if (section->sh_entsize == 0)
    {
    {
      error (_("sh_entsize is zero\n"));
      error (_("sh_entsize is zero\n"));
      return NULL;
      goto exit_point;
    }
    }
 
 
  number = section->sh_size / section->sh_entsize;
  number = section->sh_size / section->sh_entsize;
 
 
  if (number * sizeof (Elf64_External_Sym) > section->sh_size + 1)
  if (number * sizeof (Elf64_External_Sym) > section->sh_size + 1)
    {
    {
      error (_("Invalid sh_entsize\n"));
      error (_("Invalid sh_entsize\n"));
      return NULL;
      goto exit_point;
    }
    }
 
 
  esyms = (Elf64_External_Sym *) get_data (NULL, file, section->sh_offset, 1,
  esyms = (Elf64_External_Sym *) get_data (NULL, file, section->sh_offset, 1,
                                           section->sh_size, _("symbols"));
                                           section->sh_size, _("symbols"));
  if (!esyms)
  if (!esyms)
    return NULL;
    goto exit_point;
 
 
  shndx = NULL;
 
  if (symtab_shndx_hdr != NULL
  if (symtab_shndx_hdr != NULL
      && (symtab_shndx_hdr->sh_link
      && (symtab_shndx_hdr->sh_link
          == (unsigned long) (section - section_headers)))
          == (unsigned long) (section - section_headers)))
    {
    {
      shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file,
      shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file,
                                                   symtab_shndx_hdr->sh_offset,
                                                   symtab_shndx_hdr->sh_offset,
                                                   1, symtab_shndx_hdr->sh_size,
                                                   1, symtab_shndx_hdr->sh_size,
                                                   _("symtab shndx"));
                                                   _("symbol table section indicies"));
      if (!shndx)
      if (shndx == NULL)
        {
        goto exit_point;
          free (esyms);
 
          return NULL;
 
        }
 
    }
    }
 
 
  isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym));
  isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym));
 
 
  if (isyms == NULL)
  if (isyms == NULL)
    {
    {
      error (_("Out of memory\n"));
      error (_("Out of memory\n"));
      if (shndx)
      goto exit_point;
        free (shndx);
 
      free (esyms);
 
      return NULL;
 
    }
    }
 
 
  for (j = 0, psym = isyms;
  for (j = 0, psym = isyms; j < number; j++, psym++)
       j < number;
 
       j++, psym++)
 
    {
    {
      psym->st_name  = BYTE_GET (esyms[j].st_name);
      psym->st_name  = BYTE_GET (esyms[j].st_name);
      psym->st_info  = BYTE_GET (esyms[j].st_info);
      psym->st_info  = BYTE_GET (esyms[j].st_info);
      psym->st_other = BYTE_GET (esyms[j].st_other);
      psym->st_other = BYTE_GET (esyms[j].st_other);
      psym->st_shndx = BYTE_GET (esyms[j].st_shndx);
      psym->st_shndx = BYTE_GET (esyms[j].st_shndx);
 
 
      if (psym->st_shndx == (SHN_XINDEX & 0xffff) && shndx != NULL)
      if (psym->st_shndx == (SHN_XINDEX & 0xffff) && shndx != NULL)
        psym->st_shndx
        psym->st_shndx
          = byte_get ((unsigned char *) &shndx[j], sizeof (shndx[j]));
          = byte_get ((unsigned char *) &shndx[j], sizeof (shndx[j]));
      else if (psym->st_shndx >= (SHN_LORESERVE & 0xffff))
      else if (psym->st_shndx >= (SHN_LORESERVE & 0xffff))
        psym->st_shndx += SHN_LORESERVE - (SHN_LORESERVE & 0xffff);
        psym->st_shndx += SHN_LORESERVE - (SHN_LORESERVE & 0xffff);
 
 
      psym->st_value = BYTE_GET (esyms[j].st_value);
      psym->st_value = BYTE_GET (esyms[j].st_value);
      psym->st_size  = BYTE_GET (esyms[j].st_size);
      psym->st_size  = BYTE_GET (esyms[j].st_size);
    }
    }
 
 
  if (shndx)
 exit_point:
 
  if (shndx != NULL)
    free (shndx);
    free (shndx);
 
  if (esyms != NULL)
  free (esyms);
  free (esyms);
 
 
 
  if (num_syms_return != NULL)
 
    * num_syms_return = isyms == NULL ? 0 : number;
 
 
  return isyms;
  return isyms;
}
}
 
 
static const char *
static const char *
get_elf_section_flags (bfd_vma sh_flags)
get_elf_section_flags (bfd_vma sh_flags)
Line 4568... Line 4592...
              error (_("File contains multiple dynamic symbol tables\n"));
              error (_("File contains multiple dynamic symbol tables\n"));
              continue;
              continue;
            }
            }
 
 
          CHECK_ENTSIZE (section, i, Sym);
          CHECK_ENTSIZE (section, i, Sym);
          num_dynamic_syms = section->sh_size / section->sh_entsize;
          dynamic_symbols = GET_ELF_SYMBOLS (file, section, & num_dynamic_syms);
          dynamic_symbols = GET_ELF_SYMBOLS (file, section);
 
        }
        }
      else if (section->sh_type == SHT_STRTAB
      else if (section->sh_type == SHT_STRTAB
               && streq (name, ".dynstr"))
               && streq (name, ".dynstr"))
        {
        {
          if (dynamic_strings != NULL)
          if (dynamic_strings != NULL)
Line 4924... Line 4947...
  unsigned int i;
  unsigned int i;
  struct group * group;
  struct group * group;
  Elf_Internal_Shdr * symtab_sec;
  Elf_Internal_Shdr * symtab_sec;
  Elf_Internal_Shdr * strtab_sec;
  Elf_Internal_Shdr * strtab_sec;
  Elf_Internal_Sym * symtab;
  Elf_Internal_Sym * symtab;
 
  unsigned long num_syms;
  char * strtab;
  char * strtab;
  size_t strtab_size;
  size_t strtab_size;
 
 
  /* Don't process section groups unless needed.  */
  /* Don't process section groups unless needed.  */
  if (!do_unwind && !do_section_groups)
  if (!do_unwind && !do_section_groups)
Line 4981... Line 5005...
    }
    }
 
 
  symtab_sec = NULL;
  symtab_sec = NULL;
  strtab_sec = NULL;
  strtab_sec = NULL;
  symtab = NULL;
  symtab = NULL;
 
  num_syms = 0;
  strtab = NULL;
  strtab = NULL;
  strtab_size = 0;
  strtab_size = 0;
  for (i = 0, section = section_headers, group = section_groups;
  for (i = 0, section = section_headers, group = section_groups;
       i < elf_header.e_shnum;
       i < elf_header.e_shnum;
       i++, section++)
       i++, section++)
Line 5011... Line 5036...
          if (symtab_sec != sec)
          if (symtab_sec != sec)
            {
            {
              symtab_sec = sec;
              symtab_sec = sec;
              if (symtab)
              if (symtab)
                free (symtab);
                free (symtab);
              symtab = GET_ELF_SYMBOLS (file, symtab_sec);
              symtab = GET_ELF_SYMBOLS (file, symtab_sec, & num_syms);
            }
            }
 
 
          if (symtab == NULL)
          if (symtab == NULL)
            {
            {
              error (_("Corrupt header in group section `%s'\n"), name);
              error (_("Corrupt header in group section `%s'\n"), name);
              continue;
              continue;
            }
            }
 
 
 
          if (section->sh_info >= num_syms)
 
            {
 
              error (_("Bad sh_info in group section `%s'\n"), name);
 
              continue;
 
            }
 
 
          sym = symtab + section->sh_info;
          sym = symtab + section->sh_info;
 
 
          if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
          if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
            {
            {
              if (sym->st_shndx == 0
              if (sym->st_shndx == 0
Line 5230... Line 5261...
  Elf64_External_VMS_IMAGE_RELA *imrs;
  Elf64_External_VMS_IMAGE_RELA *imrs;
  long i;
  long i;
 
 
  imrs = get_data (NULL, file, dynamic_addr + imgrela->img_rela_off,
  imrs = get_data (NULL, file, dynamic_addr + imgrela->img_rela_off,
                   1, imgrela->img_rela_cnt * sizeof (*imrs),
                   1, imgrela->img_rela_cnt * sizeof (*imrs),
                   _("dynamic section image relas"));
                   _("dynamic section image relocations"));
  if (!imrs)
  if (!imrs)
    return;
    return;
 
 
  printf (_("\nImage relocs\n"));
  printf (_("\nImage relocs\n"));
  printf
  printf
Line 5436... Line 5467...
              printf (_("\nRelocation section "));
              printf (_("\nRelocation section "));
 
 
              if (string_table == NULL)
              if (string_table == NULL)
                printf ("%d", section->sh_name);
                printf ("%d", section->sh_name);
              else
              else
                printf (_("'%s'"), SECTION_NAME (section));
                printf ("'%s'", SECTION_NAME (section));
 
 
              printf (_(" at offset 0x%lx contains %lu entries:\n"),
              printf (_(" at offset 0x%lx contains %lu entries:\n"),
                 rel_offset, (unsigned long) (rel_size / section->sh_entsize));
                 rel_offset, (unsigned long) (rel_size / section->sh_entsize));
 
 
              is_rela = section->sh_type == SHT_RELA;
              is_rela = section->sh_type == SHT_RELA;
Line 5457... Line 5488...
                  symsec = section_headers + section->sh_link;
                  symsec = section_headers + section->sh_link;
                  if (symsec->sh_type != SHT_SYMTAB
                  if (symsec->sh_type != SHT_SYMTAB
                      && symsec->sh_type != SHT_DYNSYM)
                      && symsec->sh_type != SHT_DYNSYM)
                    continue;
                    continue;
 
 
                  nsyms = symsec->sh_size / symsec->sh_entsize;
                  symtab = GET_ELF_SYMBOLS (file, symsec, & nsyms);
                  symtab = GET_ELF_SYMBOLS (file, symsec);
 
 
 
                  if (symtab == NULL)
                  if (symtab == NULL)
                    continue;
                    continue;
 
 
                  if (symsec->sh_link != 0
                  if (symsec->sh_link != 0
Line 5770... Line 5800...
  for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec)
  for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec)
    {
    {
      if (sec->sh_type == SHT_SYMTAB
      if (sec->sh_type == SHT_SYMTAB
          && sec->sh_link < elf_header.e_shnum)
          && sec->sh_link < elf_header.e_shnum)
        {
        {
          aux.nsyms = sec->sh_size / sec->sh_entsize;
          aux.symtab = GET_ELF_SYMBOLS (file, sec, & aux.nsyms);
          aux.symtab = GET_ELF_SYMBOLS (file, sec);
 
 
 
          strsec = section_headers + sec->sh_link;
          strsec = section_headers + sec->sh_link;
          assert (aux.strtab == NULL);
          assert (aux.strtab == NULL);
          aux.strtab = (char *) get_data (NULL, file, strsec->sh_offset,
          aux.strtab = (char *) get_data (NULL, file, strsec->sh_offset,
                                          1, strsec->sh_size,
                                          1, strsec->sh_size,
Line 6184... Line 6213...
  for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec)
  for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec)
    {
    {
      if (sec->sh_type == SHT_SYMTAB
      if (sec->sh_type == SHT_SYMTAB
          && sec->sh_link < elf_header.e_shnum)
          && sec->sh_link < elf_header.e_shnum)
        {
        {
          aux.nsyms = sec->sh_size / sec->sh_entsize;
          aux.symtab = GET_ELF_SYMBOLS (file, sec, & aux.nsyms);
          aux.symtab = GET_ELF_SYMBOLS (file, sec);
 
 
 
          strsec = section_headers + sec->sh_link;
          strsec = section_headers + sec->sh_link;
          assert (aux.strtab == NULL);
          assert (aux.strtab == NULL);
          aux.strtab = (char *) get_data (NULL, file, strsec->sh_offset,
          aux.strtab = (char *) get_data (NULL, file, strsec->sh_offset,
                                          1, strsec->sh_size,
                                          1, strsec->sh_size,
Line 6704... Line 6732...
        break;
        break;
      remaining--;
      remaining--;
      op = word >> 24;
      op = word >> 24;
      word <<= 8;
      word <<= 8;
 
 
      printf (_("  0x%02x "), op);
      printf ("  0x%02x ", op);
 
 
      if ((op & 0xc0) == 0x00)
      if ((op & 0xc0) == 0x00)
        {
        {
          int offset = ((op & 0x3f) << 3) + 8;
          int offset = ((op & 0x3f) << 3) + 8;
          printf (_("     sp = sp + %d"), offset);
          printf ("     sp = sp + %d", offset);
        }
        }
      else if ((op & 0xc0) == 0x80)
      else if ((op & 0xc0) == 0x80)
        {
        {
          GET_OP (op2);
          GET_OP (op2);
          if (op == 0x80 && op2 == 0)
          if (op == 0x80 && op2 == 0)
Line 7069... Line 7097...
 
 
  for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec)
  for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec)
    {
    {
      if (sec->sh_type == SHT_SYMTAB && sec->sh_link < elf_header.e_shnum)
      if (sec->sh_type == SHT_SYMTAB && sec->sh_link < elf_header.e_shnum)
        {
        {
          aux.nsyms = sec->sh_size / sec->sh_entsize;
          aux.symtab = GET_ELF_SYMBOLS (file, sec, & aux.nsyms);
          aux.symtab = GET_ELF_SYMBOLS (file, sec);
 
 
 
          strsec = section_headers + sec->sh_link;
          strsec = section_headers + sec->sh_link;
          assert (aux.strtab == NULL);
          assert (aux.strtab == NULL);
          aux.strtab = get_data (NULL, file, strsec->sh_offset,
          aux.strtab = get_data (NULL, file, strsec->sh_offset,
                                 1, strsec->sh_size, _("string table"));
                                 1, strsec->sh_size, _("string table"));
Line 7531... Line 7558...
          if (is_32bit_elf)
          if (is_32bit_elf)
            section.sh_entsize = sizeof (Elf32_External_Sym);
            section.sh_entsize = sizeof (Elf32_External_Sym);
          else
          else
            section.sh_entsize = sizeof (Elf64_External_Sym);
            section.sh_entsize = sizeof (Elf64_External_Sym);
 
 
          num_dynamic_syms = section.sh_size / section.sh_entsize;
          dynamic_symbols = GET_ELF_SYMBOLS (file, &section, & num_dynamic_syms);
          if (num_dynamic_syms < 1)
          if (num_dynamic_syms < 1)
            {
            {
              error (_("Unable to determine the number of symbols to load\n"));
              error (_("Unable to determine the number of symbols to load\n"));
              continue;
              continue;
            }
            }
 
 
          dynamic_symbols = GET_ELF_SYMBOLS (file, &section);
 
        }
        }
    }
    }
 
 
  /* Similarly find a string table.  */
  /* Similarly find a string table.  */
  if (dynamic_strings == NULL)
  if (dynamic_strings == NULL)
Line 8239... Line 8264...
                    : _("<corrupt>"));
                    : _("<corrupt>"));
 
 
            eneed = (Elf_External_Verneed *) get_data (NULL, file,
            eneed = (Elf_External_Verneed *) get_data (NULL, file,
                                                       section->sh_offset, 1,
                                                       section->sh_offset, 1,
                                                       section->sh_size,
                                                       section->sh_size,
                                                       _("version need section"));
                                                       _("Version Needs section"));
            if (!eneed)
            if (!eneed)
              break;
              break;
            endbuf = (char *) eneed + section->sh_size;
            endbuf = (char *) eneed + section->sh_size;
 
 
            for (idx = cnt = 0; cnt < section->sh_info; ++cnt)
            for (idx = cnt = 0; cnt < section->sh_info; ++cnt)
Line 8316... Line 8341...
                      break;
                      break;
 
 
                    isum   += aux.vna_next;
                    isum   += aux.vna_next;
                    vstart += aux.vna_next;
                    vstart += aux.vna_next;
                  }
                  }
 
 
                if (j < ent.vn_cnt)
                if (j < ent.vn_cnt)
                  printf (_("  Version need aux past end of section\n"));
                  warn (_("Missing Version Needs auxillary information\n"));
 
 
                idx += ent.vn_next;
                idx += ent.vn_next;
              }
              }
 
 
            if (cnt < section->sh_info)
            if (cnt < section->sh_info)
              printf (_("  Version need past end of section\n"));
              warn (_("Missing Version Needs information\n"));
 
 
            free (eneed);
            free (eneed);
          }
          }
          break;
          break;
 
 
Line 8338... Line 8365...
            unsigned char * edata;
            unsigned char * edata;
            unsigned short * data;
            unsigned short * data;
            char * strtab;
            char * strtab;
            Elf_Internal_Sym * symbols;
            Elf_Internal_Sym * symbols;
            Elf_Internal_Shdr * string_sec;
            Elf_Internal_Shdr * string_sec;
 
            unsigned long num_syms;
            long off;
            long off;
 
 
            if (section->sh_link >= elf_header.e_shnum)
            if (section->sh_link >= elf_header.e_shnum)
              break;
              break;
 
 
Line 8351... Line 8379...
            if (link_section->sh_link >= elf_header.e_shnum)
            if (link_section->sh_link >= elf_header.e_shnum)
              break;
              break;
 
 
            found = 1;
            found = 1;
 
 
            symbols = GET_ELF_SYMBOLS (file, link_section);
            symbols = GET_ELF_SYMBOLS (file, link_section, & num_syms);
            if (symbols == NULL)
            if (symbols == NULL)
              break;
              break;
 
 
            string_sec = section_headers + link_section->sh_link;
            string_sec = section_headers + link_section->sh_link;
 
 
Line 8420... Line 8448...
                    default:
                    default:
                      nn = printf ("%4x%c", data[cnt + j] & VERSYM_VERSION,
                      nn = printf ("%4x%c", data[cnt + j] & VERSYM_VERSION,
                                   data[cnt + j] & VERSYM_HIDDEN ? 'h' : ' ');
                                   data[cnt + j] & VERSYM_HIDDEN ? 'h' : ' ');
 
 
                      /* If this index value is greater than the size of the symbols
                      /* If this index value is greater than the size of the symbols
                         array, break to avoid an out-of-bounds read,  */
                         array, break to avoid an out-of-bounds read.  */
                      if ((unsigned long)(cnt + j) >=
                      if ((unsigned long)(cnt + j) >= num_syms)
                         ((unsigned long)link_section->sh_size /
 
                          (unsigned long)link_section->sh_entsize))
 
                        {
                        {
                          warn (_("invalid index into symbol array\n"));
                          warn (_("invalid index into symbol array\n"));
                          break;
                          break;
                        }
                        }
 
 
Line 9155... Line 9181...
          unsigned int si;
          unsigned int si;
          char * strtab = NULL;
          char * strtab = NULL;
          unsigned long int strtab_size = 0;
          unsigned long int strtab_size = 0;
          Elf_Internal_Sym * symtab;
          Elf_Internal_Sym * symtab;
          Elf_Internal_Sym * psym;
          Elf_Internal_Sym * psym;
 
          unsigned long num_syms;
 
 
          if ((section->sh_type != SHT_SYMTAB
          if ((section->sh_type != SHT_SYMTAB
               && section->sh_type != SHT_DYNSYM)
               && section->sh_type != SHT_DYNSYM)
              || (!do_syms
              || (!do_syms
                  && section->sh_type == SHT_SYMTAB))
                  && section->sh_type == SHT_SYMTAB))
Line 9178... Line 9205...
          if (is_32bit_elf)
          if (is_32bit_elf)
            printf (_("   Num:    Value  Size Type    Bind   Vis      Ndx Name\n"));
            printf (_("   Num:    Value  Size Type    Bind   Vis      Ndx Name\n"));
          else
          else
            printf (_("   Num:    Value          Size Type    Bind   Vis      Ndx Name\n"));
            printf (_("   Num:    Value          Size Type    Bind   Vis      Ndx Name\n"));
 
 
          symtab = GET_ELF_SYMBOLS (file, section);
          symtab = GET_ELF_SYMBOLS (file, section, & num_syms);
          if (symtab == NULL)
          if (symtab == NULL)
            continue;
            continue;
 
 
          if (section->sh_link == elf_header.e_shstrndx)
          if (section->sh_link == elf_header.e_shstrndx)
            {
            {
Line 9199... Line 9226...
                                          1, string_sec->sh_size,
                                          1, string_sec->sh_size,
                                          _("string table"));
                                          _("string table"));
              strtab_size = strtab != NULL ? string_sec->sh_size : 0;
              strtab_size = strtab != NULL ? string_sec->sh_size : 0;
            }
            }
 
 
          for (si = 0, psym = symtab;
          for (si = 0, psym = symtab; si < num_syms; si++, psym++)
               si < section->sh_size / section->sh_entsize;
 
               si++, psym++)
 
            {
            {
              printf ("%6d: ", si);
              printf ("%6d: ", si);
              print_vma (psym->st_value, LONG_HEX);
              print_vma (psym->st_value, LONG_HEX);
              putchar (' ');
              putchar (' ');
              print_vma (psym->st_size, DEC_5);
              print_vma (psym->st_size, DEC_5);
Line 9674... Line 9699...
    case EM_ARM:
    case EM_ARM:
      return reloc_type == 2; /* R_ARM_ABS32 */
      return reloc_type == 2; /* R_ARM_ABS32 */
    case EM_AVR_OLD:
    case EM_AVR_OLD:
    case EM_AVR:
    case EM_AVR:
      return reloc_type == 1;
      return reloc_type == 1;
 
    case EM_ADAPTEVA_EPIPHANY:
 
      return reloc_type == 3;
    case EM_BLACKFIN:
    case EM_BLACKFIN:
      return reloc_type == 0x12; /* R_byte4_data.  */
      return reloc_type == 0x12; /* R_byte4_data.  */
    case EM_CRIS:
    case EM_CRIS:
      return reloc_type == 3; /* R_CRIS_32.  */
      return reloc_type == 3; /* R_CRIS_32.  */
    case EM_CR16:
    case EM_CR16:
Line 9755... Line 9782...
      return reloc_type == 1; /* R_PJ_DATA_DIR32.  */
      return reloc_type == 1; /* R_PJ_DATA_DIR32.  */
    case EM_PPC64:
    case EM_PPC64:
      return reloc_type == 1; /* R_PPC64_ADDR32.  */
      return reloc_type == 1; /* R_PPC64_ADDR32.  */
    case EM_PPC:
    case EM_PPC:
      return reloc_type == 1; /* R_PPC_ADDR32.  */
      return reloc_type == 1; /* R_PPC_ADDR32.  */
 
    case EM_RL78:
 
      return reloc_type == 1; /* R_RL78_DIR32.  */
    case EM_RX:
    case EM_RX:
      return reloc_type == 1; /* R_RX_DIR32.  */
      return reloc_type == 1; /* R_RX_DIR32.  */
    case EM_S370:
    case EM_S370:
      return reloc_type == 1; /* R_I370_ADDR31.  */
      return reloc_type == 1; /* R_I370_ADDR31.  */
    case EM_S390_OLD:
    case EM_S390_OLD:
Line 9816... Line 9845...
    case EM_386:
    case EM_386:
    case EM_486:
    case EM_486:
      return reloc_type == 2;  /* R_386_PC32.  */
      return reloc_type == 2;  /* R_386_PC32.  */
    case EM_68K:
    case EM_68K:
      return reloc_type == 4;  /* R_68K_PC32.  */
      return reloc_type == 4;  /* R_68K_PC32.  */
 
    case EM_ADAPTEVA_EPIPHANY:
 
      return reloc_type == 6;
    case EM_ALPHA:
    case EM_ALPHA:
      return reloc_type == 10; /* R_ALPHA_SREL32.  */
      return reloc_type == 10; /* R_ALPHA_SREL32.  */
    case EM_ARM:
    case EM_ARM:
      return reloc_type == 3;  /* R_ARM_REL32 */
      return reloc_type == 3;  /* R_ARM_REL32 */
    case EM_MICROBLAZE:
    case EM_MICROBLAZE:
Line 9957... Line 9988...
  switch (elf_header.e_machine)
  switch (elf_header.e_machine)
    {
    {
    case EM_AVR_OLD:
    case EM_AVR_OLD:
    case EM_AVR:
    case EM_AVR:
      return reloc_type == 4; /* R_AVR_16.  */
      return reloc_type == 4; /* R_AVR_16.  */
 
    case EM_ADAPTEVA_EPIPHANY:
 
      return reloc_type == 5;
    case EM_CYGNUS_D10V:
    case EM_CYGNUS_D10V:
    case EM_D10V:
    case EM_D10V:
      return reloc_type == 3; /* R_D10V_16.  */
      return reloc_type == 3; /* R_D10V_16.  */
    case EM_H8S:
    case EM_H8S:
    case EM_H8_300:
    case EM_H8_300:
Line 10004... Line 10037...
    case EM_SPARCV9:
    case EM_SPARCV9:
    case EM_SPARC:   /* R_SPARC_NONE.  */
    case EM_SPARC:   /* R_SPARC_NONE.  */
    case EM_MIPS:    /* R_MIPS_NONE.  */
    case EM_MIPS:    /* R_MIPS_NONE.  */
    case EM_PARISC:  /* R_PARISC_NONE.  */
    case EM_PARISC:  /* R_PARISC_NONE.  */
    case EM_ALPHA:   /* R_ALPHA_NONE.  */
    case EM_ALPHA:   /* R_ALPHA_NONE.  */
 
    case EM_ADAPTEVA_EPIPHANY:
    case EM_PPC:     /* R_PPC_NONE.  */
    case EM_PPC:     /* R_PPC_NONE.  */
    case EM_PPC64:   /* R_PPC64_NONE.  */
    case EM_PPC64:   /* R_PPC64_NONE.  */
    case EM_ARM:     /* R_ARM_NONE.  */
    case EM_ARM:     /* R_ARM_NONE.  */
    case EM_IA_64:   /* R_IA64_NONE.  */
    case EM_IA_64:   /* R_IA64_NONE.  */
    case EM_SH:      /* R_SH_NONE.  */
    case EM_SH:      /* R_SH_NONE.  */
Line 10061... Line 10095...
      unsigned long num_relocs;
      unsigned long num_relocs;
      Elf_Internal_Rela * relocs;
      Elf_Internal_Rela * relocs;
      Elf_Internal_Rela * rp;
      Elf_Internal_Rela * rp;
      Elf_Internal_Shdr * symsec;
      Elf_Internal_Shdr * symsec;
      Elf_Internal_Sym * symtab;
      Elf_Internal_Sym * symtab;
 
      unsigned long num_syms;
      Elf_Internal_Sym * sym;
      Elf_Internal_Sym * sym;
 
 
      if ((relsec->sh_type != SHT_RELA && relsec->sh_type != SHT_REL)
      if ((relsec->sh_type != SHT_RELA && relsec->sh_type != SHT_REL)
          || relsec->sh_info >= elf_header.e_shnum
          || relsec->sh_info >= elf_header.e_shnum
          || section_headers + relsec->sh_info != section
          || section_headers + relsec->sh_info != section
Line 10090... Line 10125...
      /* SH uses RELA but uses in place value instead of the addend field.  */
      /* SH uses RELA but uses in place value instead of the addend field.  */
      if (elf_header.e_machine == EM_SH)
      if (elf_header.e_machine == EM_SH)
        is_rela = FALSE;
        is_rela = FALSE;
 
 
      symsec = section_headers + relsec->sh_link;
      symsec = section_headers + relsec->sh_link;
      symtab = GET_ELF_SYMBOLS ((FILE *) file, symsec);
      symtab = GET_ELF_SYMBOLS ((FILE *) file, symsec, & num_syms);
 
 
      for (rp = relocs; rp < relocs + num_relocs; ++rp)
      for (rp = relocs; rp < relocs + num_relocs; ++rp)
        {
        {
          bfd_vma         addend;
          bfd_vma         addend;
          unsigned int    reloc_type;
          unsigned int    reloc_type;
          unsigned int    reloc_size;
          unsigned int    reloc_size;
          unsigned char * rloc;
          unsigned char * rloc;
 
          unsigned long   sym_index;
 
 
          reloc_type = get_reloc_type (rp->r_info);
          reloc_type = get_reloc_type (rp->r_info);
 
 
          if (target_specific_reloc_handling (rp, start, symtab))
          if (target_specific_reloc_handling (rp, start, symtab))
            continue;
            continue;
Line 10131... Line 10167...
                    (unsigned long) rp->r_offset,
                    (unsigned long) rp->r_offset,
                    SECTION_NAME (section));
                    SECTION_NAME (section));
              continue;
              continue;
            }
            }
 
 
          sym = symtab + get_reloc_symindex (rp->r_info);
          sym_index = (unsigned long) get_reloc_symindex (rp->r_info);
 
          if (sym_index >= num_syms)
 
            {
 
              warn (_("skipping invalid relocation symbol index 0x%lx in section %s\n"),
 
                    sym_index, SECTION_NAME (section));
 
              continue;
 
            }
 
          sym = symtab + sym_index;
 
 
          /* If the reloc has a symbol associated with it,
          /* If the reloc has a symbol associated with it,
             make sure that it is of an appropriate type.
             make sure that it is of an appropriate type.
 
 
             Relocations against symbols without type can happen.
             Relocations against symbols without type can happen.
Line 11105... Line 11148...
    }
    }
 
 
  return p;
  return p;
}
}
 
 
 
static void
 
display_sparc_hwcaps (int mask)
 
{
 
  if (mask)
 
    {
 
      int first = 1;
 
      if (mask & ELF_SPARC_HWCAP_MUL32)
 
        fputs ("mul32", stdout), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_DIV32)
 
        printf ("%sdiv32", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_FSMULD)
 
        printf ("%sfsmuld", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_V8PLUS)
 
        printf ("%sv8plus", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_POPC)
 
        printf ("%spopc", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_VIS)
 
        printf ("%svis", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_VIS2)
 
        printf ("%svis2", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_ASI_BLK_INIT)
 
        printf ("%sASIBlkInit", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_FMAF)
 
        printf ("%sfmaf", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_VIS3)
 
        printf ("%svis3", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_HPC)
 
        printf ("%shpc", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_RANDOM)
 
        printf ("%srandom", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_TRANS)
 
        printf ("%strans", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_FJFMAU)
 
        printf ("%sfjfmau", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_IMA)
 
        printf ("%sima", first ? "" : "|"), first = 0;
 
      if (mask & ELF_SPARC_HWCAP_ASI_CACHE_SPARING)
 
        printf ("%scspare", first ? "" : "|"), first = 0;
 
    }
 
  else
 
    fputc('0', stdout);
 
  fputc('\n', stdout);
 
}
 
 
 
static unsigned char *
 
display_sparc_gnu_attribute (unsigned char * p, int tag)
 
{
 
  int type;
 
  unsigned int len;
 
  int val;
 
 
 
  if (tag == Tag_GNU_Sparc_HWCAPS)
 
    {
 
      val = read_uleb128 (p, &len);
 
      p += len;
 
      printf ("  Tag_GNU_Sparc_HWCAPS: ");
 
 
 
      display_sparc_hwcaps (val);
 
      return p;
 
   }
 
 
 
  if (tag & 1)
 
    type = 1; /* String.  */
 
  else
 
    type = 2; /* uleb128.  */
 
  printf ("  Tag_unknown_%d: ", tag);
 
 
 
  if (type == 1)
 
    {
 
      printf ("\"%s\"\n", p);
 
      p += strlen ((char *) p) + 1;
 
    }
 
  else
 
    {
 
      val = read_uleb128 (p, &len);
 
      p += len;
 
      printf ("%d (0x%x)\n", val, val);
 
    }
 
 
 
  return p;
 
}
 
 
static unsigned char *
static unsigned char *
display_mips_gnu_attribute (unsigned char * p, int tag)
display_mips_gnu_attribute (unsigned char * p, int tag)
{
{
  int type;
  int type;
  unsigned int len;
  unsigned int len;
Line 11554... Line 11679...
  return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
  return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
                             display_power_gnu_attribute);
                             display_power_gnu_attribute);
}
}
 
 
static int
static int
 
process_sparc_specific (FILE * file)
 
{
 
  return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
 
                             display_sparc_gnu_attribute);
 
}
 
 
 
static int
process_tic6x_specific (FILE * file)
process_tic6x_specific (FILE * file)
{
{
  return process_attributes (file, "c6xabi", SHT_C6000_ATTRIBUTES,
  return process_attributes (file, "c6xabi", SHT_C6000_ATTRIBUTES,
                             display_tic6x_attribute, NULL);
                             display_tic6x_attribute, NULL);
}
}
Line 11693... Line 11825...
      size_t cnt;
      size_t cnt;
 
 
      elib = (Elf32_External_Lib *) get_data (NULL, file, liblist_offset,
      elib = (Elf32_External_Lib *) get_data (NULL, file, liblist_offset,
                                              liblistno,
                                              liblistno,
                                              sizeof (Elf32_External_Lib),
                                              sizeof (Elf32_External_Lib),
                                              _("liblist"));
                                              _("liblist section data"));
      if (elib)
      if (elib)
        {
        {
          printf (_("\nSection '.liblist' contains %lu entries:\n"),
          printf (_("\nSection '.liblist' contains %lu entries:\n"),
                  (unsigned long) liblistno);
                  (unsigned long) liblistno);
          fputs (_("     Library              Time Stamp          Checksum   Version Flags\n"),
          fputs (_("     Library              Time Stamp          Checksum   Version Flags\n"),
Line 12049... Line 12181...
      local_end = pltgot + local_gotno * addr_size;
      local_end = pltgot + local_gotno * addr_size;
      global_end = local_end + (symtabno - gotsym) * addr_size;
      global_end = local_end + (symtabno - gotsym) * addr_size;
 
 
      offset = offset_from_vma (file, pltgot, global_end - pltgot);
      offset = offset_from_vma (file, pltgot, global_end - pltgot);
      data = (unsigned char *) get_data (NULL, file, offset,
      data = (unsigned char *) get_data (NULL, file, offset,
                                         global_end - pltgot, 1, _("GOT"));
                                         global_end - pltgot, 1,
 
                                         _("Global Offset Table data"));
      if (data == NULL)
      if (data == NULL)
        return 0;
        return 0;
 
 
      printf (_("\nPrimary GOT:\n"));
      printf (_("\nPrimary GOT:\n"));
      printf (_(" Canonical gp value: "));
      printf (_(" Canonical gp value: "));
Line 12093... Line 12226...
        {
        {
          int sym_width;
          int sym_width;
 
 
          printf (_(" Global entries:\n"));
          printf (_(" Global entries:\n"));
          printf ("  %*s %10s %*s %*s %-7s %3s %s\n",
          printf ("  %*s %10s %*s %*s %-7s %3s %s\n",
                  addr_size * 2, _("Address"), _("Access"),
                  addr_size * 2, _("Address"),
 
                  _("Access"),
                  addr_size * 2, _("Initial"),
                  addr_size * 2, _("Initial"),
                  addr_size * 2, _("Sym.Val."), _("Type"), _("Ndx"), _("Name"));
                  addr_size * 2, _("Sym.Val."),
 
                  _("Type"),
 
                  /* Note for translators: "Ndx" = abbreviated form of "Index".  */
 
                  _("Ndx"), _("Name"));
 
 
          sym_width = (is_32bit_elf ? 80 : 160) - 28 - addr_size * 6 - 1;
          sym_width = (is_32bit_elf ? 80 : 160) - 28 - addr_size * 6 - 1;
          for (i = gotsym; i < symtabno; i++)
          for (i = gotsym; i < symtabno; i++)
            {
            {
              Elf_Internal_Sym * psym;
              Elf_Internal_Sym * psym;
 
 
Line 12148... Line 12286...
      addr_size = (is_32bit_elf ? 4 : 8);
      addr_size = (is_32bit_elf ? 4 : 8);
      end = mips_pltgot + (2 + count) * addr_size;
      end = mips_pltgot + (2 + count) * addr_size;
 
 
      offset = offset_from_vma (file, mips_pltgot, end - mips_pltgot);
      offset = offset_from_vma (file, mips_pltgot, end - mips_pltgot);
      data = (unsigned char *) get_data (NULL, file, offset, end - mips_pltgot,
      data = (unsigned char *) get_data (NULL, file, offset, end - mips_pltgot,
                                         1, _("PLT GOT"));
                                         1, _("Procedure Linkage Table data"));
      if (data == NULL)
      if (data == NULL)
        return 0;
        return 0;
 
 
      printf (_("\nPLT GOT:\n\n"));
      printf ("\nPLT GOT:\n\n");
      printf (_(" Reserved entries:\n"));
      printf (_(" Reserved entries:\n"));
      printf (_("  %*s %*s Purpose\n"),
      printf (_("  %*s %*s Purpose\n"),
              addr_size * 2, _("Address"), addr_size * 2, _("Initial"));
              addr_size * 2, _("Address"), addr_size * 2, _("Initial"));
      ent = print_mips_pltgot_entry (data, mips_pltgot, ent);
      ent = print_mips_pltgot_entry (data, mips_pltgot, ent);
      printf (_(" PLT lazy resolver\n"));
      printf (_(" PLT lazy resolver\n"));
Line 12221... Line 12359...
          if (section->sh_link >= elf_header.e_shnum)
          if (section->sh_link >= elf_header.e_shnum)
            break;
            break;
 
 
          elib = (Elf32_External_Lib *)
          elib = (Elf32_External_Lib *)
              get_data (NULL, file, section->sh_offset, 1, section->sh_size,
              get_data (NULL, file, section->sh_offset, 1, section->sh_size,
                        _("liblist"));
                        _("liblist section data"));
 
 
          if (elib == NULL)
          if (elib == NULL)
            break;
            break;
          string_sec = section_headers + section->sh_link;
          string_sec = section_headers + section->sh_link;
 
 
Line 12389... Line 12527...
        unsigned long i;
        unsigned long i;
 
 
        printf (_("    Build ID: "));
        printf (_("    Build ID: "));
        for (i = 0; i < pnote->descsz; ++i)
        for (i = 0; i < pnote->descsz; ++i)
          printf ("%02x", pnote->descdata[i] & 0xff);
          printf ("%02x", pnote->descdata[i] & 0xff);
        printf (_("\n"));
        printf ("\n");
      }
      }
      break;
      break;
 
 
    case NT_GNU_ABI_TAG:
    case NT_GNU_ABI_TAG:
      {
      {
Line 12491... Line 12629...
        default:
        default:
          break;
          break;
        }
        }
    }
    }
 
 
  snprintf (buff, sizeof (buff), _("PT_FIRSTMACH+%d"),
  snprintf (buff, sizeof (buff), "PT_FIRSTMACH+%d",
            e_type - NT_NETBSDCORE_FIRSTMACH);
            e_type - NT_NETBSDCORE_FIRSTMACH);
  return buff;
  return buff;
}
}
 
 
static const char *
static const char *
Line 12545... Line 12683...
  print_vma (pc, FULL_HEX);
  print_vma (pc, FULL_HEX);
  printf (_(", Base: "));
  printf (_(", Base: "));
  print_vma (base_addr, FULL_HEX);
  print_vma (base_addr, FULL_HEX);
  printf (_(", Semaphore: "));
  printf (_(", Semaphore: "));
  print_vma (semaphore, FULL_HEX);
  print_vma (semaphore, FULL_HEX);
  printf (_("\n"));
  printf ("\n");
  printf (_("    Arguments: %s\n"), arg_fmt);
  printf (_("    Arguments: %s\n"), arg_fmt);
 
 
  return data == data_end;
  return data == data_end;
}
}
 
 
Line 12565... Line 12703...
    case NT_VMS_LNM:
    case NT_VMS_LNM:
      return _("NT_VMS_LNM (language name)");
      return _("NT_VMS_LNM (language name)");
    case NT_VMS_SRC:
    case NT_VMS_SRC:
      return _("NT_VMS_SRC (source files)");
      return _("NT_VMS_SRC (source files)");
    case NT_VMS_TITLE:
    case NT_VMS_TITLE:
      return _("NT_VMS_TITLE");
      return "NT_VMS_TITLE";
    case NT_VMS_EIDC:
    case NT_VMS_EIDC:
      return _("NT_VMS_EIDC (consistency check)");
      return _("NT_VMS_EIDC (consistency check)");
    case NT_VMS_FPMODE:
    case NT_VMS_FPMODE:
      return _("NT_VMS_FPMODE (FP mode)");
      return _("NT_VMS_FPMODE (FP mode)");
    case NT_VMS_LINKTIME:
    case NT_VMS_LINKTIME:
      return _("NT_VMS_LINKTIME");
      return "NT_VMS_LINKTIME";
    case NT_VMS_IMGNAM:
    case NT_VMS_IMGNAM:
      return _("NT_VMS_IMGNAM (image name)");
      return _("NT_VMS_IMGNAM (image name)");
    case NT_VMS_IMGID:
    case NT_VMS_IMGID:
      return _("NT_VMS_IMGID (image id)");
      return _("NT_VMS_IMGID (image id)");
    case NT_VMS_LINKID:
    case NT_VMS_LINKID:
Line 12583... Line 12721...
    case NT_VMS_IMGBID:
    case NT_VMS_IMGBID:
      return _("NT_VMS_IMGBID (build id)");
      return _("NT_VMS_IMGBID (build id)");
    case NT_VMS_GSTNAM:
    case NT_VMS_GSTNAM:
      return _("NT_VMS_GSTNAM (sym table name)");
      return _("NT_VMS_GSTNAM (sym table name)");
    case NT_VMS_ORIG_DYN:
    case NT_VMS_ORIG_DYN:
      return _("NT_VMS_ORIG_DYN");
      return "NT_VMS_ORIG_DYN";
    case NT_VMS_PATCHTIME:
    case NT_VMS_PATCHTIME:
      return _("NT_VMS_PATCHTIME");
      return "NT_VMS_PATCHTIME";
    default:
    default:
      snprintf (buff, sizeof (buff), _("Unknown note type: (0x%08x)"), e_type);
      snprintf (buff, sizeof (buff), _("Unknown note type: (0x%08x)"), e_type);
      return buff;
      return buff;
    }
    }
}
}
Line 12614... Line 12752...
    case NT_VMS_LNM:
    case NT_VMS_LNM:
      printf (_("   Language: %s\n"), pnote->descdata);
      printf (_("   Language: %s\n"), pnote->descdata);
      break;
      break;
#ifdef BFD64
#ifdef BFD64
    case NT_VMS_FPMODE:
    case NT_VMS_FPMODE:
      printf (_("   FP mode: 0x%016" BFD_VMA_FMT "x\n"),
      printf (_("   Floating Point mode: "));
 
      printf ("0x%016" BFD_VMA_FMT "x\n",
              (bfd_vma)byte_get ((unsigned char *)pnote->descdata, 8));
              (bfd_vma)byte_get ((unsigned char *)pnote->descdata, 8));
      break;
      break;
    case NT_VMS_LINKTIME:
    case NT_VMS_LINKTIME:
      printf (_("   Link time: "));
      printf (_("   Link time: "));
      print_vms_time
      print_vms_time
Line 12633... Line 12772...
      break;
      break;
    case NT_VMS_ORIG_DYN:
    case NT_VMS_ORIG_DYN:
      printf (_("   Major id: %u,  minor id: %u\n"),
      printf (_("   Major id: %u,  minor id: %u\n"),
              (unsigned) byte_get ((unsigned char *)pnote->descdata, 4),
              (unsigned) byte_get ((unsigned char *)pnote->descdata, 4),
              (unsigned) byte_get ((unsigned char *)pnote->descdata + 4, 4));
              (unsigned) byte_get ((unsigned char *)pnote->descdata + 4, 4));
      printf (_("   Manip date  : "));
      printf (_("   Last modified  : "));
      print_vms_time
      print_vms_time
        ((bfd_int64_t) byte_get ((unsigned char *)pnote->descdata + 8, 8));
        ((bfd_int64_t) byte_get ((unsigned char *)pnote->descdata + 8, 8));
      printf (_("\n"
      printf (_("\n   Link flags  : "));
                "   Link flags  : 0x%016" BFD_VMA_FMT "x\n"),
      printf ("0x%016" BFD_VMA_FMT "x\n",
              (bfd_vma)byte_get ((unsigned char *)pnote->descdata + 16, 8));
              (bfd_vma)byte_get ((unsigned char *)pnote->descdata + 16, 8));
      printf (_("   Header flags: 0x%08x\n"),
      printf (_("   Header flags: 0x%08x\n"),
              (unsigned)byte_get ((unsigned char *)pnote->descdata + 24, 4));
              (unsigned)byte_get ((unsigned char *)pnote->descdata + 24, 4));
      printf (_("   Image id    : %s\n"), pnote->descdata + 32);
      printf (_("   Image id    : %s\n"), pnote->descdata + 32);
      break;
      break;
Line 12907... Line 13046...
      return process_mips_specific (file);
      return process_mips_specific (file);
      break;
      break;
    case EM_PPC:
    case EM_PPC:
      return process_power_specific (file);
      return process_power_specific (file);
      break;
      break;
 
    case EM_SPARC:
 
    case EM_SPARC32PLUS:
 
    case EM_SPARCV9:
 
      return process_sparc_specific (file);
 
      break;
    case EM_TI_C6000:
    case EM_TI_C6000:
      return process_tic6x_specific (file);
      return process_tic6x_specific (file);
      break;
      break;
    default:
    default:
      break;
      break;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.