Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Typedefs | Enumerations | Functions | Variables
readelf.c File Reference
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <time.h>
#include "dwarf.h"
#include "elf/common.h"
#include "elf/external.h"
#include "elf/internal.h"
#include "elf/h8.h"
#include "elf/alpha.h"
#include "elf/arc.h"
#include "elf/arm.h"
#include "elf/avr.h"
#include "elf/bfin.h"
#include "elf/cris.h"
#include "elf/crx.h"
#include "elf/d10v.h"
#include "elf/d30v.h"
#include "elf/dlx.h"
#include "elf/fr30.h"
#include "elf/frv.h"
#include "elf/hppa.h"
#include "elf/i386.h"
#include "elf/i370.h"
#include "elf/i860.h"
#include "elf/i960.h"
#include "elf/ia64.h"
#include "elf/ip2k.h"
#include "elf/iq2000.h"
#include "elf/m32c.h"
#include "elf/m32r.h"
#include "elf/m68k.h"
#include "elf/m68hc11.h"
#include "elf/mcore.h"
#include "elf/mep.h"
#include "elf/mips.h"
#include "elf/mmix.h"
#include "elf/mn10200.h"
#include "elf/mn10300.h"
#include "elf/mt.h"
#include "elf/msp430.h"
#include "elf/or32.h"
#include "elf/pj.h"
#include "elf/ppc.h"
#include "elf/ppc64.h"
#include "elf/s390.h"
#include "elf/score.h"
#include "elf/sh.h"
#include "elf/sparc.h"
#include "elf/spu.h"
#include "elf/v850.h"
#include "elf/vax.h"
#include "elf/x86-64.h"
#include "elf/xstormy16.h"
#include "elf/xtensa.h"
#include "aout/ar.h"
#include "bucomm.h"
#include "getopt.h"
#include "libiberty.h"
#include "unwind-ia64.h"

Go to the source code of this file.

Classes

struct  group_list
struct  group
struct  dump_list_entry
struct  absaddr
struct  ia64_unw_aux_info
struct  ia64_unw_aux_info::ia64_unw_table_entry
struct  hppa_unw_aux_info
struct  hppa_unw_aux_info::hppa_unw_table_entry
struct  arm_attr_public_tag

Defines

#define PATH_MAX   1024
#define RELOC_MACROS_GEN_FUNC
#define HEX_DUMP   (1 << 0)
#define DISASS_DUMP   (1 << 1)
#define DEBUG_DUMP   (1 << 2)
#define UNKNOWN   -1
#define SECTION_NAME(X)
#define SECTION_HEADER_INDEX(I)
#define SECTION_HEADER_NUM(N)
#define SECTION_HEADER(I)   (section_headers + SECTION_HEADER_INDEX (I))
#define DT_VERSIONTAGIDX(tag)   (DT_VERNEEDNUM - (tag)) /* Reverse order! */
#define BYTE_GET(field)   byte_get (field, sizeof (field))
#define NUM_ELEM(array)   (sizeof (array) / sizeof ((array)[0]))
#define GET_ELF_SYMBOLS(file, section)
#define VALID_DYNAMIC_NAME(offset)   ((dynamic_strings != NULL) && (offset < dynamic_strings_length))
#define GET_DYNAMIC_NAME(offset)   (dynamic_strings + offset)
#define streq(a, b)   (strcmp ((a), (b)) == 0)
#define strneq(a, b, n)   (strncmp ((a), (b), (n)) == 0)
#define const_strneq(a, b)   (strncmp ((a), (b), sizeof (b) - 1) == 0)
#define OPTION_DEBUG_DUMP   512
#define CHECK_ENTSIZE_VALUES(section, i, size32, size64)
#define CHECK_ENTSIZE(section, i, type)
#define ABSADDR(a)
#define PF(_m)   if (tp->_m) printf (#_m " ");
#define PV(_m)   if (tp->_m) printf (#_m "=%d ", tp->_m);
#define LOOKUP(id, name)   {id, #name, 0x80 | ARRAY_SIZE(arm_attr_tag_##name), arm_attr_tag_##name}

Typedefs

typedef enum print_mode print_mode

Enumerations

enum  print_mode {
  HEX, DEC, DEC_5, UNSIGNED,
  PREFIX_HEX, FULL_HEX, LONG_HEX
}

Functions

static void * get_data (void *var, FILE *file, long offset, size_t size, size_t nmemb, const char *reason)
static void byte_put_little_endian (unsigned char *field, bfd_vma value, int size)
static int print_vma (bfd_vma vma, print_mode mode)
static void print_symbol (int width, const char *symbol)
static void byte_put_big_endian (unsigned char *field, bfd_vma value, int size)
static Elf_Internal_Shdrfind_section (const char *name)
static int guess_is_rela (unsigned long e_machine)
static int slurp_rela_relocs (FILE *file, unsigned long rel_offset, unsigned long rel_size, Elf_Internal_Rela **relasp, unsigned long *nrelasp)
static int slurp_rel_relocs (FILE *file, unsigned long rel_offset, unsigned long rel_size, Elf_Internal_Rela **relsp, unsigned long *nrelsp)
static int dump_relocations (FILE *file, unsigned long rel_offset, unsigned long rel_size, Elf_Internal_Sym *symtab, unsigned long nsyms, char *strtab, unsigned long strtablen, int is_rela)
static const char * get_mips_dynamic_type (unsigned long type)
static const char * get_sparc64_dynamic_type (unsigned long type)
static const char * get_ppc_dynamic_type (unsigned long type)
static const char * get_ppc64_dynamic_type (unsigned long type)
static const char * get_parisc_dynamic_type (unsigned long type)
static const char * get_ia64_dynamic_type (unsigned long type)
static const char * get_alpha_dynamic_type (unsigned long type)
static const char * get_score_dynamic_type (unsigned long type)
static const char * get_dynamic_type (unsigned long type)
static char * get_file_type (unsigned e_type)
static char * get_machine_name (unsigned e_machine)
static void decode_ARM_machine_flags (unsigned e_flags, char buf[])
static char * get_machine_flags (unsigned e_flags, unsigned e_machine)
static const char * get_osabi_name (unsigned int osabi)
static const char * get_arm_segment_type (unsigned long type)
static const char * get_mips_segment_type (unsigned long type)
static const char * get_parisc_segment_type (unsigned long type)
static const char * get_ia64_segment_type (unsigned long type)
static const char * get_segment_type (unsigned long p_type)
static const char * get_mips_section_type_name (unsigned int sh_type)
static const char * get_parisc_section_type_name (unsigned int sh_type)
static const char * get_ia64_section_type_name (unsigned int sh_type)
static const char * get_x86_64_section_type_name (unsigned int sh_type)
static const char * get_arm_section_type_name (unsigned int sh_type)
static const char * get_section_type_name (unsigned int sh_type)
static void usage (FILE *stream)
static void request_dump (unsigned int section, int type)
static void request_dump_byname (const char *section, int type)
static void parse_args (int argc, char **argv)
static const char * get_elf_class (unsigned int elf_class)
static const char * get_data_encoding (unsigned int encoding)
static int process_file_header (void)
static int get_32bit_program_headers (FILE *file, Elf_Internal_Phdr *program_headers)
static int get_64bit_program_headers (FILE *file, Elf_Internal_Phdr *program_headers)
static int get_program_headers (FILE *file)
static int process_program_headers (FILE *file)
static long offset_from_vma (FILE *file, bfd_vma vma, bfd_size_type size)
static int get_32bit_section_headers (FILE *file, unsigned int num)
static int get_64bit_section_headers (FILE *file, unsigned int num)
static Elf_Internal_Sym * get_32bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section)
static Elf_Internal_Sym * get_64bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section)
static const char * get_elf_section_flags (bfd_vma sh_flags)
static int process_section_headers (FILE *file)
static const char * get_group_flags (unsigned int flags)
static int process_section_groups (FILE *file)
static int process_relocs (FILE *file)
static void find_symbol_for_address (Elf_Internal_Sym *symtab, unsigned long nsyms, const char *strtab, unsigned long strtab_size, struct absaddr addr, const char **symname, bfd_vma *offset)
static void dump_ia64_unwind (struct ia64_unw_aux_info *aux)
static int slurp_ia64_unwind_table (FILE *file, struct ia64_unw_aux_info *aux, Elf_Internal_Shdr *sec)
static int ia64_process_unwind (FILE *file)
static void dump_hppa_unwind (struct hppa_unw_aux_info *aux)
static int slurp_hppa_unwind_table (FILE *file, struct hppa_unw_aux_info *aux, Elf_Internal_Shdr *sec)
static int hppa_process_unwind (FILE *file)
static int process_unwind (FILE *file)
static void dynamic_section_mips_val (Elf_Internal_Dyn *entry)
static void dynamic_section_parisc_val (Elf_Internal_Dyn *entry)
static void dynamic_section_ia64_val (Elf_Internal_Dyn *entry)
static int get_32bit_dynamic_section (FILE *file)
static int get_64bit_dynamic_section (FILE *file)
static void print_dynamic_flags (bfd_vma flags)
static int process_dynamic_section (FILE *file)
static char * get_ver_flags (unsigned int flags)
static int process_version_sections (FILE *file)
static const char * get_symbol_binding (unsigned int binding)
static const char * get_symbol_type (unsigned int type)
static const char * get_symbol_visibility (unsigned int visibility)
static const char * get_mips_symbol_other (unsigned int other)
static const char * get_symbol_other (unsigned int other)
static const char * get_symbol_index_type (unsigned int type)
static bfd_vmaget_dynamic_data (FILE *file, unsigned int number, unsigned int ent_size)
static int process_symbol_table (FILE *file)
static int process_syminfo (FILE *file ATTRIBUTE_UNUSED)
static int dump_section (Elf_Internal_Shdr *section, FILE *file)
static unsigned int get_reloc_size (Elf_Internal_Rela *reloc)
static int debug_apply_rela_addends (void *file, Elf_Internal_Shdr *section, unsigned char *start)
int load_debug_section (enum dwarf_section_display_enum debug, void *file)
void free_debug_section (enum dwarf_section_display_enum debug)
static int display_debug_section (Elf_Internal_Shdr *section, FILE *file)
static void initialise_dumps_byname (void)
static void process_section_contents (FILE *file)
static void process_mips_fpe_exception (int mask)
static unsigned int read_uleb128 (unsigned char *p, unsigned int *plen)
static unsigned char * display_arm_attribute (unsigned char *p)
static int process_arm_specific (FILE *file)
static int process_mips_specific (FILE *file)
static int process_gnu_liblist (FILE *file)
static const char * get_note_type (unsigned e_type)
static const char * get_netbsd_elfcore_note_type (unsigned e_type)
static int process_note (Elf_Internal_Note *pnote)
static int process_corefile_note_segment (FILE *file, bfd_vma offset, bfd_vma length)
static int process_corefile_note_segments (FILE *file)
static int process_note_sections (FILE *file)
static int process_notes (FILE *file)
static int process_arch_specific (FILE *file)
static int get_file_header (FILE *file)
static int process_object (char *file_name, FILE *file)
static int process_archive (char *file_name, FILE *file)
static int process_file (char *file_name)
int main (int argc, char **argv)

Variables

char * program_name = "readelf"
static long archive_file_offset
static unsigned long archive_file_size
static unsigned long dynamic_addr
static bfd_size_type dynamic_size
static unsigned int dynamic_nent
static char * dynamic_strings
static unsigned long dynamic_strings_length
static char * string_table
static unsigned long string_table_length
static unsigned long num_dynamic_syms
static Elf_Internal_Sym * dynamic_symbols
static Elf_Internal_Syminfodynamic_syminfo
static unsigned long dynamic_syminfo_offset
static unsigned int dynamic_syminfo_nent
static char program_interpreter [PATH_MAX]
static bfd_vma dynamic_info [DT_JMPREL+1]
static bfd_vma dynamic_info_DT_GNU_HASH
static bfd_vma version_info [16]
static Elf_Internal_Ehdr elf_header
static Elf_Internal_Shdrsection_headers
static Elf_Internal_Phdr * program_headers
static Elf_Internal_Dyndynamic_section
static Elf_Internal_Shdrsymtab_shndx_hdr
static int show_name
static int do_dynamic
static int do_syms
static int do_reloc
static int do_sections
static int do_section_groups
static int do_section_details
static int do_segments
static int do_unwind
static int do_using_dynamic
static int do_header
static int do_dump
static int do_version
static int do_wide
static int do_histogram
static int do_debugging
static int do_arch
static int do_notes
static int is_32bit_elf
static size_t group_count
static struct groupsection_groups
static struct group ** section_headers_groups
static struct dump_list_entrydump_sects_byname
char * cmdline_dump_sects = NULL
unsigned num_cmdline_dump_sects = 0
char * dump_sects = NULL
unsigned int num_dump_sects = 0
static void(* byte_put )(unsigned char *, bfd_vma, int)
static struct option []
struct {
const char * name
int reloc
int size
int rela
dynamic_relocations []
static const char * arm_attr_tag_CPU_arch []
static const char * arm_attr_tag_ARM_ISA_use [] = {"No", "Yes"}
static const char * arm_attr_tag_THUMB_ISA_use []
static const char * arm_attr_tag_VFP_arch [] = {"No", "VFPv1", "VFPv2", "VFPv3"}
static const char * arm_attr_tag_WMMX_arch [] = {"No", "WMMXv1"}
static const char * arm_attr_tag_NEON_arch [] = {"No", "NEONv1"}
static const char * arm_attr_tag_ABI_PCS_config []
static const char * arm_attr_tag_ABI_PCS_R9_use []
static const char * arm_attr_tag_ABI_PCS_RW_data []
static const char * arm_attr_tag_ABI_PCS_RO_DATA []
static const char * arm_attr_tag_ABI_PCS_GOT_use []
static const char * arm_attr_tag_ABI_PCS_wchar_t []
static const char * arm_attr_tag_ABI_FP_rounding [] = {"Unused", "Needed"}
static const char * arm_attr_tag_ABI_FP_denormal [] = {"Unused", "Needed"}
static const char * arm_attr_tag_ABI_FP_exceptions [] = {"Unused", "Needed"}
static const char * arm_attr_tag_ABI_FP_user_exceptions [] = {"Unused", "Needed"}
static const char * arm_attr_tag_ABI_FP_number_model []
static const char * arm_attr_tag_ABI_align8_needed [] = {"No", "Yes", "4-byte"}
static const char * arm_attr_tag_ABI_align8_preserved []
static const char * arm_attr_tag_ABI_enum_size []
static const char * arm_attr_tag_ABI_HardFP_use []
static const char * arm_attr_tag_ABI_VFP_args []
static const char * arm_attr_tag_ABI_WMMX_args []
static const char * arm_attr_tag_ABI_optimization_goals []
static const char * arm_attr_tag_ABI_FP_optimization_goals []
static arm_attr_public_tag arm_attr_public_tags []

Class Documentation

struct group_list

Definition at line 205 of file readelf.c.

Collaboration diagram for group_list:
Class Members
unsigned int * elt_count
asection ** head
struct group_list * next
unsigned int num_group
unsigned int section_index
struct group

Definition at line 211 of file readelf.c.

Collaboration diagram for group:
Class Members
unsigned int group_index
struct group_list * root
struct dump_list_entry

Definition at line 223 of file readelf.c.

Collaboration diagram for dump_list_entry:
Class Members
char * name
struct dump_list_entry * next
int type
struct absaddr

Definition at line 4795 of file readelf.c.

Class Members
bfd_vma offset
unsigned short section
struct ia64_unw_aux_info

Definition at line 4806 of file readelf.c.

Collaboration diagram for ia64_unw_aux_info:
Class Members
unsigned char * info
bfd_vma info_addr
unsigned long info_size
unsigned long nsyms
bfd_vma seg_base
char * strtab
unsigned long strtab_size
Elf_Internal_Sym * symtab
struct ia64_unw_table_entry * table
unsigned long table_len
struct ia64_unw_aux_info::ia64_unw_table_entry

Definition at line 4808 of file readelf.c.

struct hppa_unw_aux_info

Definition at line 5188 of file readelf.c.

Collaboration diagram for hppa_unw_aux_info:
Class Members
unsigned long nsyms
bfd_vma seg_base
char * strtab
unsigned long strtab_size
Elf_Internal_Sym * symtab
struct hppa_unw_table_entry * table
unsigned long table_len
struct hppa_unw_aux_info::hppa_unw_table_entry

Definition at line 5190 of file readelf.c.

Class Members
unsigned int Ada_Region:1
unsigned int Args_stored:1
unsigned int Cannot_unwind:1
unsigned int Cleanup_defined:1
unsigned int cxx_info:1
unsigned int cxx_try_catch:1
unsigned int Entry_FR:4
unsigned int Entry_GR:5
unsigned int Entry_SR:1
unsigned int extn_ptr_defined:1
unsigned int Frame_Extension_Millicode:1
unsigned int HP_UX_interrupt_marker:1
unsigned int Large_frame:1
unsigned int Millicode:1
unsigned int Millicode_save_sr0:1
unsigned int MPE_XL_interrupt_marker:1
unsigned int Pseudo_SP_Set:1
unsigned int Region_description:2
unsigned int reserved1:1
unsigned int reserved2:1
unsigned int reserved4:1
unsigned int Save_MRP_in_frame:1
unsigned int Save_RP:1
unsigned int Save_SP:1
unsigned int sched_entry_seq:1
unsigned int Separate_Package_Body:1
unsigned int Stack_Overflow_Check:1
unsigned int Total_frame_size:27
unsigned int Two_Instruction_SP_Increment:1
unsigned int Variable_Frame:1
struct arm_attr_public_tag

Definition at line 8083 of file readelf.c.

Class Members
const char * name
const char ** table
int tag
int type

Define Documentation

#define ABSADDR (   a)
Value:
((a).section \
   ? section_headers [(a).section].sh_addr + (a).offset \
   : (a).offset)

Definition at line 4801 of file readelf.c.

#define BYTE_GET (   field)    byte_get (field, sizeof (field))

Definition at line 290 of file readelf.c.

#define CHECK_ENTSIZE (   section,
  i,
  type 
)
Value:
CHECK_ENTSIZE_VALUES (section, i, sizeof (Elf32_External_##type),         \
                     sizeof (Elf64_External_##type))
#define CHECK_ENTSIZE_VALUES (   section,
  i,
  size32,
  size64 
)
Value:
do                                                                 \
    {                                                              \
      size_t expected_entsize                                             \
       = is_32bit_elf ? size32 : size64;                           \
      if (section->sh_entsize != expected_entsize)                        \
       error (_("Section %d has invalid sh_entsize %lx (expected %lx)\n"), \
              i, (unsigned long int) section->sh_entsize,                 \
              (unsigned long int) expected_entsize);                      \
      section->sh_entsize = expected_entsize;                             \
    }                                                              \
  while (0)
#define const_strneq (   a,
  b 
)    (strncmp ((a), (b), sizeof (b) - 1) == 0)

Definition at line 306 of file readelf.c.

#define DEBUG_DUMP   (1 << 2)

Definition at line 247 of file readelf.c.

#define DISASS_DUMP   (1 << 1)

Definition at line 246 of file readelf.c.

#define DT_VERSIONTAGIDX (   tag)    (DT_VERNEEDNUM - (tag)) /* Reverse order! */

Definition at line 288 of file readelf.c.

#define GET_DYNAMIC_NAME (   offset)    (dynamic_strings + offset)

Definition at line 301 of file readelf.c.

#define GET_ELF_SYMBOLS (   file,
  section 
)
Value:

Definition at line 294 of file readelf.c.

#define HEX_DUMP   (1 << 0)

Definition at line 245 of file readelf.c.

#define LOOKUP (   id,
  name 
)    {id, #name, 0x80 | ARRAY_SIZE(arm_attr_tag_##name), arm_attr_tag_##name}

Definition at line 8139 of file readelf.c.

#define NUM_ELEM (   array)    (sizeof (array) / sizeof ((array)[0]))

Definition at line 292 of file readelf.c.

#define OPTION_DEBUG_DUMP   512

Definition at line 2720 of file readelf.c.

#define PATH_MAX   1024

Definition at line 64 of file readelf.c.

#define PF (   _m)    if (tp->_m) printf (#_m " ");
#define PV (   _m)    if (tp->_m) printf (#_m "=%d ", tp->_m);

Definition at line 105 of file readelf.c.

Definition at line 286 of file readelf.c.

#define SECTION_HEADER_INDEX (   I)
Value:
((I) < SHN_LORESERVE                             \
   ? (I)                                         \
   : ((I) <= SHN_HIRESERVE                       \
      ? 0                                        \
      : (I) - (SHN_HIRESERVE + 1 - SHN_LORESERVE)))

Definition at line 273 of file readelf.c.

#define SECTION_HEADER_NUM (   N)
Value:
((N) < SHN_LORESERVE                             \
   ? (N)                                         \
   : (N) + (SHN_HIRESERVE + 1 - SHN_LORESERVE))

Definition at line 281 of file readelf.c.

#define SECTION_NAME (   X)
Value:
((X) == NULL ? "<none>" \
  : string_table == NULL ? "<no-name>" \
  : ((X)->sh_name >= string_table_length ? "<corrupt>" \
  : string_table + (X)->sh_name))

Definition at line 266 of file readelf.c.

#define streq (   a,
  b 
)    (strcmp ((a), (b)) == 0)

Definition at line 304 of file readelf.c.

#define strneq (   a,
  b,
  n 
)    (strncmp ((a), (b), (n)) == 0)

Definition at line 305 of file readelf.c.

#define UNKNOWN   -1

Definition at line 264 of file readelf.c.

Definition at line 298 of file readelf.c.


Typedef Documentation

typedef enum print_mode print_mode

Enumeration Type Documentation

enum print_mode
Enumerator:
HEX 
DEC 
DEC_5 
UNSIGNED 
PREFIX_HEX 
FULL_HEX 
LONG_HEX 

Definition at line 250 of file readelf.c.


Function Documentation

static void byte_put_big_endian ( unsigned char *  field,
bfd_vma  value,
int  size 
) [static]

Definition at line 544 of file readelf.c.

{
  switch (size)
    {
    case 8:
      field[7] = value & 0xff;
      field[6] = (value >> 8) & 0xff;
      field[5] = (value >> 16) & 0xff;
      field[4] = (value >> 24) & 0xff;
      value >>= 16;
      value >>= 16;
      /* Fall through.  */
    case 4:
      field[3] = value & 0xff;
      field[2] = (value >> 8) & 0xff;
      value >>= 16;
      /* Fall through.  */
    case 2:
      field[1] = value & 0xff;
      value >>= 8;
      /* Fall through.  */
    case 1:
      field[0] = value & 0xff;
      break;

    default:
      error (_("Unhandled data length: %d\n"), size);
      abort ();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void byte_put_little_endian ( unsigned char *  field,
bfd_vma  value,
int  size 
) [static]

Definition at line 355 of file readelf.c.

{
  switch (size)
    {
    case 8:
      field[7] = (((value >> 24) >> 24) >> 8) & 0xff;
      field[6] = ((value >> 24) >> 24) & 0xff;
      field[5] = ((value >> 24) >> 16) & 0xff;
      field[4] = ((value >> 24) >> 8) & 0xff;
      /* Fall through.  */
    case 4:
      field[3] = (value >> 24) & 0xff;
      field[2] = (value >> 16) & 0xff;
      /* Fall through.  */
    case 2:
      field[1] = (value >> 8) & 0xff;
      /* Fall through.  */
    case 1:
      field[0] = value & 0xff;
      break;

    default:
      error (_("Unhandled data length: %d\n"), size);
      abort ();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int debug_apply_rela_addends ( void *  file,
Elf_Internal_Shdr section,
unsigned char *  start 
) [static]

Definition at line 7796 of file readelf.c.

{
  Elf_Internal_Shdr *relsec;
  unsigned char *end = start + section->sh_size;

  if (!is_relocatable)
    return 1;

  /* SH uses RELA but uses in place value instead of the addend field.  */
  if (elf_header.e_machine == EM_SH)
    return 0;

  for (relsec = section_headers;
       relsec < section_headers + elf_header.e_shnum;
       ++relsec)
    {
      unsigned long nrelas;
      Elf_Internal_Rela *rela, *rp;
      Elf_Internal_Shdr *symsec;
      Elf_Internal_Sym *symtab;
      Elf_Internal_Sym *sym;

      if (relsec->sh_type != SHT_RELA
         || SECTION_HEADER_INDEX (relsec->sh_info) >= elf_header.e_shnum
         || SECTION_HEADER (relsec->sh_info) != section
         || relsec->sh_size == 0
         || SECTION_HEADER_INDEX (relsec->sh_link) >= elf_header.e_shnum)
       continue;

      if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size,
                           &rela, &nrelas))
       return 0;

      symsec = SECTION_HEADER (relsec->sh_link);
      symtab = GET_ELF_SYMBOLS (file, symsec);

      for (rp = rela; rp < rela + nrelas; ++rp)
       {
         unsigned char *loc;
         unsigned int reloc_size;

         reloc_size = get_reloc_size (rp);
         if (reloc_size == 0)
           {
             warn (_("skipping relocation of unknown size against offset 0x%lx in section %s\n"),
                  (unsigned long) rp->r_offset,
                  SECTION_NAME (section));
             continue;
           }

         loc = start + rp->r_offset;
         if ((loc + reloc_size) > end)
           {
             warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),
                  (unsigned long) rp->r_offset,
                  SECTION_NAME (section));
             continue;
           }

         if (is_32bit_elf)
           {
             sym = symtab + ELF32_R_SYM (rp->r_info);

             if (ELF32_R_SYM (rp->r_info) != 0
                && ELF32_ST_TYPE (sym->st_info) != STT_SECTION
                /* Relocations against symbols without type can happen.
                   Gcc -feliminate-dwarf2-dups may generate symbols
                   without type for debug info.  */
                && ELF32_ST_TYPE (sym->st_info) != STT_NOTYPE
                /* Relocations against object symbols can happen,
                   eg when referencing a global array.  For an
                   example of this see the _clz.o binary in libgcc.a.  */
                && ELF32_ST_TYPE (sym->st_info) != STT_OBJECT)
              {
                warn (_("skipping unexpected symbol type %s in relocation in section .rela%s\n"),
                     get_symbol_type (ELF32_ST_TYPE (sym->st_info)),
                     SECTION_NAME (section));
                continue;
              }
           }
         else
           {
             /* In MIPS little-endian objects, r_info isn't really a
               64-bit little-endian value: it has a 32-bit little-endian
               symbol index followed by four individual byte fields.
               Reorder INFO accordingly.  */
             if (elf_header.e_machine == EM_MIPS
                && elf_header.e_ident[EI_DATA] != ELFDATA2MSB)
              rp->r_info = (((rp->r_info & 0xffffffff) << 32)
                           | ((rp->r_info >> 56) & 0xff)
                           | ((rp->r_info >> 40) & 0xff00)
                           | ((rp->r_info >> 24) & 0xff0000)
                           | ((rp->r_info >> 8) & 0xff000000));

             sym = symtab + ELF64_R_SYM (rp->r_info);

             if (ELF64_R_SYM (rp->r_info) != 0
                && ELF64_ST_TYPE (sym->st_info) != STT_SECTION
                && ELF64_ST_TYPE (sym->st_info) != STT_NOTYPE
                && ELF64_ST_TYPE (sym->st_info) != STT_OBJECT)
              {
                warn (_("skipping unexpected symbol type %s in relocation in section .rela.%s\n"),
                     get_symbol_type (ELF64_ST_TYPE (sym->st_info)),
                     SECTION_NAME (section));
                continue;
              }
           }

         byte_put (loc, rp->r_addend, reloc_size);
       }

      free (symtab);
      free (rela);
      break;
    }
  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void decode_ARM_machine_flags ( unsigned  e_flags,
char  buf[] 
) [static]

Definition at line 1797 of file readelf.c.

{
  unsigned eabi;
  int unknown = 0;

  eabi = EF_ARM_EABI_VERSION (e_flags);
  e_flags &= ~ EF_ARM_EABIMASK;

  /* Handle "generic" ARM flags.  */
  if (e_flags & EF_ARM_RELEXEC)
    {
      strcat (buf, ", relocatable executable");
      e_flags &= ~ EF_ARM_RELEXEC;
    }

  if (e_flags & EF_ARM_HASENTRY)
    {
      strcat (buf, ", has entry point");
      e_flags &= ~ EF_ARM_HASENTRY;
    }

  /* Now handle EABI specific flags.  */
  switch (eabi)
    {
    default:
      strcat (buf, ", <unrecognized EABI>");
      if (e_flags)
       unknown = 1;
      break;

    case EF_ARM_EABI_VER1:
      strcat (buf, ", Version1 EABI");
      while (e_flags)
       {
         unsigned flag;

         /* Process flags one bit at a time.  */
         flag = e_flags & - e_flags;
         e_flags &= ~ flag;

         switch (flag)
           {
           case EF_ARM_SYMSARESORTED: /* Conflicts with EF_ARM_INTERWORK.  */
             strcat (buf, ", sorted symbol tables");
             break;

           default:
             unknown = 1;
             break;
           }
       }
      break;

    case EF_ARM_EABI_VER2:
      strcat (buf, ", Version2 EABI");
      while (e_flags)
       {
         unsigned flag;

         /* Process flags one bit at a time.  */
         flag = e_flags & - e_flags;
         e_flags &= ~ flag;

         switch (flag)
           {
           case EF_ARM_SYMSARESORTED: /* Conflicts with EF_ARM_INTERWORK.  */
             strcat (buf, ", sorted symbol tables");
             break;

           case EF_ARM_DYNSYMSUSESEGIDX:
             strcat (buf, ", dynamic symbols use segment index");
             break;

           case EF_ARM_MAPSYMSFIRST:
             strcat (buf, ", mapping symbols precede others");
             break;

           default:
             unknown = 1;
             break;
           }
       }
      break;

    case EF_ARM_EABI_VER3:
      strcat (buf, ", Version3 EABI");
      break;

    case EF_ARM_EABI_VER4:
      strcat (buf, ", Version4 EABI");
      goto eabi;

    case EF_ARM_EABI_VER5:
      strcat (buf, ", Version5 EABI");
    eabi:
      while (e_flags)
       {
         unsigned flag;

         /* Process flags one bit at a time.  */
         flag = e_flags & - e_flags;
         e_flags &= ~ flag;

         switch (flag)
           {
           case EF_ARM_BE8:
             strcat (buf, ", BE8");
             break;

           case EF_ARM_LE8:
             strcat (buf, ", LE8");
             break;

           default:
             unknown = 1;
             break;
           }
       }
      break;

    case EF_ARM_EABI_UNKNOWN:
      strcat (buf, ", GNU EABI");
      while (e_flags)
       {
         unsigned flag;

         /* Process flags one bit at a time.  */
         flag = e_flags & - e_flags;
         e_flags &= ~ flag;

         switch (flag)
           {
           case EF_ARM_INTERWORK:
             strcat (buf, ", interworking enabled");
             break;

           case EF_ARM_APCS_26:
             strcat (buf, ", uses APCS/26");
             break;

           case EF_ARM_APCS_FLOAT:
             strcat (buf, ", uses APCS/float");
             break;

           case EF_ARM_PIC:
             strcat (buf, ", position independent");
             break;

           case EF_ARM_ALIGN8:
             strcat (buf, ", 8 bit structure alignment");
             break;

           case EF_ARM_NEW_ABI:
             strcat (buf, ", uses new ABI");
             break;

           case EF_ARM_OLD_ABI:
             strcat (buf, ", uses old ABI");
             break;

           case EF_ARM_SOFT_FLOAT:
             strcat (buf, ", software FP");
             break;

           case EF_ARM_VFP_FLOAT:
             strcat (buf, ", VFP");
             break;

           case EF_ARM_MAVERICK_FLOAT:
             strcat (buf, ", Maverick FP");
             break;

           default:
             unknown = 1;
             break;
           }
       }
    }

  if (unknown)
    strcat (buf,", <unknown>");
}

Here is the caller graph for this function:

static unsigned char* display_arm_attribute ( unsigned char *  p) [static]

Definition at line 8202 of file readelf.c.

{
  int tag;
  unsigned int len;
  int val;
  arm_attr_public_tag *attr;
  unsigned i;
  int type;

  tag = read_uleb128 (p, &len);
  p += len;
  attr = NULL;
  for (i = 0; i < ARRAY_SIZE(arm_attr_public_tags); i++)
    {
      if (arm_attr_public_tags[i].tag == tag)
       {
         attr = &arm_attr_public_tags[i];
         break;
       }
    }

  if (attr)
    {
      printf ("  Tag_%s: ", attr->name);
      switch (attr->type)
       {
       case 0:
         switch (tag)
           {
           case 7: /* Tag_CPU_arch_profile.  */
             val = read_uleb128 (p, &len);
             p += len;
             switch (val)
              {
              case 0: printf ("None\n"); break;
              case 'A': printf ("Application\n"); break;
              case 'R': printf ("Realtime\n"); break;
              case 'M': printf ("Microcontroller\n"); break;
              default: printf ("??? (%d)\n", val); break;
              }
             break;

           case 32: /* Tag_compatibility.  */
             val = read_uleb128 (p, &len);
             p += len;
             printf ("flag = %d, vendor = %s\n", val, p);
             p += strlen((char *)p) + 1;
             break;

           default:
             abort();
           }
         return p;

       case 1:
       case 2:
         type = attr->type;
         break;

       default:
         assert (attr->type & 0x80);
         val = read_uleb128 (p, &len);
         p += len;
         type = attr->type & 0x7f;
         if (val >= type)
           printf ("??? (%d)\n", val);
         else
           printf ("%s\n", attr->table[val]);
         return p;
       }
    }
  else
    {
      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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int display_debug_section ( Elf_Internal_Shdr section,
FILE *  file 
) [static]

Definition at line 7959 of file readelf.c.

{
  char *name = SECTION_NAME (section);
  bfd_size_type length;
  int result = 1;
  enum dwarf_section_display_enum i;

  length = section->sh_size;
  if (length == 0)
    {
      printf (_("\nSection '%s' has no debugging data.\n"), name);
      return 0;
    }

  if (const_strneq (name, ".gnu.linkonce.wi."))
    name = ".debug_info";

  /* See if we know how to display the contents of this section.  */
  for (i = 0; i < max; i++)
    if (streq (debug_displays[i].section.name, name))
      {
       struct dwarf_section *sec = &debug_displays [i].section;

       if (load_debug_section (i, file))
         {
           result &= debug_displays[i].display (sec, file);

           if (i != info && i != abbrev)
             free_debug_section (i);
         }

       break;
      }

  if (i == max)
    {
      printf (_("Unrecognized debug section: %s\n"), name);
      result = 0;
    }

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void dump_hppa_unwind ( struct hppa_unw_aux_info aux) [static]

Definition at line 5236 of file readelf.c.

{
  struct hppa_unw_table_entry *tp;

  for (tp = aux->table; tp < aux->table + aux->table_len; ++tp)
    {
      bfd_vma offset;
      const char *procname;

      find_symbol_for_address (aux->symtab, aux->nsyms, aux->strtab,
                            aux->strtab_size, tp->start, &procname,
                            &offset);

      fputs ("\n<", stdout);

      if (procname)
       {
         fputs (procname, stdout);

         if (offset)
           printf ("+%lx", (unsigned long) offset);
       }

      fputs (">: [", stdout);
      print_vma (tp->start.offset, PREFIX_HEX);
      fputc ('-', stdout);
      print_vma (tp->end.offset, PREFIX_HEX);
      printf ("]\n\t");

#define PF(_m) if (tp->_m) printf (#_m " ");
#define PV(_m) if (tp->_m) printf (#_m "=%d ", tp->_m);
      PF(Cannot_unwind);
      PF(Millicode);
      PF(Millicode_save_sr0);
      /* PV(Region_description);  */
      PF(Entry_SR);
      PV(Entry_FR);
      PV(Entry_GR);
      PF(Args_stored);
      PF(Variable_Frame);
      PF(Separate_Package_Body);
      PF(Frame_Extension_Millicode);
      PF(Stack_Overflow_Check);
      PF(Two_Instruction_SP_Increment);
      PF(Ada_Region);
      PF(cxx_info);
      PF(cxx_try_catch);
      PF(sched_entry_seq);
      PF(Save_SP);
      PF(Save_RP);
      PF(Save_MRP_in_frame);
      PF(extn_ptr_defined);
      PF(Cleanup_defined);
      PF(MPE_XL_interrupt_marker);
      PF(HP_UX_interrupt_marker);
      PF(Large_frame);
      PF(Pseudo_SP_Set);
      PV(Total_frame_size);
#undef PF
#undef PV
    }

  printf ("\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void dump_ia64_unwind ( struct ia64_unw_aux_info aux) [static]

Definition at line 4865 of file readelf.c.

{
  struct ia64_unw_table_entry *tp;
  int in_body;

  for (tp = aux->table; tp < aux->table + aux->table_len; ++tp)
    {
      bfd_vma stamp;
      bfd_vma offset;
      const unsigned char *dp;
      const unsigned char *head;
      const char *procname;

      find_symbol_for_address (aux->symtab, aux->nsyms, aux->strtab,
                            aux->strtab_size, tp->start, &procname, &offset);

      fputs ("\n<", stdout);

      if (procname)
       {
         fputs (procname, stdout);

         if (offset)
           printf ("+%lx", (unsigned long) offset);
       }

      fputs (">: [", stdout);
      print_vma (tp->start.offset, PREFIX_HEX);
      fputc ('-', stdout);
      print_vma (tp->end.offset, PREFIX_HEX);
      printf ("], info at +0x%lx\n",
             (unsigned long) (tp->info.offset - aux->seg_base));

      head = aux->info + (ABSADDR (tp->info) - aux->info_addr);
      stamp = byte_get ((unsigned char *) head, sizeof (stamp));

      printf ("  v%u, flags=0x%lx (%s%s), len=%lu bytes\n",
             (unsigned) UNW_VER (stamp),
             (unsigned long) ((stamp & UNW_FLAG_MASK) >> 32),
             UNW_FLAG_EHANDLER (stamp) ? " ehandler" : "",
             UNW_FLAG_UHANDLER (stamp) ? " uhandler" : "",
             (unsigned long) (eh_addr_size * UNW_LENGTH (stamp)));

      if (UNW_VER (stamp) != 1)
       {
         printf ("\tUnknown version.\n");
         continue;
       }

      in_body = 0;
      for (dp = head + 8; dp < head + 8 + eh_addr_size * UNW_LENGTH (stamp);)
       dp = unw_decode (dp, in_body, & in_body);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int dump_relocations ( FILE *  file,
unsigned long  rel_offset,
unsigned long  rel_size,
Elf_Internal_Sym *  symtab,
unsigned long  nsyms,
char *  strtab,
unsigned long  strtablen,
int  is_rela 
) [static]

Definition at line 836 of file readelf.c.

{
  unsigned int i;
  Elf_Internal_Rela *rels;


  if (is_rela == UNKNOWN)
    is_rela = guess_is_rela (elf_header.e_machine);

  if (is_rela)
    {
      if (!slurp_rela_relocs (file, rel_offset, rel_size, &rels, &rel_size))
       return 0;
    }
  else
    {
      if (!slurp_rel_relocs (file, rel_offset, rel_size, &rels, &rel_size))
       return 0;
    }

  if (is_32bit_elf)
    {
      if (is_rela)
       {
         if (do_wide)
           printf (_(" Offset     Info    Type                Sym. Value  Symbol's Name + Addend\n"));
         else
           printf (_(" Offset     Info    Type            Sym.Value  Sym. Name + Addend\n"));
       }
      else
       {
         if (do_wide)
           printf (_(" Offset     Info    Type                Sym. Value  Symbol's Name\n"));
         else
           printf (_(" Offset     Info    Type            Sym.Value  Sym. Name\n"));
       }
    }
  else
    {
      if (is_rela)
       {
         if (do_wide)
           printf (_("    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend\n"));
         else
           printf (_("  Offset          Info           Type           Sym. Value    Sym. Name + Addend\n"));
       }
      else
       {
         if (do_wide)
           printf (_("    Offset             Info             Type               Symbol's Value  Symbol's Name\n"));
         else
           printf (_("  Offset          Info           Type           Sym. Value    Sym. Name\n"));
       }
    }

  for (i = 0; i < rel_size; i++)
    {
      const char *rtype;
      const char *rtype2 = NULL;
      const char *rtype3 = NULL;
      bfd_vma offset;
      bfd_vma info;
      bfd_vma symtab_index;
      bfd_vma type;
      bfd_vma type2 = 0;
      bfd_vma type3 = 0;

      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
       {
         /* 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
         if (elf_header.e_machine == EM_MIPS)
           {
             /* In little-endian objects, r_info isn't really a 64-bit
               little-endian value: it has a 32-bit little-endian
               symbol index followed by four individual byte fields.
               Reorder INFO accordingly.  */
             if (elf_header.e_ident[EI_DATA] != ELFDATA2MSB)
              info = (((info & 0xffffffff) << 32)
                     | ((info >> 56) & 0xff)
                     | ((info >> 40) & 0xff00)
                     | ((info >> 24) & 0xff0000)
                     | ((info >> 8) & 0xff000000));
             type  = ELF64_MIPS_R_TYPE (info);
             type2 = ELF64_MIPS_R_TYPE2 (info);
             type3 = ELF64_MIPS_R_TYPE3 (info);
           }
         else if (elf_header.e_machine == EM_SPARCV9)
           type = ELF64_R_TYPE_ID (info);
         else
           type = ELF64_R_TYPE (info);

         symtab_index = ELF64_R_SYM  (info);
#endif
       }

      if (is_32bit_elf)
       {
#ifdef _bfd_int64_low
         printf ("%8.8lx  %8.8lx ", _bfd_int64_low (offset), _bfd_int64_low (info));
#else
         printf ("%8.8lx  %8.8lx ", offset, info);
#endif
       }
      else
       {
#ifdef _bfd_int64_low
         printf (do_wide
                ? "%8.8lx%8.8lx  %8.8lx%8.8lx "
                : "%4.4lx%8.8lx  %4.4lx%8.8lx ",
                _bfd_int64_high (offset),
                _bfd_int64_low (offset),
                _bfd_int64_high (info),
                _bfd_int64_low (info));
#else
         printf (do_wide
                ? "%16.16lx  %16.16lx "
                : "%12.12lx  %12.12lx ",
                offset, info);
#endif
       }

      switch (elf_header.e_machine)
       {
       default:
         rtype = NULL;
         break;

       case EM_M32R:
       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_68HC11:
       case EM_68HC12:
         rtype = elf_m68hc11_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:
       case EM_AVR_OLD:
         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_SPU:
         rtype = elf_spu_reloc_type (type);
         break;

       case EM_V850:
       case EM_CYGNUS_V850:
         rtype = v850_reloc_type (type);
         break;

       case EM_D10V:
       case EM_CYGNUS_D10V:
         rtype = elf_d10v_reloc_type (type);
         break;

       case EM_D30V:
       case EM_CYGNUS_D30V:
         rtype = elf_d30v_reloc_type (type);
         break;

       case EM_DLX:
         rtype = elf_dlx_reloc_type (type);
         break;

       case EM_SH:
         rtype = elf_sh_reloc_type (type);
         break;

       case EM_MN10300:
       case EM_CYGNUS_MN10300:
         rtype = elf_mn10300_reloc_type (type);
         break;

       case EM_MN10200:
       case EM_CYGNUS_MN10200:
         rtype = elf_mn10200_reloc_type (type);
         break;

       case EM_FR30:
       case EM_CYGNUS_FR30:
         rtype = elf_fr30_reloc_type (type);
         break;

       case EM_CYGNUS_FRV:
         rtype = elf_frv_reloc_type (type);
         break;

       case EM_MCORE:
         rtype = elf_mcore_reloc_type (type);
         break;

       case EM_MMIX:
         rtype = elf_mmix_reloc_type (type);
         break;

       case EM_MSP430:
       case EM_MSP430_OLD:
         rtype = elf_msp430_reloc_type (type);
         break;

       case EM_PPC:
         rtype = elf_ppc_reloc_type (type);
         break;

       case EM_PPC64:
         rtype = elf_ppc64_reloc_type (type);
         break;

       case EM_MIPS:
       case EM_MIPS_RS3_LE:
         rtype = elf_mips_reloc_type (type);
         if (!is_32bit_elf)
           {
             rtype2 = elf_mips_reloc_type (type2);
             rtype3 = elf_mips_reloc_type (type3);
           }
         break;

       case EM_ALPHA:
         rtype = elf_alpha_reloc_type (type);
         break;

       case EM_ARM:
         rtype = elf_arm_reloc_type (type);
         break;

       case EM_ARC:
         rtype = elf_arc_reloc_type (type);
         break;

       case EM_PARISC:
         rtype = elf_hppa_reloc_type (type);
         break;

       case EM_H8_300:
       case EM_H8_300H:
       case EM_H8S:
         rtype = elf_h8_reloc_type (type);
         break;

       case EM_OPENRISC:
       case EM_OR32:
         rtype = elf_or32_reloc_type (type);
         break;

       case EM_PJ:
       case EM_PJ_OLD:
         rtype = elf_pj_reloc_type (type);
         break;
       case EM_IA_64:
         rtype = elf_ia64_reloc_type (type);
         break;

       case EM_CRIS:
         rtype = elf_cris_reloc_type (type);
         break;

       case EM_860:
         rtype = elf_i860_reloc_type (type);
         break;

       case EM_X86_64:
         rtype = elf_x86_64_reloc_type (type);
         break;

       case EM_S370:
         rtype = i370_reloc_type (type);
         break;

       case EM_S390_OLD:
       case EM_S390:
         rtype = elf_s390_reloc_type (type);
         break;

       case EM_SCORE:
         rtype = elf_score_reloc_type (type);
         break;

       case EM_XSTORMY16:
         rtype = elf_xstormy16_reloc_type (type);
         break;

       case EM_CRX:
         rtype = elf_crx_reloc_type (type);
         break;

       case EM_VAX:
         rtype = elf_vax_reloc_type (type);
         break;

       case EM_IP2K:
       case EM_IP2K_OLD:
         rtype = elf_ip2k_reloc_type (type);
         break;

       case EM_IQ2000:
         rtype = elf_iq2000_reloc_type (type);
         break;

       case EM_XTENSA_OLD:
       case EM_XTENSA:
         rtype = elf_xtensa_reloc_type (type);
         break;

       case EM_M32C:
         rtype = elf_m32c_reloc_type (type);
         break;

       case EM_MT:
         rtype = elf_mt_reloc_type (type);
         break;

       case EM_BLACKFIN:
         rtype = elf_bfin_reloc_type (type);
         break;

       case EM_CYGNUS_MEP:
         rtype = elf_mep_reloc_type (type);
         break;
       }

      if (rtype == NULL)
#ifdef _bfd_int64_low
       printf (_("unrecognized: %-7lx"), _bfd_int64_low (type));
#else
       printf (_("unrecognized: %-7lx"), type);
#endif
      else
       printf (do_wide ? "%-22.22s" : "%-17.17s", rtype);

      if (elf_header.e_machine == EM_ALPHA
         && rtype != NULL
         && streq (rtype, "R_ALPHA_LITUSE")
         && is_rela)
       {
         switch (rels[i].r_addend)
           {
           case LITUSE_ALPHA_ADDR:   rtype = "ADDR";   break;
           case LITUSE_ALPHA_BASE:   rtype = "BASE";   break;
           case LITUSE_ALPHA_BYTOFF: rtype = "BYTOFF"; break;
           case LITUSE_ALPHA_JSR:    rtype = "JSR";    break;
           case LITUSE_ALPHA_TLSGD:  rtype = "TLSGD";  break;
           case LITUSE_ALPHA_TLSLDM: rtype = "TLSLDM"; break;
           case LITUSE_ALPHA_JSRDIRECT: rtype = "JSRDIRECT"; break;
           default: rtype = NULL;
           }
         if (rtype)
           printf (" (%s)", rtype);
         else
           {
             putchar (' ');
             printf (_("<unknown addend: %lx>"),
                    (unsigned long) rels[i].r_addend);
           }
       }
      else if (symtab_index)
       {
         if (symtab == NULL || 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 (is_32bit_elf ? "   " : " ");

             if (psym->st_name == 0)
              {
                const char *sec_name = "<null>";
                char name_buf[40];

                if (ELF_ST_TYPE (psym->st_info) == STT_SECTION)
                  {
                    bfd_vma sec_index = (bfd_vma) -1;

                    if (psym->st_shndx < SHN_LORESERVE)
                     sec_index = psym->st_shndx;
                    else if (psym->st_shndx > SHN_HIRESERVE)
                     sec_index = psym->st_shndx - (SHN_HIRESERVE + 1
                                                - SHN_LORESERVE);

                    if (sec_index != (bfd_vma) -1)
                     sec_name = SECTION_NAME (section_headers + sec_index);
                    else if (psym->st_shndx == SHN_ABS)
                     sec_name = "ABS";
                    else if (psym->st_shndx == SHN_COMMON)
                     sec_name = "COMMON";
                    else if (elf_header.e_machine == EM_MIPS
                            && psym->st_shndx == SHN_MIPS_SCOMMON)
                     sec_name = "SCOMMON";
                    else if (elf_header.e_machine == EM_MIPS
                            && psym->st_shndx == SHN_MIPS_SUNDEFINED)
                     sec_name = "SUNDEF";
                    else if (elf_header.e_machine == EM_X86_64
                            && psym->st_shndx == SHN_X86_64_LCOMMON)
                     sec_name = "LARGE_COMMON";
                    else if (elf_header.e_machine == EM_IA_64
                            && elf_header.e_ident[EI_OSABI] == ELFOSABI_HPUX
                            && psym->st_shndx == SHN_IA_64_ANSI_COMMON)
                     sec_name = "ANSI_COM";
                    else
                     {
                       sprintf (name_buf, "<section 0x%x>",
                               (unsigned int) psym->st_shndx);
                       sec_name = name_buf;
                     }
                  }
                print_symbol (22, sec_name);
              }
             else if (strtab == NULL)
              printf (_("<string table index: %3ld>"), psym->st_name);
             else if (psym->st_name >= strtablen)
              printf (_("<corrupt string table index: %3ld>"), psym->st_name);
             else
              print_symbol (22, strtab + psym->st_name);

             if (is_rela)
              printf (" + %lx", (unsigned long) rels[i].r_addend);
           }
       }
      else if (is_rela)
       {
         printf ("%*c", is_32bit_elf ?
                (do_wide ? 34 : 28) : (do_wide ? 26 : 20), ' ');
         print_vma (rels[i].r_addend, LONG_HEX);
       }

      if (elf_header.e_machine == EM_SPARCV9
         && rtype != NULL
         && streq (rtype, "R_SPARC_OLO10"))
       printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (info));

      putchar ('\n');

      if (! is_32bit_elf && elf_header.e_machine == EM_MIPS)
       {
         printf ("                    Type2: ");

         if (rtype2 == NULL)
#ifdef _bfd_int64_low
           printf (_("unrecognized: %-7lx"), _bfd_int64_low (type2));
#else
           printf (_("unrecognized: %-7lx"), type2);
#endif
         else
           printf ("%-17.17s", rtype2);

         printf ("\n                    Type3: ");

         if (rtype3 == NULL)
#ifdef _bfd_int64_low
           printf (_("unrecognized: %-7lx"), _bfd_int64_low (type3));
#else
           printf (_("unrecognized: %-7lx"), type3);
#endif
         else
           printf ("%-17.17s", rtype3);

         putchar ('\n');
       }
    }

  free (rels);

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int dump_section ( Elf_Internal_Shdr section,
FILE *  file 
) [static]

Definition at line 7665 of file readelf.c.

{
  Elf_Internal_Shdr *relsec;
  bfd_size_type bytes;
  bfd_vma addr;
  unsigned char *data;
  unsigned char *start;

  bytes = section->sh_size;

  if (bytes == 0 || section->sh_type == SHT_NOBITS)
    {
      printf (_("\nSection '%s' has no data to dump.\n"),
             SECTION_NAME (section));
      return 0;
    }
  else
    printf (_("\nHex dump of section '%s':\n"), SECTION_NAME (section));

  addr = section->sh_addr;

  start = get_data (NULL, file, section->sh_offset, 1, bytes,
                  _("section data"));
  if (!start)
    return 0;

  /* If the section being dumped has relocations against it the user might
     be expecting these relocations to have been applied.  Check for this
     case and issue a warning message in order to avoid confusion.
     FIXME: Maybe we ought to have an option that dumps a section with
     relocs applied ?  */
  for (relsec = section_headers;
       relsec < section_headers + elf_header.e_shnum;
       ++relsec)
    {
      if ((relsec->sh_type != SHT_RELA && relsec->sh_type != SHT_REL)
         || SECTION_HEADER_INDEX (relsec->sh_info) >= elf_header.e_shnum
         || SECTION_HEADER (relsec->sh_info) != section
         || relsec->sh_size == 0
         || SECTION_HEADER_INDEX (relsec->sh_link) >= elf_header.e_shnum)
       continue;

      printf (_(" NOTE: This section has relocations against it, but these have NOT been applied to this dump.\n"));
      break;
    }
  
  data = start;

  while (bytes)
    {
      int j;
      int k;
      int lbytes;

      lbytes = (bytes > 16 ? 16 : bytes);

      printf ("  0x%8.8lx ", (unsigned long) addr);

      for (j = 0; j < 16; j++)
       {
         if (j < lbytes)
           printf ("%2.2x", data[j]);
         else
           printf ("  ");

         if ((j & 3) == 3)
           printf (" ");
       }

      for (j = 0; j < lbytes; j++)
       {
         k = data[j];
         if (k >= ' ' && k < 0x7f)
           printf ("%c", k);
         else
           printf (".");
       }

      putchar ('\n');

      data  += lbytes;
      addr  += lbytes;
      bytes -= lbytes;
    }

  free (start);

  putchar ('\n');
  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void dynamic_section_ia64_val ( Elf_Internal_Dyn entry) [static]

Definition at line 5684 of file readelf.c.

{
  switch (entry->d_tag)
    {
    case DT_IA_64_PLT_RESERVE:
      /* First 3 slots reserved.  */
      print_vma (entry->d_un.d_ptr, PREFIX_HEX);
      printf (" -- ");
      print_vma (entry->d_un.d_ptr + (3 * 8), PREFIX_HEX);
      break;

    default:
      print_vma (entry->d_un.d_ptr, PREFIX_HEX);
      break;
    }
  putchar ('\n');
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void dynamic_section_mips_val ( Elf_Internal_Dyn entry) [static]

Definition at line 5549 of file readelf.c.

{
  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 (VALID_DYNAMIC_NAME (entry->d_un.d_val))
       printf ("Interface Version: %s\n", GET_DYNAMIC_NAME (entry->d_un.d_val));
      else
       printf ("<corrupt: %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);
       snprintf (timebuf, sizeof (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);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void dynamic_section_parisc_val ( Elf_Internal_Dyn entry) [static]

Definition at line 5622 of file readelf.c.

{
  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" },
         { DT_HP_GST, "HP_GST" },
         { DT_HP_SHLIB_FIXED, "HP_SHLIB_FIXED" },
         { DT_HP_MERGE_SHLIB_SEG, "HP_MERGE_SHLIB_SEG" },
         { DT_HP_NODELETE, "HP_NODELETE" },
         { DT_HP_GROUP, "HP_GROUP" },
         { DT_HP_PROTECT_LINKAGE_TABLE, "HP_PROTECT_LINKAGE_TABLE" }
       };
       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;
    }
  putchar ('\n');
}

Here is the call graph for this function:

Here is the caller graph for this function:

static Elf_Internal_Shdr* find_section ( const char *  name) [static]

Definition at line 578 of file readelf.c.

{
  unsigned int i;

  for (i = 0; i < elf_header.e_shnum; i++)
    if (streq (SECTION_NAME (section_headers + i), name))
      return section_headers + i;

  return NULL;
}

Here is the caller graph for this function:

static void find_symbol_for_address ( Elf_Internal_Sym *  symtab,
unsigned long  nsyms,
const char *  strtab,
unsigned long  strtab_size,
struct absaddr  addr,
const char **  symname,
bfd_vma offset 
) [static]

Definition at line 4827 of file readelf.c.

{
  bfd_vma dist = 0x100000;
  Elf_Internal_Sym *sym, *best = NULL;
  unsigned long i;

  for (i = 0, sym = symtab; i < nsyms; ++i, ++sym)
    {
      if (ELF_ST_TYPE (sym->st_info) == STT_FUNC
         && sym->st_name != 0
         && (addr.section == SHN_UNDEF || addr.section == sym->st_shndx)
         && addr.offset >= sym->st_value
         && addr.offset - sym->st_value < dist)
       {
         best = sym;
         dist = addr.offset - sym->st_value;
         if (!dist)
           break;
       }
    }
  if (best)
    {
      *symname = (best->st_name >= strtab_size
                ? "<corrupt>" : strtab + best->st_name);
      *offset = dist;
      return;
    }
  *symname = NULL;
  *offset = addr.offset;
}

Here is the caller graph for this function:

Definition at line 7945 of file readelf.c.

{
  struct dwarf_section *section = &debug_displays [debug].section;

  if (section->start == NULL)
    return;

  free ((char *) section->start);
  section->start = NULL;
  section->address = 0;
  section->size = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_32bit_dynamic_section ( FILE *  file) [static]

Definition at line 5703 of file readelf.c.

{
  Elf32_External_Dyn *edyn, *ext;
  Elf_Internal_Dyn *entry;

  edyn = get_data (NULL, file, dynamic_addr, 1, dynamic_size,
                 _("dynamic section"));
  if (!edyn)
    return 0;

/* SGI's ELF has more than one section in the DYNAMIC segment, and we
   might not have the luxury of section headers.  Look for the DT_NULL
   terminator to determine the number of entries.  */
  for (ext = edyn, dynamic_nent = 0;
       (char *) ext < (char *) edyn + dynamic_size;
       ext++)
    {
      dynamic_nent++;
      if (BYTE_GET (ext->d_tag) == DT_NULL)
       break;
    }

  dynamic_section = cmalloc (dynamic_nent, sizeof (*entry));
  if (dynamic_section == NULL)
    {
      error (_("Out of memory\n"));
      free (edyn);
      return 0;
    }

  for (ext = edyn, entry = dynamic_section;
       entry < dynamic_section + dynamic_nent;
       ext++, entry++)
    {
      entry->d_tag      = BYTE_GET (ext->d_tag);
      entry->d_un.d_val = BYTE_GET (ext->d_un.d_val);
    }

  free (edyn);

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static Elf_Internal_Sym* get_32bit_elf_symbols ( FILE *  file,
Elf_Internal_Shdr section 
) [static]

Definition at line 3707 of file readelf.c.

{
  unsigned long number;
  Elf32_External_Sym *esyms;
  Elf_External_Sym_Shndx *shndx;
  Elf_Internal_Sym *isyms;
  Elf_Internal_Sym *psym;
  unsigned int j;

  esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
                  _("symbols"));
  if (!esyms)
    return NULL;

  shndx = NULL;
  if (symtab_shndx_hdr != NULL
      && (symtab_shndx_hdr->sh_link
         == (unsigned long) SECTION_HEADER_NUM (section - section_headers)))
    {
      shndx = get_data (NULL, file, symtab_shndx_hdr->sh_offset,
                     1, symtab_shndx_hdr->sh_size, _("symtab shndx"));
      if (!shndx)
       {
         free (esyms);
         return NULL;
       }
    }

  number = section->sh_size / section->sh_entsize;
  isyms = cmalloc (number, sizeof (Elf_Internal_Sym));

  if (isyms == NULL)
    {
      error (_("Out of memory\n"));
      if (shndx)
       free (shndx);
      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);
      if (psym->st_shndx == SHN_XINDEX && shndx != NULL)
       psym->st_shndx
         = byte_get ((unsigned char *) &shndx[j], sizeof (shndx[j]));
      psym->st_info  = BYTE_GET (esyms[j].st_info);
      psym->st_other = BYTE_GET (esyms[j].st_other);
    }

  if (shndx)
    free (shndx);
  free (esyms);

  return isyms;
}

Here is the call graph for this function:

static int get_32bit_program_headers ( FILE *  file,
Elf_Internal_Phdr *  program_headers 
) [static]

Definition at line 3268 of file readelf.c.

{
  Elf32_External_Phdr *phdrs;
  Elf32_External_Phdr *external;
  Elf_Internal_Phdr *internal;
  unsigned int i;

  phdrs = get_data (NULL, file, elf_header.e_phoff,
                  elf_header.e_phentsize, elf_header.e_phnum,
                  _("program headers"));
  if (!phdrs)
    return 0;

  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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_32bit_section_headers ( FILE *  file,
unsigned int  num 
) [static]

Definition at line 3625 of file readelf.c.

{
  Elf32_External_Shdr *shdrs;
  Elf_Internal_Shdr *internal;
  unsigned int i;

  shdrs = get_data (NULL, file, elf_header.e_shoff,
                  elf_header.e_shentsize, num, _("section headers"));
  if (!shdrs)
    return 0;

  section_headers = cmalloc (num, sizeof (Elf_Internal_Shdr));

  if (section_headers == NULL)
    {
      error (_("Out of memory\n"));
      return 0;
    }

  for (i = 0, internal = section_headers;
       i < num;
       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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_64bit_dynamic_section ( FILE *  file) [static]

Definition at line 5747 of file readelf.c.

{
  Elf64_External_Dyn *edyn, *ext;
  Elf_Internal_Dyn *entry;

  edyn = get_data (NULL, file, dynamic_addr, 1, dynamic_size,
                 _("dynamic section"));
  if (!edyn)
    return 0;

/* SGI's ELF has more than one section in the DYNAMIC segment, and we
   might not have the luxury of section headers.  Look for the DT_NULL
   terminator to determine the number of entries.  */
  for (ext = edyn, dynamic_nent = 0;
       (char *) ext < (char *) edyn + dynamic_size;
       ext++)
    {
      dynamic_nent++;
      if (BYTE_GET (ext->d_tag) == DT_NULL)
       break;
    }

  dynamic_section = cmalloc (dynamic_nent, sizeof (*entry));
  if (dynamic_section == NULL)
    {
      error (_("Out of memory\n"));
      free (edyn);
      return 0;
    }

  for (ext = edyn, entry = dynamic_section;
       entry < dynamic_section + dynamic_nent;
       ext++, entry++)
    {
      entry->d_tag      = BYTE_GET (ext->d_tag);
      entry->d_un.d_val = BYTE_GET (ext->d_un.d_val);
    }

  free (edyn);

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static Elf_Internal_Sym* get_64bit_elf_symbols ( FILE *  file,
Elf_Internal_Shdr section 
) [static]

Definition at line 3770 of file readelf.c.

{
  unsigned long number;
  Elf64_External_Sym *esyms;
  Elf_External_Sym_Shndx *shndx;
  Elf_Internal_Sym *isyms;
  Elf_Internal_Sym *psym;
  unsigned int j;

  esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
                  _("symbols"));
  if (!esyms)
    return NULL;

  shndx = NULL;
  if (symtab_shndx_hdr != NULL
      && (symtab_shndx_hdr->sh_link
         == (unsigned long) SECTION_HEADER_NUM (section - section_headers)))
    {
      shndx = get_data (NULL, file, symtab_shndx_hdr->sh_offset,
                     1, symtab_shndx_hdr->sh_size, _("symtab shndx"));
      if (!shndx)
       {
         free (esyms);
         return NULL;
       }
    }

  number = section->sh_size / section->sh_entsize;
  isyms = cmalloc (number, sizeof (Elf_Internal_Sym));

  if (isyms == NULL)
    {
      error (_("Out of memory\n"));
      if (shndx)
       free (shndx);
      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);
      if (psym->st_shndx == SHN_XINDEX && shndx != NULL)
       psym->st_shndx
         = byte_get ((unsigned char *) &shndx[j], sizeof (shndx[j]));
      psym->st_value = BYTE_GET (esyms[j].st_value);
      psym->st_size  = BYTE_GET (esyms[j].st_size);
    }

  if (shndx)
    free (shndx);
  free (esyms);

  return isyms;
}

Here is the call graph for this function:

static int get_64bit_program_headers ( FILE *  file,
Elf_Internal_Phdr *  program_headers 
) [static]

Definition at line 3301 of file readelf.c.

{
  Elf64_External_Phdr *phdrs;
  Elf64_External_Phdr *external;
  Elf_Internal_Phdr *internal;
  unsigned int i;

  phdrs = get_data (NULL, file, elf_header.e_phoff,
                  elf_header.e_phentsize, elf_header.e_phnum,
                  _("program headers"));
  if (!phdrs)
    return 0;

  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_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_align  = BYTE_GET (external->p_align);
    }

  free (phdrs);

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_64bit_section_headers ( FILE *  file,
unsigned int  num 
) [static]

Definition at line 3666 of file readelf.c.

{
  Elf64_External_Shdr *shdrs;
  Elf_Internal_Shdr *internal;
  unsigned int i;

  shdrs = get_data (NULL, file, elf_header.e_shoff,
                  elf_header.e_shentsize, num, _("section headers"));
  if (!shdrs)
    return 0;

  section_headers = cmalloc (num, sizeof (Elf_Internal_Shdr));

  if (section_headers == NULL)
    {
      error (_("Out of memory\n"));
      return 0;
    }

  for (i = 0, internal = section_headers;
       i < num;
       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_size      = BYTE_GET (shdrs[i].sh_size);
      internal->sh_entsize   = BYTE_GET (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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_alpha_dynamic_type ( unsigned long  type) [static]

Definition at line 1479 of file readelf.c.

{
  switch (type)
    {
    case DT_ALPHA_PLTRO: return "ALPHA_PLTRO";
    default:
      return NULL;
    }
}

Here is the caller graph for this function:

static const char* get_arm_section_type_name ( unsigned int  sh_type) [static]

Definition at line 2626 of file readelf.c.

{
  switch (sh_type)
    {
    case SHT_ARM_EXIDX:
      return "ARM_EXIDX";
    case SHT_ARM_PREEMPTMAP:
      return "ARM_PREEMPTMAP";
    case SHT_ARM_ATTRIBUTES:
      return "ARM_ATTRIBUTES";
    default:
      break;
    }
  return NULL;
}

Here is the caller graph for this function:

static const char* get_arm_segment_type ( unsigned long  type) [static]

Definition at line 2367 of file readelf.c.

{
  switch (type)
    {
    case PT_ARM_EXIDX:
      return "EXIDX";
    default:
      break;
    }

  return NULL;
}

Here is the caller graph for this function:

static void* get_data ( void *  var,
FILE *  file,
long  offset,
size_t  size,
size_t  nmemb,
const char *  reason 
) [static]

Definition at line 309 of file readelf.c.

{
  void *mvar;

  if (size == 0 || nmemb == 0)
    return NULL;

  if (fseek (file, archive_file_offset + offset, SEEK_SET))
    {
      error (_("Unable to seek to 0x%lx for %s\n"),
            archive_file_offset + offset, reason);
      return NULL;
    }

  mvar = var;
  if (mvar == NULL)
    {
      /* Check for overflow.  */
      if (nmemb < (~(size_t) 0 - 1) / size)
       /* + 1 so that we can '\0' terminate invalid string table sections.  */
       mvar = malloc (size * nmemb + 1);

      if (mvar == NULL)
       {
         error (_("Out of memory allocating 0x%lx bytes for %s\n"),
               (unsigned long)(size * nmemb), reason);
         return NULL;
       }

      ((char *) mvar)[size * nmemb] = '\0';
    }

  if (fread (mvar, size, nmemb, file) != nmemb)
    {
      error (_("Unable to read in 0x%lx bytes of %s\n"),
            (unsigned long)(size * nmemb), reason);
      if (mvar != var)
       free (mvar);
      return NULL;
    }

  return mvar;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_data_encoding ( unsigned int  encoding) [static]

Definition at line 3151 of file readelf.c.

{
  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:
      snprintf (buff, sizeof (buff), _("<unknown: %x>"), encoding);
      return buff;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bfd_vma* get_dynamic_data ( FILE *  file,
unsigned int  number,
unsigned int  ent_size 
) [static]

Definition at line 6995 of file readelf.c.

{
  unsigned char *e_data;
  bfd_vma *i_data;

  e_data = cmalloc (number, ent_size);

  if (e_data == NULL)
    {
      error (_("Out of memory\n"));
      return NULL;
    }

  if (fread (e_data, ent_size, number, file) != number)
    {
      error (_("Unable to read in dynamic data\n"));
      return NULL;
    }

  i_data = cmalloc (number, sizeof (*i_data));

  if (i_data == NULL)
    {
      error (_("Out of memory\n"));
      free (e_data);
      return NULL;
    }

  while (number--)
    i_data[number] = byte_get (e_data + number * ent_size, ent_size);

  free (e_data);

  return i_data;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_dynamic_type ( unsigned long  type) [static]

Definition at line 1507 of file readelf.c.

{
  static char buff[64];

  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_CHECKSUM:       return "CHECKSUM";
    case DT_PLTPADSZ:       return "PLTPADSZ";
    case DT_MOVEENT: return "MOVEENT";
    case DT_MOVESZ:  return "MOVESZ";
    case DT_FEATURE: return "FEATURE";
    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_CONFIG:  return "CONFIG";
    case DT_DEPAUDIT:       return "DEPAUDIT";
    case DT_AUDIT:   return "AUDIT";
    case DT_PLTPAD:  return "PLTPAD";
    case DT_MOVETAB: return "MOVETAB";
    case DT_SYMINFO: return "SYMINFO"; /* aka ADDRRNGHI */

    case DT_VERSYM:  return "VERSYM";

    case DT_TLSDESC_GOT: return "TLSDESC_GOT";
    case DT_TLSDESC_PLT: return "TLSDESC_PLT";
    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 "AUXILIARY";
    case DT_USED:    return "USED";
    case DT_FILTER:  return "FILTER";

    case DT_GNU_PRELINKED: return "GNU_PRELINKED";
    case DT_GNU_CONFLICT: return "GNU_CONFLICT";
    case DT_GNU_CONFLICTSZ: return "GNU_CONFLICTSZ";
    case DT_GNU_LIBLIST: return "GNU_LIBLIST";
    case DT_GNU_LIBLISTSZ: return "GNU_LIBLISTSZ";
    case DT_GNU_HASH:       return "GNU_HASH";

    default:
      if ((type >= DT_LOPROC) && (type <= DT_HIPROC))
       {
         const char *result;

         switch (elf_header.e_machine)
           {
           case EM_MIPS:
           case EM_MIPS_RS3_LE:
             result = get_mips_dynamic_type (type);
             break;
           case EM_SPARCV9:
             result = get_sparc64_dynamic_type (type);
             break;
           case EM_PPC:
             result = get_ppc_dynamic_type (type);
             break;
           case EM_PPC64:
             result = get_ppc64_dynamic_type (type);
             break;
           case EM_IA_64:
             result = get_ia64_dynamic_type (type);
             break;
           case EM_ALPHA:
             result = get_alpha_dynamic_type (type);
             break;
           case EM_SCORE:
             result = get_score_dynamic_type (type);
             break;
           default:
             result = NULL;
             break;
           }

         if (result != NULL)
           return result;

         snprintf (buff, sizeof (buff), _("Processor Specific: %lx"), type);
       }
      else if (((type >= DT_LOOS) && (type <= DT_HIOS))
              || (elf_header.e_machine == EM_PARISC
                 && (type >= OLD_DT_LOOS) && (type <= OLD_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;

         snprintf (buff, sizeof (buff), _("Operating System specific: %lx"),
                  type);
       }
      else
       snprintf (buff, sizeof (buff), _("<unknown>: %lx"), type);

      return buff;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_elf_class ( unsigned int  elf_class) [static]

Definition at line 3135 of file readelf.c.

{
  static char buff[32];

  switch (elf_class)
    {
    case ELFCLASSNONE: return _("none");
    case ELFCLASS32:   return "ELF32";
    case ELFCLASS64:   return "ELF64";
    default:
      snprintf (buff, sizeof (buff), _("<unknown: %x>"), elf_class);
      return buff;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_elf_section_flags ( bfd_vma  sh_flags) [static]

Definition at line 3833 of file readelf.c.

{
  static char buff[1024];
  char *p = buff;
  int field_size = is_32bit_elf ? 8 : 16;
  int index, size = sizeof (buff) - (field_size + 4 + 1);
  bfd_vma os_flags = 0;
  bfd_vma proc_flags = 0;
  bfd_vma unknown_flags = 0;
  const struct
    {
      const char *str;
      int len;
    }
  flags [] =
    {
       { "WRITE", 5 },
       { "ALLOC", 5 },
       { "EXEC", 4 },
       { "MERGE", 5 },
       { "STRINGS", 7 },
       { "INFO LINK", 9 },
       { "LINK ORDER", 10 },
       { "OS NONCONF", 10 },
       { "GROUP", 5 },
       { "TLS", 3 }
    };

  if (do_section_details)
    {
      sprintf (buff, "[%*.*lx]: ",
              field_size, field_size, (unsigned long) sh_flags);
      p += field_size + 4;
    }

  while (sh_flags)
    {
      bfd_vma flag;

      flag = sh_flags & - sh_flags;
      sh_flags &= ~ flag;

      if (do_section_details)
       {
         switch (flag)
           {
           case SHF_WRITE:         index = 0; break;
           case SHF_ALLOC:         index = 1; break;
           case SHF_EXECINSTR:            index = 2; break;
           case SHF_MERGE:         index = 3; break;
           case SHF_STRINGS:              index = 4; break;
           case SHF_INFO_LINK:            index = 5; break;
           case SHF_LINK_ORDER:    index = 6; break;
           case SHF_OS_NONCONFORMING:     index = 7; break;
           case SHF_GROUP:         index = 8; break;
           case SHF_TLS:           index = 9; break;

           default:
             index = -1;
             break;
           }

         if (index != -1)
           {
             if (p != buff + field_size + 4)
              {
                if (size < (10 + 2))
                  abort ();
                size -= 2;
                *p++ = ',';
                *p++ = ' ';
              }

             size -= flags [index].len;
             p = stpcpy (p, flags [index].str);
           }
         else if (flag & SHF_MASKOS)
           os_flags |= flag;
         else if (flag & SHF_MASKPROC)
           proc_flags |= flag;
         else
           unknown_flags |= flag;
       }
      else
       {
         switch (flag)
           {
           case SHF_WRITE:         *p = 'W'; break;
           case SHF_ALLOC:         *p = 'A'; break;
           case SHF_EXECINSTR:            *p = 'X'; break;
           case SHF_MERGE:         *p = 'M'; break;
           case SHF_STRINGS:              *p = 'S'; break;
           case SHF_INFO_LINK:            *p = 'I'; break;
           case SHF_LINK_ORDER:    *p = 'L'; break;
           case SHF_OS_NONCONFORMING:     *p = 'O'; break;
           case SHF_GROUP:         *p = 'G'; break;
           case SHF_TLS:           *p = 'T'; break;

           default:
             if (elf_header.e_machine == EM_X86_64
                && flag == SHF_X86_64_LARGE)
              *p = 'l';
             else if (flag & SHF_MASKOS)
              {
                *p = 'o';
                sh_flags &= ~ SHF_MASKOS;
              }
             else if (flag & SHF_MASKPROC)
              {
                *p = 'p';
                sh_flags &= ~ SHF_MASKPROC;
              }
             else
              *p = 'x';
             break;
           }
         p++;
       }
    }

  if (do_section_details)
    {
      if (os_flags)
       {
         size -= 5 + field_size;
         if (p != buff + field_size + 4)
           {
             if (size < (2 + 1))
              abort ();
             size -= 2;
             *p++ = ',';
             *p++ = ' ';
           }
         sprintf (p, "OS (%*.*lx)", field_size, field_size,
                 (unsigned long) os_flags);
         p += 5 + field_size;
       }
      if (proc_flags)
       {
         size -= 7 + field_size;
         if (p != buff + field_size + 4)
           {
             if (size < (2 + 1))
              abort ();
             size -= 2;
             *p++ = ',';
             *p++ = ' ';
           }
         sprintf (p, "PROC (%*.*lx)", field_size, field_size,
                 (unsigned long) proc_flags);
         p += 7 + field_size;
       }
      if (unknown_flags)
       {
         size -= 10 + field_size;
         if (p != buff + field_size + 4)
           {
             if (size < (2 + 1))
              abort ();
             size -= 2;
             *p++ = ',';
             *p++ = ' ';
           }
         sprintf (p, "UNKNOWN (%*.*lx)", field_size, field_size,
                 (unsigned long) unknown_flags);
         p += 10 + field_size;
       }
    }

  *p = '\0';
  return buff;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_file_header ( FILE *  file) [static]

Definition at line 9196 of file readelf.c.

{
  /* Read in the identity array.  */
  if (fread (elf_header.e_ident, EI_NIDENT, 1, file) != 1)
    return 0;

  /* Determine how to read the rest of the header.  */
  switch (elf_header.e_ident[EI_DATA])
    {
    default: /* fall through */
    case ELFDATANONE: /* fall through */
    case ELFDATA2LSB:
      byte_get = byte_get_little_endian;
      byte_put = byte_put_little_endian;
      break;
    case ELFDATA2MSB:
      byte_get = byte_get_big_endian;
      byte_put = byte_put_big_endian;
      break;
    }

  /* For now we only support 32 bit and 64 bit ELF files.  */
  is_32bit_elf = (elf_header.e_ident[EI_CLASS] != ELFCLASS64);

  /* Read in the rest of the header.  */
  if (is_32bit_elf)
    {
      Elf32_External_Ehdr ehdr32;

      if (fread (ehdr32.e_type, sizeof (ehdr32) - EI_NIDENT, 1, file) != 1)
       return 0;

      elf_header.e_type      = BYTE_GET (ehdr32.e_type);
      elf_header.e_machine   = BYTE_GET (ehdr32.e_machine);
      elf_header.e_version   = BYTE_GET (ehdr32.e_version);
      elf_header.e_entry     = BYTE_GET (ehdr32.e_entry);
      elf_header.e_phoff     = BYTE_GET (ehdr32.e_phoff);
      elf_header.e_shoff     = BYTE_GET (ehdr32.e_shoff);
      elf_header.e_flags     = BYTE_GET (ehdr32.e_flags);
      elf_header.e_ehsize    = BYTE_GET (ehdr32.e_ehsize);
      elf_header.e_phentsize = BYTE_GET (ehdr32.e_phentsize);
      elf_header.e_phnum     = BYTE_GET (ehdr32.e_phnum);
      elf_header.e_shentsize = BYTE_GET (ehdr32.e_shentsize);
      elf_header.e_shnum     = BYTE_GET (ehdr32.e_shnum);
      elf_header.e_shstrndx  = BYTE_GET (ehdr32.e_shstrndx);
    }
  else
    {
      Elf64_External_Ehdr ehdr64;

      /* If we have been compiled with sizeof (bfd_vma) == 4, then
        we will not be able to cope with the 64bit data found in
        64 ELF files.  Detect this now and abort before we start
        overwriting things.  */
      if (sizeof (bfd_vma) < 8)
       {
         error (_("This instance of readelf has been built without support for a\n\
64 bit data type and so it cannot read 64 bit ELF files.\n"));
         return 0;
       }

      if (fread (ehdr64.e_type, sizeof (ehdr64) - EI_NIDENT, 1, file) != 1)
       return 0;

      elf_header.e_type      = BYTE_GET (ehdr64.e_type);
      elf_header.e_machine   = BYTE_GET (ehdr64.e_machine);
      elf_header.e_version   = BYTE_GET (ehdr64.e_version);
      elf_header.e_entry     = BYTE_GET (ehdr64.e_entry);
      elf_header.e_phoff     = BYTE_GET (ehdr64.e_phoff);
      elf_header.e_shoff     = BYTE_GET (ehdr64.e_shoff);
      elf_header.e_flags     = BYTE_GET (ehdr64.e_flags);
      elf_header.e_ehsize    = BYTE_GET (ehdr64.e_ehsize);
      elf_header.e_phentsize = BYTE_GET (ehdr64.e_phentsize);
      elf_header.e_phnum     = BYTE_GET (ehdr64.e_phnum);
      elf_header.e_shentsize = BYTE_GET (ehdr64.e_shentsize);
      elf_header.e_shnum     = BYTE_GET (ehdr64.e_shnum);
      elf_header.e_shstrndx  = BYTE_GET (ehdr64.e_shstrndx);
    }

  if (elf_header.e_shoff)
    {
      /* There may be some extensions in the first section header.  Don't
        bomb if we can't read it.  */
      if (is_32bit_elf)
       get_32bit_section_headers (file, 1);
      else
       get_64bit_section_headers (file, 1);
    }

  is_relocatable = elf_header.e_type == ET_REL;

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* get_file_type ( unsigned  e_type) [static]

Definition at line 1657 of file readelf.c.

{
  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))
       snprintf (buff, sizeof (buff), _("Processor Specific: (%x)"), e_type);
      else if ((e_type >= ET_LOOS) && (e_type <= ET_HIOS))
       snprintf (buff, sizeof (buff), _("OS Specific: (%x)"), e_type);
      else
       snprintf (buff, sizeof (buff), _("<unknown>: %x"), e_type);
      return buff;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_group_flags ( unsigned int  flags) [static]

Definition at line 4377 of file readelf.c.

{
  static char buff[32];
  switch (flags)
    {
    case GRP_COMDAT:
      return "COMDAT";

   default:
      snprintf (buff, sizeof (buff), _("[<unknown>: 0x%x]"), flags);
      break;
    }
  return buff;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_ia64_dynamic_type ( unsigned long  type) [static]

Definition at line 1468 of file readelf.c.

{
  switch (type)
    {
    case DT_IA_64_PLT_RESERVE: return "IA_64_PLT_RESERVE";
    default:
      return NULL;
    }
}

Here is the caller graph for this function:

static const char* get_ia64_section_type_name ( unsigned int  sh_type) [static]

Definition at line 2596 of file readelf.c.

{
  /* If the top 8 bits are 0x78 the next 8 are the os/abi ID.  */
  if ((sh_type & 0xFF000000) == SHT_IA_64_LOPSREG)
    return get_osabi_name ((sh_type & 0x00FF0000) >> 16);

  switch (sh_type)
    {
    case SHT_IA_64_EXT:              return "IA_64_EXT";
    case SHT_IA_64_UNWIND:    return "IA_64_UNWIND";
    case SHT_IA_64_PRIORITY_INIT: return "IA_64_PRIORITY_INIT";
    default:
      break;
    }
  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_ia64_segment_type ( unsigned long  type) [static]

Definition at line 2430 of file readelf.c.

{
  switch (type)
    {
    case PT_IA_64_ARCHEXT:  return "IA_64_ARCHEXT";
    case PT_IA_64_UNWIND:   return "IA_64_UNWIND";
    case PT_HP_TLS:         return "HP_TLS";
    case PT_IA_64_HP_OPT_ANOT:     return "HP_OPT_ANNOT";
    case PT_IA_64_HP_HSL_ANOT:     return "HP_HSL_ANNOT";
    case PT_IA_64_HP_STACK: return "HP_STACK";
    default:
      break;
    }

  return NULL;
}

Here is the caller graph for this function:

static char* get_machine_flags ( unsigned  e_flags,
unsigned  e_machine 
) [static]

Definition at line 1981 of file readelf.c.

{
  static char buf[1024];

  buf[0] = '\0';

  if (e_flags)
    {
      switch (e_machine)
       {
       default:
         break;

       case EM_ARM:
         decode_ARM_machine_flags (e_flags, buf);
         break;

       case EM_CYGNUS_FRV:
         switch (e_flags & EF_FRV_CPU_MASK)
           {
           case EF_FRV_CPU_GENERIC:
             break;

           default:
             strcat (buf, ", fr???");
             break;

           case EF_FRV_CPU_FR300:
             strcat (buf, ", fr300");
             break;

           case EF_FRV_CPU_FR400:
             strcat (buf, ", fr400");
             break;
           case EF_FRV_CPU_FR405:
             strcat (buf, ", fr405");
             break;

           case EF_FRV_CPU_FR450:
             strcat (buf, ", fr450");
             break;

           case EF_FRV_CPU_FR500:
             strcat (buf, ", fr500");
             break;
           case EF_FRV_CPU_FR550:
             strcat (buf, ", fr550");
             break;

           case EF_FRV_CPU_SIMPLE:
             strcat (buf, ", simple");
             break;
           case EF_FRV_CPU_TOMCAT:
             strcat (buf, ", tomcat");
             break;
           }
         break;

       case EM_68K:
         if ((e_flags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
           strcat (buf, ", m68000");
         else if ((e_flags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
           strcat (buf, ", cpu32");
         else if ((e_flags & EF_M68K_ARCH_MASK) == EF_M68K_FIDO)
           strcat (buf, ", fido_a");
         else
           {
             char const *isa = _("unknown");
             char const *mac = _("unknown mac");
             char const *additional = NULL;

             switch (e_flags & EF_M68K_CF_ISA_MASK)
              {
              case EF_M68K_CF_ISA_A_NODIV:
                isa = "A";
                additional = ", nodiv";
                break;
              case EF_M68K_CF_ISA_A:
                isa = "A";
                break;
              case EF_M68K_CF_ISA_A_PLUS:
                isa = "A+";
                break;
              case EF_M68K_CF_ISA_B_NOUSP:
                isa = "B";
                additional = ", nousp";
                break;
              case EF_M68K_CF_ISA_B:
                isa = "B";
                break;
              }
             strcat (buf, ", cf, isa ");
             strcat (buf, isa);
             if (additional)
              strcat (buf, additional);
             if (e_flags & EF_M68K_CF_FLOAT)
              strcat (buf, ", float");
             switch (e_flags & EF_M68K_CF_MAC_MASK)
              {
              case 0:
                mac = NULL;
                break;
              case EF_M68K_CF_MAC:
                mac = "mac";
                break;
              case EF_M68K_CF_EMAC:
                mac = "emac";
                break;
              }
             if (mac)
              {
                strcat (buf, ", ");
                strcat (buf, mac);
              }
           }
         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_V850:
       case EM_CYGNUS_V850:
         switch (e_flags & EF_V850_ARCH)
           {
           case E_V850E1_ARCH:
             strcat (buf, ", v850e1");
             break;
           case E_V850E_ARCH:
             strcat (buf, ", v850e");
             break;
           case E_V850_ARCH:
             strcat (buf, ", v850");
             break;
           default:
             strcat (buf, ", unknown v850 architecture variant");
             break;
           }
         break;

       case EM_M32R:
       case EM_CYGNUS_M32R:
         if ((e_flags & EF_M32R_ARCH) == E_M32R_ARCH)
           strcat (buf, ", m32r");
         break;

       case EM_MIPS:
       case EM_MIPS_RS3_LE:
         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_UCODE)
           strcat (buf, ", ugen_reserved");

         if (e_flags & EF_MIPS_ABI2)
           strcat (buf, ", abi2");

         if (e_flags & EF_MIPS_OPTIONS_FIRST)
           strcat (buf, ", odk first");

         if (e_flags & EF_MIPS_32BITMODE)
           strcat (buf, ", 32bitmode");

         switch ((e_flags & EF_MIPS_MACH))
           {
           case E_MIPS_MACH_3900: strcat (buf, ", 3900"); break;
           case E_MIPS_MACH_4010: strcat (buf, ", 4010"); break;
           case E_MIPS_MACH_4100: strcat (buf, ", 4100"); break;
           case E_MIPS_MACH_4111: strcat (buf, ", 4111"); break;
           case E_MIPS_MACH_4120: strcat (buf, ", 4120"); break;
           case E_MIPS_MACH_4650: strcat (buf, ", 4650"); break;
           case E_MIPS_MACH_5400: strcat (buf, ", 5400"); break;
           case E_MIPS_MACH_5500: strcat (buf, ", 5500"); break;
           case E_MIPS_MACH_SB1:  strcat (buf, ", sb1");  break;
           case E_MIPS_MACH_9000: strcat (buf, ", 9000"); break;
           case 0:
           /* We simply ignore the field in this case to avoid confusion:
              MIPS ELF does not specify EF_MIPS_MACH, it is a GNU
              extension.  */
             break;
           default: strcat (buf, ", unknown CPU"); break;
           }

         switch ((e_flags & EF_MIPS_ABI))
           {
           case E_MIPS_ABI_O32: strcat (buf, ", o32"); break;
           case E_MIPS_ABI_O64: strcat (buf, ", o64"); break;
           case E_MIPS_ABI_EABI32: strcat (buf, ", eabi32"); break;
           case E_MIPS_ABI_EABI64: strcat (buf, ", eabi64"); break;
           case 0:
           /* We simply ignore the field in this case to avoid confusion:
              MIPS ELF does not specify EF_MIPS_ABI, it is a GNU extension.
              This means it is likely to be an o32 file, but not for
              sure.  */
             break;
           default: strcat (buf, ", unknown ABI"); break;
           }

         if (e_flags & EF_MIPS_ARCH_ASE_MDMX)
           strcat (buf, ", mdmx");

         if (e_flags & EF_MIPS_ARCH_ASE_M16)
           strcat (buf, ", mips16");

         switch ((e_flags & EF_MIPS_ARCH))
           {
           case E_MIPS_ARCH_1: strcat (buf, ", mips1"); break;
           case E_MIPS_ARCH_2: strcat (buf, ", mips2"); break;
           case E_MIPS_ARCH_3: strcat (buf, ", mips3"); break;
           case E_MIPS_ARCH_4: strcat (buf, ", mips4"); break;
           case E_MIPS_ARCH_5: strcat (buf, ", mips5"); break;
           case E_MIPS_ARCH_32: strcat (buf, ", mips32"); break;
           case E_MIPS_ARCH_32R2: strcat (buf, ", mips32r2"); break;
           case E_MIPS_ARCH_64: strcat (buf, ", mips64"); break;
           case E_MIPS_ARCH_64R2: strcat (buf, ", mips64r2"); break;
           default: strcat (buf, ", unknown ISA"); break;
           }

         break;

       case EM_SH:
         switch ((e_flags & EF_SH_MACH_MASK))
           {
           case EF_SH1: strcat (buf, ", sh1"); break;
           case EF_SH2: strcat (buf, ", sh2"); break;
           case EF_SH3: strcat (buf, ", sh3"); break;
           case EF_SH_DSP: strcat (buf, ", sh-dsp"); break;
           case EF_SH3_DSP: strcat (buf, ", sh3-dsp"); break;
           case EF_SH4AL_DSP: strcat (buf, ", sh4al-dsp"); break;
           case EF_SH3E: strcat (buf, ", sh3e"); break;
           case EF_SH4: strcat (buf, ", sh4"); break;
           case EF_SH5: strcat (buf, ", sh5"); break;
           case EF_SH2E: strcat (buf, ", sh2e"); break;
           case EF_SH4A: strcat (buf, ", sh4a"); break;
           case EF_SH2A: strcat (buf, ", sh2a"); break;
           case EF_SH4_NOFPU: strcat (buf, ", sh4-nofpu"); break;
           case EF_SH4A_NOFPU: strcat (buf, ", sh4a-nofpu"); break;
           case EF_SH2A_NOFPU: strcat (buf, ", sh2a-nofpu"); break;
           case EF_SH3_NOMMU: strcat (buf, ", sh3-nommu"); break;
           case EF_SH4_NOMMU_NOFPU: strcat (buf, ", sh4-nommu-nofpu"); break;
           case EF_SH2A_SH4_NOFPU: strcat (buf, ", sh2a-nofpu-or-sh4-nommu-nofpu"); break;
           case EF_SH2A_SH3_NOFPU: strcat (buf, ", sh2a-nofpu-or-sh3-nommu"); break;
           case EF_SH2A_SH4: strcat (buf, ", sh2a-or-sh4"); break;
           case EF_SH2A_SH3E: strcat (buf, ", sh2a-or-sh3e"); break;
           default: strcat (buf, ", unknown ISA"); break;
           }

         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:
       case EM_PJ_OLD:
         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;

       case EM_IA_64:
         if ((e_flags & EF_IA_64_ABI64))
           strcat (buf, ", 64-bit");
         else
           strcat (buf, ", 32-bit");
         if ((e_flags & EF_IA_64_REDUCEDFP))
           strcat (buf, ", reduced fp model");
         if ((e_flags & EF_IA_64_NOFUNCDESC_CONS_GP))
           strcat (buf, ", no function descriptors, constant gp");
         else if ((e_flags & EF_IA_64_CONS_GP))
           strcat (buf, ", constant gp");
         if ((e_flags & EF_IA_64_ABSOLUTE))
           strcat (buf, ", absolute");
         break;

       case EM_VAX:
         if ((e_flags & EF_VAX_NONPIC))
           strcat (buf, ", non-PIC");
         if ((e_flags & EF_VAX_DFLOAT))
           strcat (buf, ", D-Float");
         if ((e_flags & EF_VAX_GFLOAT))
           strcat (buf, ", G-Float");
         break;
       }
    }

  return buf;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* get_machine_name ( unsigned  e_machine) [static]

Definition at line 1681 of file readelf.c.

{
  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_SPU:            return "SPU";
    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";
    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_PPC64:          return "PowerPC64";
    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 "Renesas / SuperH SH";
    case EM_SPARCV9:        return "Sparc v9";
    case EM_TRICORE:        return "Siemens Tricore";
    case EM_ARC:            return "ARC";
    case EM_H8_300:         return "Renesas H8/300";
    case EM_H8_300H:        return "Renesas H8/300H";
    case EM_H8S:            return "Renesas H8S";
    case EM_H8_500:         return "Renesas 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:
    case EM_D10V:           return "d10v";
    case EM_CYGNUS_D30V:
    case EM_D30V:           return "d30v";
    case EM_CYGNUS_M32R:
    case EM_M32R:           return "Renesas M32R (formerly Mitsubishi M32r)";
    case EM_CYGNUS_V850:
    case EM_V850:           return "NEC v850";
    case EM_CYGNUS_MN10300:
    case EM_MN10300:        return "mn10300";
    case EM_CYGNUS_MN10200:
    case EM_MN10200:        return "mn10200";
    case EM_CYGNUS_FR30:
    case EM_FR30:           return "Fujitsu FR30";
    case EM_CYGNUS_FRV:            return "Fujitsu FR-V";
    case EM_PJ_OLD:
    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";
    case EM_AVR_OLD:
    case EM_AVR:            return "Atmel AVR 8-bit microcontroller";
    case EM_CRIS:           return "Axis Communications 32-bit embedded processor";
    case EM_JAVELIN:        return "Infineon Technologies 32-bit embedded cpu";
    case EM_FIREPATH:              return "Element 14 64-bit DSP processor";
    case EM_ZSP:            return "LSI Logic's 16-bit DSP processor";
    case EM_MMIX:           return "Donald Knuth's educational 64-bit processor";
    case EM_HUANY:          return "Harvard Universitys's machine-independent object format";
    case EM_PRISM:          return "Vitesse Prism";
    case EM_X86_64:         return "Advanced Micro Devices X86-64";
    case EM_S390_OLD:
    case EM_S390:           return "IBM S/390";
    case EM_SCORE:          return "SUNPLUS S+Core";
    case EM_XSTORMY16:             return "Sanyo Xstormy16 CPU core";
    case EM_OPENRISC:
    case EM_OR32:           return "OpenRISC";
    case EM_CRX:            return "National Semiconductor CRX microprocessor";
    case EM_DLX:            return "OpenDLX";
    case EM_IP2K_OLD:
    case EM_IP2K:           return "Ubicom IP2xxx 8-bit microcontrollers";
    case EM_IQ2000:         return "Vitesse IQ2000";
    case EM_XTENSA_OLD:
    case EM_XTENSA:         return "Tensilica Xtensa Processor";
    case EM_M32C:            return "Renesas M32c";
    case EM_MT:                 return "Morpho Techologies MT processor";
    case EM_BLACKFIN:              return "Analog Devices Blackfin";
    case EM_NIOS32:         return "Altera Nios";
    case EM_ALTERA_NIOS2:   return "Altera Nios II";
    case EM_XC16X:          return "Infineon Technologies xc16x";
    case EM_CYGNUS_MEP:         return "Toshiba MeP Media Engine";
    default:
      snprintf (buff, sizeof (buff), _("<unknown>: 0x%x"), e_machine);
      return buff;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_mips_dynamic_type ( unsigned long  type) [static]

Definition at line 1346 of file readelf.c.

{
  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;
    }
}

Here is the caller graph for this function:

static const char* get_mips_section_type_name ( unsigned int  sh_type) [static]

Definition at line 2528 of file readelf.c.

{
  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;
}

Here is the caller graph for this function:

static const char* get_mips_segment_type ( unsigned long  type) [static]

Definition at line 2381 of file readelf.c.

{
  switch (type)
    {
    case PT_MIPS_REGINFO:
      return "REGINFO";
    case PT_MIPS_RTPROC:
      return "RTPROC";
    case PT_MIPS_OPTIONS:
      return "OPTIONS";
    default:
      break;
    }

  return NULL;
}

Here is the caller graph for this function:

static const char* get_mips_symbol_other ( unsigned int  other) [static]

Definition at line 6922 of file readelf.c.

{
  switch (other)
    {
    case STO_OPTIONAL:  return "OPTIONAL";
    case STO_MIPS16:    return "MIPS16";
    default:         return NULL;
    }
}

Here is the caller graph for this function:

static const char* get_netbsd_elfcore_note_type ( unsigned  e_type) [static]

Definition at line 8942 of file readelf.c.

{
  static char buff[64];

  if (e_type == NT_NETBSDCORE_PROCINFO)
    {
      /* NetBSD core "procinfo" structure.  */
      return _("NetBSD procinfo structure");
    }

  /* As of Jan 2002 there are no other machine-independent notes
     defined for NetBSD core files.  If the note type is less
     than the start of the machine-dependent note types, we don't
     understand it.  */

  if (e_type < NT_NETBSDCORE_FIRSTMACH)
    {
      snprintf (buff, sizeof (buff), _("Unknown note type: (0x%08x)"), e_type);
      return buff;
    }

  switch (elf_header.e_machine)
    {
    /* On the Alpha, SPARC (32-bit and 64-bit), PT_GETREGS == mach+0
       and PT_GETFPREGS == mach+2.  */

    case EM_OLD_ALPHA:
    case EM_ALPHA:
    case EM_SPARC:
    case EM_SPARC32PLUS:
    case EM_SPARCV9:
      switch (e_type)
       {
       case NT_NETBSDCORE_FIRSTMACH+0:
         return _("PT_GETREGS (reg structure)");
       case NT_NETBSDCORE_FIRSTMACH+2:
         return _("PT_GETFPREGS (fpreg structure)");
       default:
         break;
       }
      break;

    /* On all other arch's, PT_GETREGS == mach+1 and
       PT_GETFPREGS == mach+3.  */
    default:
      switch (e_type)
       {
       case NT_NETBSDCORE_FIRSTMACH+1:
         return _("PT_GETREGS (reg structure)");
       case NT_NETBSDCORE_FIRSTMACH+3:
         return _("PT_GETFPREGS (fpreg structure)");
       default:
         break;
       }
    }

  snprintf (buff, sizeof (buff), _("PT_FIRSTMACH+%d"),
           e_type - NT_NETBSDCORE_FIRSTMACH);
  return buff;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_note_type ( unsigned  e_type) [static]

Definition at line 8892 of file readelf.c.

{
  static char buff[64];

  if (elf_header.e_type == ET_CORE)
    switch (e_type)
      {
      case NT_AUXV:
       return _("NT_AUXV (auxiliary vector)");
      case NT_PRSTATUS:
       return _("NT_PRSTATUS (prstatus structure)");
      case NT_FPREGSET:
       return _("NT_FPREGSET (floating point registers)");
      case NT_PRPSINFO:
       return _("NT_PRPSINFO (prpsinfo structure)");
      case NT_TASKSTRUCT:
       return _("NT_TASKSTRUCT (task structure)");
      case NT_PRXFPREG:
       return _("NT_PRXFPREG (user_xfpregs structure)");
      case NT_PSTATUS:
       return _("NT_PSTATUS (pstatus structure)");
      case NT_FPREGS:
       return _("NT_FPREGS (floating point registers)");
      case NT_PSINFO:
       return _("NT_PSINFO (psinfo structure)");
      case NT_LWPSTATUS:
       return _("NT_LWPSTATUS (lwpstatus_t structure)");
      case NT_LWPSINFO:
       return _("NT_LWPSINFO (lwpsinfo_t structure)");
      case NT_WIN32PSTATUS:
       return _("NT_WIN32PSTATUS (win32_pstatus structure)");
      default:
       break;
      }
  else
    switch (e_type)
      {
      case NT_VERSION:
       return _("NT_VERSION (version)");
      case NT_ARCH:
       return _("NT_ARCH (architecture)");
      default:
       break;
      }

  snprintf (buff, sizeof (buff), _("Unknown note type: (0x%08x)"), e_type);
  return buff;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_osabi_name ( unsigned int  osabi) [static]

Definition at line 2337 of file readelf.c.

{
  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_AIX:             return "UNIX - AIX";
    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_OPENVMS:  return "VMS - OpenVMS";
    case ELFOSABI_NSK:             return "HP - Non-Stop Kernel";
    case ELFOSABI_AROS:            return "Amiga Research OS";
    case ELFOSABI_STANDALONE:      return _("Standalone App");
    case ELFOSABI_ARM:             return "ARM";
    default:
      snprintf (buff, sizeof (buff), _("<unknown: %x>"), osabi);
      return buff;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_parisc_dynamic_type ( unsigned long  type) [static]

Definition at line 1434 of file readelf.c.

{
  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";
    case DT_HP_EPLTREL:            return "HP_GST_EPLTREL";
    case DT_HP_EPLTRELSZ:   return "HP_GST_EPLTRELSZ";
    case DT_HP_FILTERED:    return "HP_FILTERED";
    case DT_HP_FILTER_TLS:  return "HP_FILTER_TLS";
    case DT_HP_COMPAT_FILTERED:    return "HP_COMPAT_FILTERED";
    case DT_HP_LAZYLOAD:    return "HP_LAZYLOAD";
    case DT_HP_BIND_NOW_COUNT:     return "HP_BIND_NOW_COUNT";
    case DT_PLT:            return "PLT";
    case DT_PLT_SIZE:              return "PLT_SIZE";
    case DT_DLT:            return "DLT";
    case DT_DLT_SIZE:              return "DLT_SIZE";
    default:
      return NULL;
    }
}

Here is the caller graph for this function:

static const char* get_parisc_section_type_name ( unsigned int  sh_type) [static]

Definition at line 2578 of file readelf.c.

{
  switch (sh_type)
    {
    case SHT_PARISC_EXT:    return "PARISC_EXT";
    case SHT_PARISC_UNWIND: return "PARISC_UNWIND";
    case SHT_PARISC_DOC:    return "PARISC_DOC";
    case SHT_PARISC_ANNOT:  return "PARISC_ANNOT";
    case SHT_PARISC_SYMEXTN:       return "PARISC_SYMEXTN";
    case SHT_PARISC_STUBS:  return "PARISC_STUBS";
    case SHT_PARISC_DLKM:   return "PARISC_DLKM";
    default:
      break;
    }
  return NULL;
}

Here is the caller graph for this function:

static const char* get_parisc_segment_type ( unsigned long  type) [static]

Definition at line 2399 of file readelf.c.

{
  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_HP_OPT_ANNOT:   return "HP_OPT_ANNOT";
    case PT_HP_HSL_ANNOT:   return "HP_HSL_ANNOT";
    case PT_HP_STACK:              return "HP_STACK";
    case PT_HP_CORE_UTSNAME:       return "HP_CORE_UTSNAME";
    case PT_PARISC_ARCHEXT: return "PARISC_ARCHEXT";
    case PT_PARISC_UNWIND:  return "PARISC_UNWIND";
    case PT_PARISC_WEAKORDER:      return "PARISC_WEAKORDER";
    default:
      break;
    }

  return NULL;
}

Here is the caller graph for this function:

static const char* get_ppc64_dynamic_type ( unsigned long  type) [static]

Definition at line 1421 of file readelf.c.

{
  switch (type)
    {
    case DT_PPC64_GLINK: return "PPC64_GLINK";
    case DT_PPC64_OPD:   return "PPC64_OPD";
    case DT_PPC64_OPDSZ: return "PPC64_OPDSZ";
    default:
      return NULL;
    }
}

Here is the caller graph for this function:

static const char* get_ppc_dynamic_type ( unsigned long  type) [static]

Definition at line 1410 of file readelf.c.

{
  switch (type)
    {
    case DT_PPC_GOT: return "PPC_GOT";
    default:
      return NULL;
    }
}

Here is the caller graph for this function:

static int get_program_headers ( FILE *  file) [static]

Definition at line 3336 of file readelf.c.

{
  Elf_Internal_Phdr *phdrs;

  /* Check cache of prior read.  */
  if (program_headers != NULL)
    return 1;

  phdrs = cmalloc (elf_header.e_phnum, sizeof (Elf_Internal_Phdr));

  if (phdrs == NULL)
    {
      error (_("Out of memory\n"));
      return 0;
    }

  if (is_32bit_elf
      ? get_32bit_program_headers (file, phdrs)
      : get_64bit_program_headers (file, phdrs))
    {
      program_headers = phdrs;
      return 1;
    }

  free (phdrs);
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static unsigned int get_reloc_size ( Elf_Internal_Rela reloc) [static]

Definition at line 7766 of file readelf.c.

{
  switch (elf_header.e_machine)
    {
    case EM_H8S:
    case EM_H8_300:
    case EM_H8_300H:
    case EM_H8_500:
      switch (ELF32_R_TYPE (reloc->r_info))
       {
         /* PR gas/3800 - without this information we do not correctly
            decode the debug information generated by the h8300 assembler.  */
       case R_H8_DIR16:
         return 2;
       default:
         return 4;
       }
    default:
      /* FIXME: We need to extend this switch statement to cope with other
        architecture's relocs.  (When those relocs are used against debug
        sections, and when their size is not 4).  But see the multiple
        inclusions of <elf/h8.h> for an example of the hoops that we need
        to jump through in order to obtain the reloc numbers.  */
      return 4;
    }
}

Here is the caller graph for this function:

static const char* get_score_dynamic_type ( unsigned long  type) [static]

Definition at line 1490 of file readelf.c.

{
  switch (type)
    {
    case DT_SCORE_BASE_ADDRESS: return "SCORE_BASE_ADDRESS";
    case DT_SCORE_LOCAL_GOTNO:  return "SCORE_LOCAL_GOTNO";
    case DT_SCORE_SYMTABNO:     return "SCORE_SYMTABNO";
    case DT_SCORE_GOTSYM:       return "SCORE_GOTSYM";
    case DT_SCORE_UNREFEXTNO:   return "SCORE_UNREFEXTNO";
    case DT_SCORE_HIPAGENO:     return "SCORE_HIPAGENO";
    default:
      return NULL;
    }
}

Here is the caller graph for this function:

static const char* get_section_type_name ( unsigned int  sh_type) [static]

Definition at line 2643 of file readelf.c.

{
  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_HASH:             return "GNU_HASH";
    case SHT_GROUP:         return "GROUP";
    case SHT_SYMTAB_SHNDX:  return "SYMTAB SECTION INDICIES";
    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";
    case SHT_GNU_LIBLIST:   return "GNU_LIBLIST";

    default:
      if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC))
       {
         const char *result;

         switch (elf_header.e_machine)
           {
           case EM_MIPS:
           case EM_MIPS_RS3_LE:
             result = get_mips_section_type_name (sh_type);
             break;
           case EM_PARISC:
             result = get_parisc_section_type_name (sh_type);
             break;
           case EM_IA_64:
             result = get_ia64_section_type_name (sh_type);
             break;
           case EM_X86_64:
             result = get_x86_64_section_type_name (sh_type);
             break;
           case EM_ARM:
             result = get_arm_section_type_name (sh_type);
             break;
           default:
             result = NULL;
             break;
           }

         if (result != NULL)
           return result;

         sprintf (buff, "LOPROC+%x", sh_type - SHT_LOPROC);
       }
      else if ((sh_type >= SHT_LOOS) && (sh_type <= SHT_HIOS))
       sprintf (buff, "LOOS+%x", sh_type - SHT_LOOS);
      else if ((sh_type >= SHT_LOUSER) && (sh_type <= SHT_HIUSER))
       sprintf (buff, "LOUSER+%x", sh_type - SHT_LOUSER);
      else
       snprintf (buff, sizeof (buff), _("<unknown>: %x"), sh_type);

      return buff;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_segment_type ( unsigned long  p_type) [static]

Definition at line 2448 of file readelf.c.

{
  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";
    case PT_TLS:     return "TLS";

    case PT_GNU_EH_FRAME:
                     return "GNU_EH_FRAME";
    case PT_GNU_STACK:      return "GNU_STACK";
    case PT_GNU_RELRO:  return "GNU_RELRO";

    default:
      if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
       {
         const char *result;

         switch (elf_header.e_machine)
           {
           case EM_ARM:
             result = get_arm_segment_type (p_type);
             break;
           case EM_MIPS:
           case EM_MIPS_RS3_LE:
             result = get_mips_segment_type (p_type);
             break;
           case EM_PARISC:
             result = get_parisc_segment_type (p_type);
             break;
           case EM_IA_64:
             result = get_ia64_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;
           case EM_IA_64:
             result = get_ia64_segment_type (p_type);
             break;
           default:
             result = NULL;
             break;
           }

         if (result != NULL)
           return result;

         sprintf (buff, "LOOS+%lx", p_type - PT_LOOS);
       }
      else
       snprintf (buff, sizeof (buff), _("<unknown>: %lx"), p_type);

      return buff;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_sparc64_dynamic_type ( unsigned long  type) [static]

Definition at line 1399 of file readelf.c.

{
  switch (type)
    {
    case DT_SPARC_REGISTER: return "SPARC_REGISTER";
    default:
      return NULL;
    }
}

Here is the caller graph for this function:

static const char* get_symbol_binding ( unsigned int  binding) [static]

Definition at line 6839 of file readelf.c.

{
  static char buff[32];

  switch (binding)
    {
    case STB_LOCAL:  return "LOCAL";
    case STB_GLOBAL: return "GLOBAL";
    case STB_WEAK:   return "WEAK";
    default:
      if (binding >= STB_LOPROC && binding <= STB_HIPROC)
       snprintf (buff, sizeof (buff), _("<processor specific>: %d"),
                binding);
      else if (binding >= STB_LOOS && binding <= STB_HIOS)
       snprintf (buff, sizeof (buff), _("<OS specific>: %d"), binding);
      else
       snprintf (buff, sizeof (buff), _("<unknown>: %d"), binding);
      return buff;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_symbol_index_type ( unsigned int  type) [static]

Definition at line 6957 of file readelf.c.

{
  static char buff[32];

  switch (type)
    {
    case SHN_UNDEF:  return "UND";
    case SHN_ABS:    return "ABS";
    case SHN_COMMON: return "COM";
    default:
      if (type == SHN_IA_64_ANSI_COMMON
         && elf_header.e_machine == EM_IA_64
         && elf_header.e_ident[EI_OSABI] == ELFOSABI_HPUX)
       return "ANSI_COM";
      else if (elf_header.e_machine == EM_X86_64
              && type == SHN_X86_64_LCOMMON)
       return "LARGE_COM";
      else if (type == SHN_MIPS_SCOMMON
              && elf_header.e_machine == EM_MIPS)
       return "SCOM";
      else if (type == SHN_MIPS_SUNDEFINED
              && elf_header.e_machine == EM_MIPS)
       return "SUND";
      else if (type >= SHN_LOPROC && type <= SHN_HIPROC)
       sprintf (buff, "PRC[0x%04x]", type);
      else if (type >= SHN_LOOS && type <= SHN_HIOS)
       sprintf (buff, "OS [0x%04x]", type);
      else if (type >= SHN_LORESERVE && type <= SHN_HIRESERVE)
       sprintf (buff, "RSV[0x%04x]", type);
      else
       sprintf (buff, "%3d", type);
      break;
    }

  return buff;
}

Here is the caller graph for this function:

static const char* get_symbol_other ( unsigned int  other) [static]

Definition at line 6933 of file readelf.c.

{
  const char * result = NULL;
  static char buff [32];

  if (other == 0)
    return "";

  switch (elf_header.e_machine)
    {
    case EM_MIPS:
      result = get_mips_symbol_other (other);
    default:
      break;
    }

  if (result)
    return result;

  snprintf (buff, sizeof buff, _("<other>: %x"), other);
  return buff;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_symbol_type ( unsigned int  type) [static]

Definition at line 6861 of file readelf.c.

{
  static char buff[32];

  switch (type)
    {
    case STT_NOTYPE: return "NOTYPE";
    case STT_OBJECT: return "OBJECT";
    case STT_FUNC:   return "FUNC";
    case STT_SECTION:       return "SECTION";
    case STT_FILE:   return "FILE";
    case STT_COMMON: return "COMMON";
    case STT_TLS:    return "TLS";
    case STT_RELC:      return "RELC";
    case STT_SRELC:     return "SRELC";
    default:
      if (type >= STT_LOPROC && type <= STT_HIPROC)
       {
         if (elf_header.e_machine == EM_ARM && type == STT_ARM_TFUNC)
           return "THUMB_FUNC";

         if (elf_header.e_machine == EM_SPARCV9 && type == STT_REGISTER)
           return "REGISTER";

         if (elf_header.e_machine == EM_PARISC && type == STT_PARISC_MILLI)
           return "PARISC_MILLI";

         snprintf (buff, sizeof (buff), _("<processor specific>: %d"), type);
       }
      else if (type >= STT_LOOS && type <= STT_HIOS)
       {
         if (elf_header.e_machine == EM_PARISC)
           {
             if (type == STT_HP_OPAQUE)
              return "HP_OPAQUE";
             if (type == STT_HP_STUB)
              return "HP_STUB";
           }

         snprintf (buff, sizeof (buff), _("<OS specific>: %d"), type);
       }
      else
       snprintf (buff, sizeof (buff), _("<unknown>: %d"), type);
      return buff;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* get_symbol_visibility ( unsigned int  visibility) [static]

Definition at line 6909 of file readelf.c.

{
  switch (visibility)
    {
    case STV_DEFAULT:       return "DEFAULT";
    case STV_INTERNAL:      return "INTERNAL";
    case STV_HIDDEN: return "HIDDEN";
    case STV_PROTECTED: return "PROTECTED";
    default: abort ();
    }
}

Here is the caller graph for this function:

static char* get_ver_flags ( unsigned int  flags) [static]

Definition at line 6389 of file readelf.c.

{
  static char buff[32];

  buff[0] = 0;

  if (flags == 0)
    return _("none");

  if (flags & VER_FLG_BASE)
    strcat (buff, "BASE ");

  if (flags & VER_FLG_WEAK)
    {
      if (flags & VER_FLG_BASE)
       strcat (buff, "| ");

      strcat (buff, "WEAK ");
    }

  if (flags & ~(VER_FLG_BASE | VER_FLG_WEAK))
    strcat (buff, "| <unknown>");

  return buff;
}

Here is the caller graph for this function:

static const char* get_x86_64_section_type_name ( unsigned int  sh_type) [static]

Definition at line 2614 of file readelf.c.

{
  switch (sh_type)
    {
    case SHT_X86_64_UNWIND: return "X86_64_UNWIND";
    default:
      break;
    }
  return NULL;
}

Here is the caller graph for this function:

static int guess_is_rela ( unsigned long  e_machine) [static]

Definition at line 592 of file readelf.c.

{
  switch (e_machine)
    {
      /* Targets that use REL relocations.  */
    case EM_386:
    case EM_486:
    case EM_960:
    case EM_ARM:
    case EM_D10V:
    case EM_CYGNUS_D10V:
    case EM_DLX:
    case EM_MIPS:
    case EM_MIPS_RS3_LE:
    case EM_CYGNUS_M32R:
    case EM_OPENRISC:
    case EM_OR32:
    case EM_SCORE:
      return FALSE;

      /* Targets that use RELA relocations.  */
    case EM_68K:
    case EM_860:
    case EM_ALPHA:
    case EM_ALTERA_NIOS2:
    case EM_AVR:
    case EM_AVR_OLD:
    case EM_BLACKFIN:
    case EM_CRIS:
    case EM_CRX:
    case EM_D30V:
    case EM_CYGNUS_D30V:
    case EM_FR30:
    case EM_CYGNUS_FR30:
    case EM_CYGNUS_FRV:
    case EM_H8S:
    case EM_H8_300:
    case EM_H8_300H:
    case EM_IA_64:
    case EM_IP2K:
    case EM_IP2K_OLD:
    case EM_IQ2000:
    case EM_M32C:
    case EM_M32R:
    case EM_MCORE:
    case EM_CYGNUS_MEP:
    case EM_MMIX:
    case EM_MN10200:
    case EM_CYGNUS_MN10200:
    case EM_MN10300:
    case EM_CYGNUS_MN10300:
    case EM_MSP430:
    case EM_MSP430_OLD:
    case EM_MT:
    case EM_NIOS32:
    case EM_PPC64:
    case EM_PPC:
    case EM_S390:
    case EM_S390_OLD:
    case EM_SH:
    case EM_SPARC:
    case EM_SPARC32PLUS:
    case EM_SPARCV9:
    case EM_SPU:
    case EM_V850:
    case EM_CYGNUS_V850:
    case EM_VAX:
    case EM_X86_64:
    case EM_XSTORMY16:
    case EM_XTENSA:
    case EM_XTENSA_OLD:
      return TRUE;

    case EM_68HC05:
    case EM_68HC08:
    case EM_68HC11:
    case EM_68HC16:
    case EM_FX66:
    case EM_ME16:
    case EM_MMA:
    case EM_NCPU:
    case EM_NDR1:
    case EM_PCP:
    case EM_ST100:
    case EM_ST19:
    case EM_ST7:
    case EM_ST9PLUS:
    case EM_STARCORE:
    case EM_SVX:
    case EM_TINYJ:
    default:
      warn (_("Don't know about relocations on this machine architecture\n"));
      return FALSE;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int hppa_process_unwind ( FILE *  file) [static]

Definition at line 5462 of file readelf.c.

{
  struct hppa_unw_aux_info aux;
  Elf_Internal_Shdr *unwsec = NULL;
  Elf_Internal_Shdr *strsec;
  Elf_Internal_Shdr *sec;
  unsigned long i;

  memset (& aux, 0, sizeof (aux));

  if (string_table == NULL)
    return 1;

  for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec)
    {
      if (sec->sh_type == SHT_SYMTAB
         && SECTION_HEADER_INDEX (sec->sh_link) < elf_header.e_shnum)
       {
         aux.nsyms = sec->sh_size / sec->sh_entsize;
         aux.symtab = GET_ELF_SYMBOLS (file, sec);

         strsec = SECTION_HEADER (sec->sh_link);
         aux.strtab = get_data (NULL, file, strsec->sh_offset,
                             1, strsec->sh_size, _("string table"));
         aux.strtab_size = aux.strtab != NULL ? strsec->sh_size : 0;
       }
      else if (streq (SECTION_NAME (sec), ".PARISC.unwind"))
       unwsec = sec;
    }

  if (!unwsec)
    printf (_("\nThere are no unwind sections in this file.\n"));

  for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec)
    {
      if (streq (SECTION_NAME (sec), ".PARISC.unwind"))
       {
         printf (_("\nUnwind section "));
         printf (_("'%s'"), SECTION_NAME (sec));

         printf (_(" at offset 0x%lx contains %lu entries:\n"),
                (unsigned long) sec->sh_offset,
                (unsigned long) (sec->sh_size / (2 * eh_addr_size + 8)));

          slurp_hppa_unwind_table (file, &aux, sec);
         if (aux.table_len > 0)
           dump_hppa_unwind (&aux);

         if (aux.table)
           free ((char *) aux.table);
         aux.table = NULL;
       }
    }

  if (aux.symtab)
    free (aux.symtab);
  if (aux.strtab)
    free ((char *) aux.strtab);

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int ia64_process_unwind ( FILE *  file) [static]

Definition at line 5052 of file readelf.c.

{
  Elf_Internal_Shdr *sec, *unwsec = NULL, *strsec;
  unsigned long i, unwcount = 0, unwstart = 0;
  struct ia64_unw_aux_info aux;

  memset (& aux, 0, sizeof (aux));

  for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec)
    {
      if (sec->sh_type == SHT_SYMTAB
         && SECTION_HEADER_INDEX (sec->sh_link) < elf_header.e_shnum)
       {
         aux.nsyms = sec->sh_size / sec->sh_entsize;
         aux.symtab = GET_ELF_SYMBOLS (file, sec);

         strsec = SECTION_HEADER (sec->sh_link);
         aux.strtab = get_data (NULL, file, strsec->sh_offset,
                             1, strsec->sh_size, _("string table"));
         aux.strtab_size = aux.strtab != NULL ? strsec->sh_size : 0;
       }
      else if (sec->sh_type == SHT_IA_64_UNWIND)
       unwcount++;
    }

  if (!unwcount)
    printf (_("\nThere are no unwind sections in this file.\n"));

  while (unwcount-- > 0)
    {
      char *suffix;
      size_t len, len2;

      for (i = unwstart, sec = section_headers + unwstart;
          i < elf_header.e_shnum; ++i, ++sec)
       if (sec->sh_type == SHT_IA_64_UNWIND)
         {
           unwsec = sec;
           break;
         }

      unwstart = i + 1;
      len = sizeof (ELF_STRING_ia64_unwind_once) - 1;

      if ((unwsec->sh_flags & SHF_GROUP) != 0)
       {
         /* We need to find which section group it is in.  */
         struct group_list *g = section_headers_groups [i]->root;

         for (; g != NULL; g = g->next)
           {
             sec = SECTION_HEADER (g->section_index);

             if (streq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info))
              break;
           }

         if (g == NULL)
           i = elf_header.e_shnum;
       }
      else if (strneq (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind_once, len))
       {
         /* .gnu.linkonce.ia64unw.FOO -> .gnu.linkonce.ia64unwi.FOO.  */
         len2 = sizeof (ELF_STRING_ia64_unwind_info_once) - 1;
         suffix = SECTION_NAME (unwsec) + len;
         for (i = 0, sec = section_headers; i < elf_header.e_shnum;
              ++i, ++sec)
           if (strneq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info_once, len2)
              && streq (SECTION_NAME (sec) + len2, suffix))
             break;
       }
      else
       {
         /* .IA_64.unwindFOO -> .IA_64.unwind_infoFOO
            .IA_64.unwind or BAR -> .IA_64.unwind_info.  */
         len = sizeof (ELF_STRING_ia64_unwind) - 1;
         len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1;
         suffix = "";
         if (strneq (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind, len))
           suffix = SECTION_NAME (unwsec) + len;
         for (i = 0, sec = section_headers; i < elf_header.e_shnum;
              ++i, ++sec)
           if (strneq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info, len2)
              && streq (SECTION_NAME (sec) + len2, suffix))
             break;
       }

      if (i == elf_header.e_shnum)
       {
         printf (_("\nCould not find unwind info section for "));

         if (string_table == NULL)
           printf ("%d", unwsec->sh_name);
         else
           printf (_("'%s'"), SECTION_NAME (unwsec));
       }
      else
       {
         aux.info_size = sec->sh_size;
         aux.info_addr = sec->sh_addr;
         aux.info = get_data (NULL, file, sec->sh_offset, 1, aux.info_size,
                            _("unwind info"));

         printf (_("\nUnwind section "));

         if (string_table == NULL)
           printf ("%d", unwsec->sh_name);
         else
           printf (_("'%s'"), SECTION_NAME (unwsec));

         printf (_(" at offset 0x%lx contains %lu entries:\n"),
                (unsigned long) unwsec->sh_offset,
                (unsigned long) (unwsec->sh_size / (3 * eh_addr_size)));

         (void) slurp_ia64_unwind_table (file, & aux, unwsec);

         if (aux.table_len > 0)
           dump_ia64_unwind (& aux);

         if (aux.table)
           free ((char *) aux.table);
         if (aux.info)
           free ((char *) aux.info);
         aux.table = NULL;
         aux.info = NULL;
       }
    }

  if (aux.symtab)
    free (aux.symtab);
  if (aux.strtab)
    free ((char *) aux.strtab);

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void initialise_dumps_byname ( void  ) [static]

Definition at line 8006 of file readelf.c.

{
  struct dump_list_entry *cur;

  for (cur = dump_sects_byname; cur; cur = cur->next)
    {
      unsigned int i;
      int any;

      for (i = 0, any = 0; i < elf_header.e_shnum; i++)
       if (streq (SECTION_NAME (section_headers + i), cur->name))
         {
           request_dump (i, cur->type);
           any = 1;
         }

      if (!any)
       warn (_("Section '%s' was not dumped because it does not exist!\n"),
             cur->name);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int load_debug_section ( enum dwarf_section_display_enum  debug,
void *  file 
)

Definition at line 7917 of file readelf.c.

{
  struct dwarf_section *section = &debug_displays [debug].section;
  Elf_Internal_Shdr *sec;
  char buf [64];

  /* If it is already loaded, do nothing.  */
  if (section->start != NULL)
    return 1;

  /* Locate the debug section.  */
  sec = find_section (section->name);
  if (sec == NULL)
    return 0;

  snprintf (buf, sizeof (buf), _("%s section data"), section->name);
  section->address = sec->sh_addr;
  section->size = sec->sh_size;
  section->start = get_data (NULL, file, sec->sh_offset, 1,
                          sec->sh_size, buf);

  if (debug_displays [debug].relocate)
    debug_apply_rela_addends (file, sec, section->start);

  return section->start != NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 9684 of file readelf.c.

{
  int err;

#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
  setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
  setlocale (LC_CTYPE, "");
#endif
  bindtextdomain (PACKAGE, LOCALEDIR);
  textdomain (PACKAGE);

  expandargv (&argc, &argv);

  parse_args (argc, argv);

  if (num_dump_sects > 0)
    {
      /* Make a copy of the dump_sects array.  */
      cmdline_dump_sects = malloc (num_dump_sects);
      if (cmdline_dump_sects == NULL)
       error (_("Out of memory allocating dump request table.\n"));
      else
       {
         memcpy (cmdline_dump_sects, dump_sects, num_dump_sects);
         num_cmdline_dump_sects = num_dump_sects;
       }
    }

  if (optind < (argc - 1))
    show_name = 1;

  err = 0;
  while (optind < argc)
    err |= process_file (argv[optind++]);

  if (dump_sects != NULL)
    free (dump_sects);
  if (cmdline_dump_sects != NULL)
    free (cmdline_dump_sects);

  return err;
}

Here is the call graph for this function:

static long offset_from_vma ( FILE *  file,
bfd_vma  vma,
bfd_size_type  size 
) [static]

Definition at line 3596 of file readelf.c.

{
  Elf_Internal_Phdr *seg;

  if (! get_program_headers (file))
    {
      warn (_("Cannot interpret virtual addresses without program headers.\n"));
      return (long) vma;
    }

  for (seg = program_headers;
       seg < program_headers + elf_header.e_phnum;
       ++seg)
    {
      if (seg->p_type != PT_LOAD)
       continue;

      if (vma >= (seg->p_vaddr & -seg->p_align)
         && vma + size <= seg->p_vaddr + seg->p_filesz)
       return vma - seg->p_vaddr + seg->p_offset;
    }

  warn (_("Virtual address 0x%lx not located in any PT_LOAD segment.\n"),
       (long) vma);
  return (long) vma;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void parse_args ( int  argc,
char **  argv 
) [static]

Definition at line 2858 of file readelf.c.

{
  int c;

  if (argc < 2)
    usage (stderr);

  while ((c = getopt_long
         (argc, argv, "ersuahnldSDAINtgw::x:i:vVWH", options, NULL)) != EOF)
    {
      char *cp;
      int section;

      switch (c)
       {
       case 0:
         /* Long options.  */
         break;
       case 'H':
         usage (stdout);
         break;

       case 'a':
         do_syms++;
         do_reloc++;
         do_unwind++;
         do_dynamic++;
         do_header++;
         do_sections++;
         do_section_groups++;
         do_segments++;
         do_version++;
         do_histogram++;
         do_arch++;
         do_notes++;
         break;
       case 'g':
         do_section_groups++;
         break;
       case 't':
       case 'N':
         do_sections++;
         do_section_details++;
         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 'u':
         do_unwind++;
         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);
         else
           request_dump_byname (optarg, HEX_DUMP);
         break;
       case 'w':
         do_dump++;
         if (optarg == 0)
           do_debugging = 1;
         else
           {
             unsigned int index = 0;

             do_debugging = 0;

             while (optarg[index])
              switch (optarg[index++])
                {
                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':
                  do_debug_aranges = 1;
                  break;

                case 'R':
                  do_debug_ranges = 1;
                  break;

                case 'F':
                  do_debug_frames_interp = 1;
                case 'f':
                  do_debug_frames = 1;
                  break;

                case 'm':
                case 'M':
                  do_debug_macinfo = 1;
                  break;

                case 's':
                case 'S':
                  do_debug_str = 1;
                  break;

                case 'o':
                case 'O':
                  do_debug_loc = 1;
                  break;

                default:
                  warn (_("Unrecognized debug option '%s'\n"), optarg);
                  break;
                }
           }
         break;
       case OPTION_DEBUG_DUMP:
         do_dump++;
         if (optarg == 0)
           do_debugging = 1;
         else
           {
             typedef struct
             {
              const char * option;
              int *        variable;
             }
             debug_dump_long_opts;

             debug_dump_long_opts opts_table [] =
              {
                /* Please keep this table alpha- sorted.  */
                { "Ranges", & do_debug_ranges },
                { "abbrev", & do_debug_abbrevs },
                { "aranges", & do_debug_aranges },
                { "frames", & do_debug_frames },
                { "frames-interp", & do_debug_frames_interp },
                { "info", & do_debug_info },
                { "line", & do_debug_lines },
                { "loc",  & do_debug_loc },
                { "macro", & do_debug_macinfo },
                { "pubnames", & do_debug_pubnames },
                /* This entry is for compatability
                   with earlier versions of readelf.  */
                { "ranges", & do_debug_aranges },
                { "str", & do_debug_str },
                { NULL, NULL }
              };

             const char *p;

             do_debugging = 0;

             p = optarg;
             while (*p)
              {
                debug_dump_long_opts * entry;

                for (entry = opts_table; entry->option; entry++)
                  {
                    size_t len = strlen (entry->option);

                    if (strneq (p, entry->option, len)
                       && (p[len] == ',' || p[len] == '\0'))
                     {
                       * entry->variable = 1;

                       /* The --debug-dump=frames-interp option also
                          enables the --debug-dump=frames option.  */
                       if (do_debug_frames_interp)
                         do_debug_frames = 1;

                       p += len;
                       break;
                     }
                  }

                if (entry->option == NULL)
                  {
                    warn (_("Unrecognized debug option '%s'\n"), p);
                    p = strchr (p, ',');
                    if (p == NULL)
                     break;
                  }

                if (*p == ',')
                  p++;
              }
           }
         break;
#ifdef SUPPORT_DISASSEMBLY
       case 'i':
         do_dump++;
         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;
       case 'W':
         do_wide++;
         break;
       default:
#ifdef SUPPORT_DISASSEMBLY
       oops:
#endif
         /* xgettext:c-format */
         error (_("Invalid option '-%c'\n"), c);
         /* Drop through.  */
       case '?':
         usage (stderr);
       }
    }

  if (!do_dynamic && !do_syms && !do_reloc && !do_unwind && !do_sections
      && !do_segments && !do_header && !do_dump && !do_version
      && !do_histogram && !do_debugging && !do_arch && !do_notes
      && !do_section_groups)
    usage (stderr);
  else if (argc < 3)
    {
      warn (_("Nothing to do.\n"));
      usage (stderr);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void print_dynamic_flags ( bfd_vma  flags) [static]

Definition at line 5791 of file readelf.c.

{
  int first = 1;

  while (flags)
    {
      bfd_vma flag;

      flag = flags & - flags;
      flags &= ~ flag;

      if (first)
       first = 0;
      else
       putc (' ', stdout);

      switch (flag)
       {
       case DF_ORIGIN:             fputs ("ORIGIN", stdout); break;
       case DF_SYMBOLIC:    fputs ("SYMBOLIC", stdout); break;
       case DF_TEXTREL:     fputs ("TEXTREL", stdout); break;
       case DF_BIND_NOW:    fputs ("BIND_NOW", stdout); break;
       case DF_STATIC_TLS:  fputs ("STATIC_TLS", stdout); break;
       default:             fputs ("unknown", stdout); break;
       }
    }
  puts ("");
}

Here is the caller graph for this function:

static void print_symbol ( int  width,
const char *  symbol 
) [static]

Definition at line 533 of file readelf.c.

{
  if (do_wide)
    printf ("%s", symbol);
  else if (width < 0)
    printf ("%-*.*s", width, width, symbol);
  else
    printf ("%-.*s", width, symbol);
}

Here is the call graph for this function:

static int print_vma ( bfd_vma  vma,
print_mode  mode 
) [static]

Definition at line 436 of file readelf.c.

{
#ifdef BFD64
  if (is_32bit_elf)
#endif
    {
      switch (mode)
       {
       case FULL_HEX:
         return printf ("0x%8.8lx", (unsigned long) vma);

       case LONG_HEX:
         return printf ("%8.8lx", (unsigned long) vma);

       case DEC_5:
         if (vma <= 99999)
           return printf ("%5ld", (long) vma);
         /* Drop through.  */

       case PREFIX_HEX:
         return printf ("0x%lx", (unsigned long) vma);

       case HEX:
         return printf ("%lx", (unsigned long) vma);

       case DEC:
         return printf ("%ld", (unsigned long) vma);

       case UNSIGNED:
         return printf ("%lu", (unsigned long) vma);
       }
    }
#ifdef BFD64
  else
    {
      int nc = 0;

      switch (mode)
       {
       case FULL_HEX:
         nc = printf ("0x");
         /* Drop through.  */

       case LONG_HEX:
         printf_vma (vma);
         return nc + 16;

       case PREFIX_HEX:
         nc = printf ("0x");
         /* Drop through.  */

       case HEX:
#if BFD_HOST_64BIT_LONG
         return nc + printf ("%lx", vma);
#else
         return nc + print_hex_vma (vma);
#endif

       case DEC:
#if BFD_HOST_64BIT_LONG
         return printf ("%ld", vma);
#else
         return print_dec_vma (vma, 1);
#endif

       case DEC_5:
#if BFD_HOST_64BIT_LONG
         if (vma <= 99999)
           return printf ("%5ld", vma);
         else
           return printf ("%#lx", vma);
#else
         if (vma <= 99999)
           return printf ("%5ld", _bfd_int64_low (vma));
         else
           return print_hex_vma (vma);
#endif

       case UNSIGNED:
#if BFD_HOST_64BIT_LONG
         return printf ("%lu", vma);
#else
         return print_dec_vma (vma, 0);
#endif
       }
    }
#endif
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int process_arch_specific ( FILE *  file) [static]

Definition at line 9176 of file readelf.c.

{
  if (! do_arch)
    return 1;

  switch (elf_header.e_machine)
    {
    case EM_ARM:
      return process_arm_specific (file);
    case EM_MIPS:
    case EM_MIPS_RS3_LE:
      return process_mips_specific (file);
      break;
    default:
      break;
    }
  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int process_archive ( char *  file_name,
FILE *  file 
) [static]

Definition at line 9444 of file readelf.c.

{
  struct ar_hdr arhdr;
  size_t got;
  unsigned long size;
  char *longnames = NULL;
  unsigned long longnames_size = 0;
  size_t file_name_size;
  int ret;

  show_name = 1;

  got = fread (&arhdr, 1, sizeof arhdr, file);
  if (got != sizeof arhdr)
    {
      if (got == 0)
       return 0;

      error (_("%s: failed to read archive header\n"), file_name);
      return 1;
    }

  if (const_strneq (arhdr.ar_name, "/               "))
    {
      /* This is the archive symbol table.  Skip it.
        FIXME: We should have an option to dump it.  */
      size = strtoul (arhdr.ar_size, NULL, 10);
      if (fseek (file, size + (size & 1), SEEK_CUR) != 0)
       {
         error (_("%s: failed to skip archive symbol table\n"), file_name);
         return 1;
       }

      got = fread (&arhdr, 1, sizeof arhdr, file);
      if (got != sizeof arhdr)
       {
         if (got == 0)
           return 0;

         error (_("%s: failed to read archive header\n"), file_name);
         return 1;
       }
    }

  if (const_strneq (arhdr.ar_name, "//              "))
    {
      /* This is the archive string table holding long member
        names.  */

      longnames_size = strtoul (arhdr.ar_size, NULL, 10);

      longnames = malloc (longnames_size);
      if (longnames == NULL)
       {
         error (_("Out of memory\n"));
         return 1;
       }

      if (fread (longnames, longnames_size, 1, file) != 1)
       {
         free (longnames);
         error (_("%s: failed to read string table\n"), file_name);
         return 1;
       }

      if ((longnames_size & 1) != 0)
       getc (file);

      got = fread (&arhdr, 1, sizeof arhdr, file);
      if (got != sizeof arhdr)
       {
         free (longnames);

         if (got == 0)
           return 0;

         error (_("%s: failed to read archive header\n"), file_name);
         return 1;
       }
    }

  file_name_size = strlen (file_name);
  ret = 0;

  while (1)
    {
      char *name;
      char *nameend;
      char *namealc;

      if (arhdr.ar_name[0] == '/')
       {
         unsigned long off;

         off = strtoul (arhdr.ar_name + 1, NULL, 10);
         if (off >= longnames_size)
           {
             error (_("%s: invalid archive string table offset %lu\n"), file_name, off);
             ret = 1;
             break;
           }

         name = longnames + off;
         nameend = memchr (name, '/', longnames_size - off);
       }
      else
       {
         name = arhdr.ar_name;
         nameend = memchr (name, '/', 16);
       }

      if (nameend == NULL)
       {
         error (_("%s: bad archive file name\n"), file_name);
         ret = 1;
         break;
       }

      namealc = malloc (file_name_size + (nameend - name) + 3);
      if (namealc == NULL)
       {
         error (_("Out of memory\n"));
         ret = 1;
         break;
       }

      memcpy (namealc, file_name, file_name_size);
      namealc[file_name_size] = '(';
      memcpy (namealc + file_name_size + 1, name, nameend - name);
      namealc[file_name_size + 1 + (nameend - name)] = ')';
      namealc[file_name_size + 2 + (nameend - name)] = '\0';

      archive_file_offset = ftell (file);
      archive_file_size = strtoul (arhdr.ar_size, NULL, 10);

      ret |= process_object (namealc, file);

      free (namealc);

      if (fseek (file,
               (archive_file_offset
                + archive_file_size
                + (archive_file_size & 1)),
               SEEK_SET) != 0)
       {
         error (_("%s: failed to seek to next archive header\n"), file_name);
         ret = 1;
         break;
       }

      got = fread (&arhdr, 1, sizeof arhdr, file);
      if (got != sizeof arhdr)
       {
         if (got == 0)
           break;

         error (_("%s: failed to read archive header\n"), file_name);
         ret = 1;
         break;
       }
    }

  if (longnames != 0)
    free (longnames);

  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int process_arm_specific ( FILE *  file) [static]

Definition at line 8298 of file readelf.c.

{
  Elf_Internal_Shdr *sect;
  unsigned char *contents;
  unsigned char *p;
  unsigned char *end;
  bfd_vma section_len;
  bfd_vma len;
  unsigned i;

  /* Find the section header so that we get the size.  */
  for (i = 0, sect = section_headers;
       i < elf_header.e_shnum;
       i++, sect++)
    {
      if (sect->sh_type != SHT_ARM_ATTRIBUTES)
       continue;

      contents = get_data (NULL, file, sect->sh_offset, 1, sect->sh_size,
                        _("attributes"));

      if (!contents)
       continue;
      p = contents;
      if (*p == 'A')
       {
         len = sect->sh_size - 1;
         p++;
         while (len > 0)
           {
             int namelen;
             bfd_boolean public_section;

             section_len = byte_get (p, 4);
             p += 4;
             if (section_len > len)
              {
                printf (_("ERROR: Bad section length (%d > %d)\n"),
                       (int)section_len, (int)len);
                section_len = len;
              }
             len -= section_len;
             printf ("Attribute Section: %s\n", p);
             if (strcmp ((char *)p, "aeabi") == 0)
              public_section = TRUE;
             else
              public_section = FALSE;
             namelen = strlen ((char *)p) + 1;
             p += namelen;
             section_len -= namelen + 4;
             while (section_len > 0)
              {
                int tag = *(p++);
                int val;
                bfd_vma size;
                size = byte_get (p, 4);
                if (size > section_len)
                  {
                    printf (_("ERROR: Bad subsection length (%d > %d)\n"),
                           (int)size, (int)section_len);
                    size = section_len;
                  }
                section_len -= size;
                end = p + size - 1;
                p += 4;
                switch (tag)
                  {
                  case 1:
                    printf ("File Attributes\n");
                    break;
                  case 2:
                    printf ("Section Attributes:");
                    goto do_numlist;
                  case 3:
                    printf ("Symbol Attributes:");
                  do_numlist:
                    for (;;)
                     {
                       unsigned int i;
                       val = read_uleb128 (p, &i);
                       p += i;
                       if (val == 0)
                         break;
                       printf (" %d", val);
                     }
                    printf ("\n");
                    break;
                  default:
                    printf ("Unknown tag: %d\n", tag);
                    public_section = FALSE;
                    break;
                  }
                if (public_section)
                  {
                    while (p < end)
                     p = display_arm_attribute(p);
                  }
                else
                  {
                    /* ??? Do something sensible, like dump hex.  */
                    printf ("  Unknown section contexts\n");
                    p = end;
                  }
              }
           }
       }
      else
       {
         printf (_("Unknown format '%c'\n"), *p);
       }

      free(contents);
    }
  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int process_corefile_note_segment ( FILE *  file,
bfd_vma  offset,
bfd_vma  length 
) [static]

Definition at line 9035 of file readelf.c.

{
  Elf_External_Note *pnotes;
  Elf_External_Note *external;
  int res = 1;

  if (length <= 0)
    return 0;

  pnotes = get_data (NULL, file, offset, 1, length, _("notes"));
  if (!pnotes)
    return 0;

  external = pnotes;

  printf (_("\nNotes at offset 0x%08lx with length 0x%08lx:\n"),
         (unsigned long) offset, (unsigned long) length);
  printf (_("  Owner\t\tData size\tDescription\n"));

  while (external < (Elf_External_Note *)((char *) pnotes + length))
    {
      Elf_External_Note *next;
      Elf_Internal_Note inote;
      char *temp = NULL;

      inote.type     = BYTE_GET (external->type);
      inote.namesz   = BYTE_GET (external->namesz);
      inote.namedata = external->name;
      inote.descsz   = BYTE_GET (external->descsz);
      inote.descdata = inote.namedata + align_power (inote.namesz, 2);
      inote.descpos  = offset + (inote.descdata - (char *) pnotes);

      next = (Elf_External_Note *)(inote.descdata + align_power (inote.descsz, 2));

      if (((char *) next) > (((char *) pnotes) + length))
       {
         warn (_("corrupt note found at offset %lx into core notes\n"),
              (long)((char *)external - (char *)pnotes));
         warn (_(" type: %lx, namesize: %08lx, descsize: %08lx\n"),
              inote.type, inote.namesz, inote.descsz);
         break;
       }

      external = next;

      /* Verify that name is null terminated.  It appears that at least
        one version of Linux (RedHat 6.0) generates corefiles that don't
        comply with the ELF spec by failing to include the null byte in
        namesz.  */
      if (inote.namedata[inote.namesz] != '\0')
       {
         temp = malloc (inote.namesz + 1);

         if (temp == NULL)
           {
             error (_("Out of memory\n"));
             res = 0;
             break;
           }

         strncpy (temp, inote.namedata, inote.namesz);
         temp[inote.namesz] = 0;

         /* warn (_("'%s' NOTE name not properly null terminated\n"), temp);  */
         inote.namedata = temp;
       }

      res &= process_note (& inote);

      if (temp != NULL)
       {
         free (temp);
         temp = NULL;
       }
    }

  free (pnotes);

  return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int process_corefile_note_segments ( FILE *  file) [static]

Definition at line 9117 of file readelf.c.

{
  Elf_Internal_Phdr *segment;
  unsigned int i;
  int res = 1;

  if (! get_program_headers (file))
      return 0;

  for (i = 0, segment = program_headers;
       i < elf_header.e_phnum;
       i++, segment++)
    {
      if (segment->p_type == PT_NOTE)
       res &= process_corefile_note_segment (file,
                                         (bfd_vma) segment->p_offset,
                                         (bfd_vma) segment->p_filesz);
    }

  return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int process_dynamic_section ( FILE *  file) [static]

Definition at line 5823 of file readelf.c.

{
  Elf_Internal_Dyn *entry;

  if (dynamic_size == 0)
    {
      if (do_dynamic)
       printf (_("\nThere is no dynamic section in this file.\n"));

      return 1;
    }

  if (is_32bit_elf)
    {
      if (! get_32bit_dynamic_section (file))
       return 0;
    }
  else if (! get_64bit_dynamic_section (file))
    return 0;

  /* Find the appropriate symbol table.  */
  if (dynamic_symbols == NULL)
    {
      for (entry = dynamic_section;
          entry < dynamic_section + dynamic_nent;
          ++entry)
       {
         Elf_Internal_Shdr section;

         if (entry->d_tag != DT_SYMTAB)
           continue;

         dynamic_info[DT_SYMTAB] = entry->d_un.d_val;

         /* Since we do not know how big the symbol table is,
            we default to reading in the entire file (!) and
            processing that.  This is overkill, I know, but it
            should work.  */
         section.sh_offset = offset_from_vma (file, entry->d_un.d_val, 0);

         if (archive_file_offset != 0)
           section.sh_size = archive_file_size - section.sh_offset;
         else
           {
             if (fseek (file, 0, SEEK_END))
              error (_("Unable to seek to end of file!\n"));

             section.sh_size = ftell (file) - section.sh_offset;
           }

         if (is_32bit_elf)
           section.sh_entsize = sizeof (Elf32_External_Sym);
         else
           section.sh_entsize = sizeof (Elf64_External_Sym);

         num_dynamic_syms = section.sh_size / section.sh_entsize;
         if (num_dynamic_syms < 1)
           {
             error (_("Unable to determine the number of symbols to load\n"));
             continue;
           }

         dynamic_symbols = GET_ELF_SYMBOLS (file, &section);
       }
    }

  /* Similarly find a string table.  */
  if (dynamic_strings == NULL)
    {
      for (entry = dynamic_section;
          entry < dynamic_section + dynamic_nent;
          ++entry)
       {
         unsigned long offset;
         long str_tab_len;

         if (entry->d_tag != DT_STRTAB)
           continue;

         dynamic_info[DT_STRTAB] = entry->d_un.d_val;

         /* Since we do not know how big the string table is,
            we default to reading in the entire file (!) and
            processing that.  This is overkill, I know, but it
            should work.  */

         offset = offset_from_vma (file, entry->d_un.d_val, 0);

         if (archive_file_offset != 0)
           str_tab_len = archive_file_size - offset;
         else
           {
             if (fseek (file, 0, SEEK_END))
              error (_("Unable to seek to end of file\n"));
             str_tab_len = ftell (file) - offset;
           }

         if (str_tab_len < 1)
           {
             error
              (_("Unable to determine the length of the dynamic string table\n"));
             continue;
           }

         dynamic_strings = get_data (NULL, file, offset, 1, str_tab_len,
                                  _("dynamic string table"));
         dynamic_strings_length = str_tab_len;
         break;
       }
    }

  /* And find the syminfo section if available.  */
  if (dynamic_syminfo == NULL)
    {
      unsigned long syminsz = 0;

      for (entry = dynamic_section;
          entry < dynamic_section + dynamic_nent;
          ++entry)
       {
         if (entry->d_tag == DT_SYMINENT)
           {
             /* Note: these braces are necessary to avoid a syntax
               error from the SunOS4 C compiler.  */
             assert (sizeof (Elf_External_Syminfo) == entry->d_un.d_val);
           }
         else if (entry->d_tag == DT_SYMINSZ)
           syminsz = entry->d_un.d_val;
         else if (entry->d_tag == DT_SYMINFO)
           dynamic_syminfo_offset = offset_from_vma (file, entry->d_un.d_val,
                                                syminsz);
       }

      if (dynamic_syminfo_offset != 0 && syminsz != 0)
       {
         Elf_External_Syminfo *extsyminfo, *extsym;
         Elf_Internal_Syminfo *syminfo;

         /* There is a syminfo section.  Read the data.  */
         extsyminfo = get_data (NULL, file, dynamic_syminfo_offset, 1,
                             syminsz, _("symbol information"));
         if (!extsyminfo)
           return 0;

         dynamic_syminfo = malloc (syminsz);
         if (dynamic_syminfo == NULL)
           {
             error (_("Out of memory\n"));
             return 0;
           }

         dynamic_syminfo_nent = syminsz / sizeof (Elf_External_Syminfo);
         for (syminfo = dynamic_syminfo, extsym = extsyminfo;
              syminfo < dynamic_syminfo + dynamic_syminfo_nent;
              ++syminfo, ++extsym)
           {
             syminfo->si_boundto = BYTE_GET (extsym->si_boundto);
             syminfo->si_flags = BYTE_GET (extsym->si_flags);
           }

         free (extsyminfo);
       }
    }

  if (do_dynamic && dynamic_addr)
    printf (_("\nDynamic section at offset 0x%lx contains %u entries:\n"),
           dynamic_addr, dynamic_nent);
  if (do_dynamic)
    printf (_("  Tag        Type                         Name/Value\n"));

  for (entry = dynamic_section;
       entry < dynamic_section + dynamic_nent;
       entry++)
    {
      if (do_dynamic)
       {
         const char *dtype;

         putchar (' ');
         print_vma (entry->d_tag, FULL_HEX);
         dtype = get_dynamic_type (entry->d_tag);
         printf (" (%s)%*s", dtype,
                ((is_32bit_elf ? 27 : 19)
                 - (int) strlen (dtype)),
                " ");
       }

      switch (entry->d_tag)
       {
       case DT_FLAGS:
         if (do_dynamic)
           print_dynamic_flags (entry->d_un.d_val);
         break;

       case DT_AUXILIARY:
       case DT_FILTER:
       case DT_CONFIG:
       case DT_DEPAUDIT:
       case DT_AUDIT:
         if (do_dynamic)
           {
             switch (entry->d_tag)
              {
              case DT_AUXILIARY:
                printf (_("Auxiliary library"));
                break;

              case DT_FILTER:
                printf (_("Filter library"));
                break;

              case DT_CONFIG:
                printf (_("Configuration file"));
                break;

              case DT_DEPAUDIT:
                printf (_("Dependency audit library"));
                break;

              case DT_AUDIT:
                printf (_("Audit library"));
                break;
              }

             if (VALID_DYNAMIC_NAME (entry->d_un.d_val))
              printf (": [%s]\n", GET_DYNAMIC_NAME (entry->d_un.d_val));
             else
              {
                printf (": ");
                print_vma (entry->d_un.d_val, PREFIX_HEX);
                putchar ('\n');
              }
           }
         break;

       case DT_FEATURE:
         if (do_dynamic)
           {
             printf (_("Flags:"));

             if (entry->d_un.d_val == 0)
              printf (_(" None\n"));
             else
              {
                unsigned long int val = entry->d_un.d_val;

                if (val & DTF_1_PARINIT)
                  {
                    printf (" PARINIT");
                    val ^= DTF_1_PARINIT;
                  }
                if (val & DTF_1_CONFEXP)
                  {
                    printf (" CONFEXP");
                    val ^= DTF_1_CONFEXP;
                  }
                if (val != 0)
                  printf (" %lx", val);
                puts ("");
              }
           }
         break;

       case DT_POSFLAG_1:
         if (do_dynamic)
           {
             printf (_("Flags:"));

             if (entry->d_un.d_val == 0)
              printf (_(" None\n"));
             else
              {
                unsigned long int val = entry->d_un.d_val;

                if (val & DF_P1_LAZYLOAD)
                  {
                    printf (" LAZYLOAD");
                    val ^= DF_P1_LAZYLOAD;
                  }
                if (val & DF_P1_GROUPPERM)
                  {
                    printf (" GROUPPERM");
                    val ^= DF_P1_GROUPPERM;
                  }
                if (val != 0)
                  printf (" %lx", val);
                puts ("");
              }
           }
         break;

       case DT_FLAGS_1:
         if (do_dynamic)
           {
             printf (_("Flags:"));
             if (entry->d_un.d_val == 0)
              printf (_(" None\n"));
             else
              {
                unsigned long int val = entry->d_un.d_val;

                if (val & DF_1_NOW)
                  {
                    printf (" NOW");
                    val ^= DF_1_NOW;
                  }
                if (val & DF_1_GLOBAL)
                  {
                    printf (" GLOBAL");
                    val ^= DF_1_GLOBAL;
                  }
                if (val & DF_1_GROUP)
                  {
                    printf (" GROUP");
                    val ^= DF_1_GROUP;
                  }
                if (val & DF_1_NODELETE)
                  {
                    printf (" NODELETE");
                    val ^= DF_1_NODELETE;
                  }
                if (val & DF_1_LOADFLTR)
                  {
                    printf (" LOADFLTR");
                    val ^= DF_1_LOADFLTR;
                  }
                if (val & DF_1_INITFIRST)
                  {
                    printf (" INITFIRST");
                    val ^= DF_1_INITFIRST;
                  }
                if (val & DF_1_NOOPEN)
                  {
                    printf (" NOOPEN");
                    val ^= DF_1_NOOPEN;
                  }
                if (val & DF_1_ORIGIN)
                  {
                    printf (" ORIGIN");
                    val ^= DF_1_ORIGIN;
                  }
                if (val & DF_1_DIRECT)
                  {
                    printf (" DIRECT");
                    val ^= DF_1_DIRECT;
                  }
                if (val & DF_1_TRANS)
                  {
                    printf (" TRANS");
                    val ^= DF_1_TRANS;
                  }
                if (val & DF_1_INTERPOSE)
                  {
                    printf (" INTERPOSE");
                    val ^= DF_1_INTERPOSE;
                  }
                if (val & DF_1_NODEFLIB)
                  {
                    printf (" NODEFLIB");
                    val ^= DF_1_NODEFLIB;
                  }
                if (val & DF_1_NODUMP)
                  {
                    printf (" NODUMP");
                    val ^= DF_1_NODUMP;
                  }
                if (val & DF_1_CONLFAT)
                  {
                    printf (" CONLFAT");
                    val ^= DF_1_CONLFAT;
                  }
                if (val != 0)
                  printf (" %lx", val);
                puts ("");
              }
           }
         break;

       case DT_PLTREL:
         dynamic_info[entry->d_tag] = entry->d_un.d_val;
         if (do_dynamic)
           puts (get_dynamic_type (entry->d_un.d_val));
         break;

       case DT_NULL  :
       case DT_NEEDED       :
       case DT_PLTGOT       :
       case DT_HASH  :
       case DT_STRTAB       :
       case DT_SYMTAB       :
       case DT_RELA  :
       case DT_INIT  :
       case DT_FINI  :
       case DT_SONAME       :
       case DT_RPATH :
       case DT_SYMBOLIC:
       case DT_REL   :
       case DT_DEBUG :
       case DT_TEXTREL      :
       case DT_JMPREL       :
       case DT_RUNPATH      :
         dynamic_info[entry->d_tag] = entry->d_un.d_val;

         if (do_dynamic)
           {
             char *name;

             if (VALID_DYNAMIC_NAME (entry->d_un.d_val))
              name = GET_DYNAMIC_NAME (entry->d_un.d_val);
             else
              name = NULL;

             if (name)
              {
                switch (entry->d_tag)
                  {
                  case DT_NEEDED:
                    printf (_("Shared library: [%s]"), name);

                    if (streq (name, program_interpreter))
                     printf (_(" program interpreter"));
                    break;

                  case DT_SONAME:
                    printf (_("Library soname: [%s]"), name);
                    break;

                  case DT_RPATH:
                    printf (_("Library rpath: [%s]"), name);
                    break;

                  case DT_RUNPATH:
                    printf (_("Library runpath: [%s]"), name);
                    break;

                  default:
                    print_vma (entry->d_un.d_val, PREFIX_HEX);
                    break;
                  }
              }
             else
              print_vma (entry->d_un.d_val, PREFIX_HEX);

             putchar ('\n');
           }
         break;

       case DT_PLTRELSZ:
       case DT_RELASZ       :
       case DT_STRSZ :
       case DT_RELSZ :
       case DT_RELAENT      :
       case DT_SYMENT       :
       case DT_RELENT       :
         dynamic_info[entry->d_tag] = entry->d_un.d_val;
       case DT_PLTPADSZ:
       case DT_MOVEENT      :
       case DT_MOVESZ       :
       case DT_INIT_ARRAYSZ:
       case DT_FINI_ARRAYSZ:
       case DT_GNU_CONFLICTSZ:
       case DT_GNU_LIBLISTSZ:
         if (do_dynamic)
           {
             print_vma (entry->d_un.d_val, UNSIGNED);
             printf (" (bytes)\n");
           }
         break;

       case DT_VERDEFNUM:
       case DT_VERNEEDNUM:
       case DT_RELACOUNT:
       case DT_RELCOUNT:
         if (do_dynamic)
           {
             print_vma (entry->d_un.d_val, UNSIGNED);
             putchar ('\n');
           }
         break;

       case DT_SYMINSZ:
       case DT_SYMINENT:
       case DT_SYMINFO:
       case DT_USED:
       case DT_INIT_ARRAY:
       case DT_FINI_ARRAY:
         if (do_dynamic)
           {
             if (entry->d_tag == DT_USED
                && VALID_DYNAMIC_NAME (entry->d_un.d_val))
              {
                char *name = GET_DYNAMIC_NAME (entry->d_un.d_val);

                if (*name)
                  {
                    printf (_("Not needed object: [%s]\n"), name);
                    break;
                  }
              }

             print_vma (entry->d_un.d_val, PREFIX_HEX);
             putchar ('\n');
           }
         break;

       case DT_BIND_NOW:
         /* The value of this entry is ignored.  */
         if (do_dynamic)
           putchar ('\n');
         break;

       case DT_GNU_PRELINKED:
         if (do_dynamic)
           {
             struct tm *tmp;
             time_t time = entry->d_un.d_val;

             tmp = gmtime (&time);
             printf ("%04u-%02u-%02uT%02u:%02u:%02u\n",
                    tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
                    tmp->tm_hour, tmp->tm_min, tmp->tm_sec);

           }
         break;

       case DT_GNU_HASH:
         dynamic_info_DT_GNU_HASH = entry->d_un.d_val;
         if (do_dynamic)
           {
             print_vma (entry->d_un.d_val, PREFIX_HEX);
             putchar ('\n');
           }
         break;

       default:
         if ((entry->d_tag >= DT_VERSYM) && (entry->d_tag <= DT_VERNEEDNUM))
           version_info[DT_VERSIONTAGIDX (entry->d_tag)] =
             entry->d_un.d_val;

         if (do_dynamic)
           {
             switch (elf_header.e_machine)
              {
              case EM_MIPS:
              case EM_MIPS_RS3_LE:
                dynamic_section_mips_val (entry);
                break;
              case EM_PARISC:
                dynamic_section_parisc_val (entry);
                break;
              case EM_IA_64:
                dynamic_section_ia64_val (entry);
                break;
              default:
                print_vma (entry->d_un.d_val, PREFIX_HEX);
                putchar ('\n');
              }
           }
         break;
       }
    }

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int process_file ( char *  file_name) [static]

Definition at line 9613 of file readelf.c.

{
  FILE *file;
  struct stat statbuf;
  char armag[SARMAG];
  int ret;

  if (stat (file_name, &statbuf) < 0)
    {
      if (errno == ENOENT)
       error (_("'%s': No such file\n"), file_name);
      else
       error (_("Could not locate '%s'.  System error message: %s\n"),
              file_name, strerror (errno));
      return 1;
    }

  if (! S_ISREG (statbuf.st_mode))
    {
      error (_("'%s' is not an ordinary file\n"), file_name);
      return 1;
    }

  file = fopen (file_name, "rb");
  if (file == NULL)
    {
      error (_("Input file '%s' is not readable.\n"), file_name);
      return 1;
    }

  if (fread (armag, SARMAG, 1, file) != 1)
    {
      error (_("%s: Failed to read file header\n"), file_name);
      fclose (file);
      return 1;
    }

  if (memcmp (armag, ARMAG, SARMAG) == 0)
    ret = process_archive (file_name, file);
  else
    {
      rewind (file);
      archive_file_size = archive_file_offset = 0;
      ret = process_object (file_name, file);
    }

  fclose (file);

  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int process_file_header ( void  ) [static]

Definition at line 3169 of file readelf.c.

{
  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"),
             (lo