• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/cxxfilt-11/cxxfilt/binutils/

Lines Matching +defs:symbol +defs:file

1 /* readelf.c -- display contents of an ELF format file
8 This file is part of GNU Binutils.
29 so why does the binutils project have two file dumpers ?
31 The reason is that objdump sees an ELF file through a BFD filter of the
36 the file actually says.
42 ELF file than is provided by objdump. In particular it can display DWARF
103 /* The following headers use the elf/reloc-macros.h file to
240 some kind has been requested. It is reset on a per-object file
296 #define GET_ELF_SYMBOLS(file, section) \
297 (is_32bit_elf ? get_32bit_elf_symbols (file, section) \
298 : get_64bit_elf_symbols (file, section))
312 get_data (void *var, FILE *file, long offset, size_t size, size_t nmemb,
320 if (fseek (file, archive_file_offset + offset, SEEK_SET))
345 if (fread (mvar, size, nmemb, file) != nmemb)
529 /* Display a symbol on stdout. If do_wide is not true then
530 format the symbol to be at most WIDTH characters,
536 print_symbol (int width, const char *symbol)
539 printf ("%s", symbol);
541 printf ("%-*.*s", width, width, symbol);
543 printf ("%-.*s", width, symbol);
692 slurp_rela_relocs (FILE *file,
706 erelas = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs"));
734 erelas = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs"));
764 slurp_rel_relocs (FILE *file,
778 erels = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs"));
806 erels = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs"));
839 dump_relocations (FILE *file,
857 if (!slurp_rela_relocs (file, rel_offset, rel_size, &rels, &rel_size))
862 if (!slurp_rel_relocs (file, rel_offset, rel_size, &rels, &rel_size))
931 symbol index followed by four individual byte fields.
1236 printf (" bad symbol index: %08lx", (unsigned long) symtab_index);
1667 case ET_REL: return _("REL (Relocatable file)");
1668 case ET_EXEC: return _("EXEC (Executable file)");
1669 case ET_DYN: return _("DYN (Shared object file)");
1670 case ET_CORE: return _("CORE (Core file)");
1843 strcat (buf, ", sorted symbol tables");
1866 strcat (buf, ", sorted symbol tables");
2189 This means it is likely to be an o32 file, but not for
2728 {"file-header", no_argument, 0, 'h'},
2762 fprintf (stdout, _("Usage: readelf <option(s)> elf-file(s)\n"));
2766 -h --file-header Display the ELF file header\n\
2774 -s --syms Display the symbol table\n\
2795 @<file> Read options from <file>\n\
3178 (_("Not an ELF file - it has the wrong magic bytes at the start\n"));
3217 printf (_(" (bytes into file)\n Start of section headers: "));
3219 printf (_(" (bytes into file)\n"));
3269 get_32bit_program_headers (FILE *file, Elf_Internal_Phdr *program_headers)
3276 phdrs = get_data (NULL, file, elf_header.e_phoff,
3302 get_64bit_program_headers (FILE *file, Elf_Internal_Phdr *program_headers)
3309 phdrs = get_data (NULL, file, elf_header.e_phoff,
3337 get_program_headers (FILE *file)
3354 ? get_32bit_program_headers (file, phdrs)
3355 : get_64bit_program_headers (file, phdrs))
3368 process_program_headers (FILE *file)
3376 printf (_("\nThere are no program headers in this file.\n"));
3382 printf (_("\nElf file type is %s\n"), get_file_type (elf_header.e_type));
3391 if (! get_program_headers (file))
3539 if (fseek (file, archive_file_offset + (long) segment->p_offset,
3551 if (fscanf (file, fmt, program_interpreter) <= 0)
3594 /* Find the file offset corresponding to VMA by using the program headers. */
3597 offset_from_vma (FILE *file, bfd_vma vma, bfd_size_type size)
3601 if (! get_program_headers (file))
3626 get_32bit_section_headers (FILE *file, unsigned int num)
3632 shdrs = get_data (NULL, file, elf_header.e_shoff,
3667 get_64bit_section_headers (FILE *file, unsigned int num)
3673 shdrs = get_data (NULL, file, elf_header.e_shoff,
3708 get_32bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section)
3717 esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
3727 shndx = get_data (NULL, file, symtab_shndx_hdr->sh_offset,
3771 get_64bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section)
3780 esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
3790 shndx = get_data (NULL, file, symtab_shndx_hdr->sh_offset,
4008 process_section_headers (FILE *file)
4018 printf (_("\nThere are no sections in this file.\n"));
4029 if (! get_32bit_section_headers (file, elf_header.e_shnum))
4032 else if (! get_64bit_section_headers (file, elf_header.e_shnum))
4043 string_table = get_data (NULL, file, section->sh_offset,
4050 /* Scan the sections for the dynamic symbol table
4120 error (_("File contains multiple dynamic symbol tables\n"));
4126 dynamic_symbols = GET_ELF_SYMBOLS (file, section);
4137 dynamic_strings = get_data (NULL, file, section->sh_offset,
4394 process_section_groups (FILE *file)
4411 printf (_("\nThere are no sections in this file.\n"));
4442 printf (_("\nThere are no section groups in this file.\n"));
4473 /* Get the symbol table. */
4487 symtab = GET_ELF_SYMBOLS (file, symtab_sec);
4526 strtab = get_data (NULL, file, strtab_sec->sh_offset,
4535 start = get_data (NULL, file, section->sh_offset,
4643 process_relocs (FILE *file)
4690 dump_relocations (file,
4691 offset_from_vma (file, rel_offset, rel_size),
4699 printf (_("\nThere are no dynamic relocations in this file.\n"));
4751 symtab = GET_ELF_SYMBOLS (file, symsec);
4761 strtab = get_data (NULL, file, strsec->sh_offset,
4767 dump_relocations (file, rel_offset, rel_size,
4774 dump_relocations (file, rel_offset, rel_size,
4782 printf (_("\nThere are no relocations in this file.\n"));
4821 Elf_Internal_Sym *symtab; /* The symbol table. */
4922 slurp_ia64_unwind_table (FILE *file,
4940 if (! get_program_headers (file))
4961 table = get_data (NULL, file, sec->sh_offset, 1, size, _("unwind table"));
5001 if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size,
5053 ia64_process_unwind (FILE *file)
5067 aux.symtab = GET_ELF_SYMBOLS (file, sec);
5070 aux.strtab = get_data (NULL, file, strsec->sh_offset,
5079 printf (_("\nThere are no unwind sections in this file.\n"));
5153 aux.info = get_data (NULL, file, sec->sh_offset, 1, aux.info_size,
5167 (void) slurp_ia64_unwind_table (file, & aux, unwsec);
5230 Elf_Internal_Sym *symtab; /* The symbol table. */
5303 slurp_hppa_unwind_table (FILE *file,
5321 if (! get_program_headers (file))
5343 table = get_data (NULL, file, sec->sh_offset, 1, size, _("unwind table"));
5413 if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size,
5463 hppa_process_unwind (FILE *file)
5482 aux.symtab = GET_ELF_SYMBOLS (file, sec);
5485 aux.strtab = get_data (NULL, file, strsec->sh_offset,
5494 printf (_("\nThere are no unwind sections in this file.\n"));
5507 slurp_hppa_unwind_table (file, &aux, sec);
5526 process_unwind (FILE *file)
5530 int (*handler)(FILE *file);
5543 return handlers[i].handler (file);
5545 printf (_("\nThere are no unwind sections in this file.\n"));
5704 get_32bit_dynamic_section (FILE *file)
5709 edyn = get_data (NULL, file, dynamic_addr, 1, dynamic_size,
5748 get_64bit_dynamic_section (FILE *file)
5753 edyn = get_data (NULL, file, dynamic_addr, 1, dynamic_size,
5824 process_dynamic_section (FILE *file)
5831 printf (_("\nThere is no dynamic section in this file.\n"));
5838 if (! get_32bit_dynamic_section (file))
5841 else if (! get_64bit_dynamic_section (file))
5844 /* Find the appropriate symbol table. */
5858 /* Since we do not know how big the symbol table is,
5859 we default to reading in the entire file (!) and
5862 section.sh_offset = offset_from_vma (file, entry->d_un.d_val, 0);
5868 if (fseek (file, 0, SEEK_END))
5869 error (_("Unable to seek to end of file!"));
5871 section.sh_size = ftell (file) - section.sh_offset;
5886 dynamic_symbols = GET_ELF_SYMBOLS (file, &section);
5906 we default to reading in the entire file (!) and
5910 offset = offset_from_vma (file, entry->d_un.d_val, 0);
5916 if (fseek (file, 0, SEEK_END))
5917 error (_("Unable to seek to end of file\n"));
5918 str_tab_len = ftell (file) - offset;
5928 dynamic_strings = get_data (NULL, file, offset, 1, str_tab_len,
5953 dynamic_syminfo_offset = offset_from_vma (file, entry->d_un.d_val,
5963 extsyminfo = get_data (NULL, file, dynamic_syminfo_offset, 1,
5964 syminsz, _("symbol information"));
6036 printf (_("Configuration file"));
6418 process_version_sections (FILE *file)
6454 edefs = get_data (NULL, file, section->sh_offset, 1,
6547 eneed = get_data (NULL, file, section->sh_offset, 1,
6640 symbols = GET_ELF_SYMBOLS (file, link_section);
6644 strtab = get_data (NULL, file, string_sec->sh_offset, 1,
6658 off = offset_from_vma (file,
6661 edata = get_data (NULL, file, off, total, sizeof (short),
6662 _("version symbol data"));
6720 (file, version_info[DT_VERSIONTAGIDX (DT_VERNEED)],
6730 get_data (&evn, file, offset, sizeof (evn), 1,
6740 get_data (&evna, file, a_off, sizeof (evna),
6777 (file, version_info[DT_VERSIONTAGIDX (DT_VERDEF)],
6782 get_data (&evd, file, offset, sizeof (evd), 1,
6800 get_data (&evda, file,
6834 printf (_("\nNo version information found in this file.\n"));
6996 get_dynamic_data (FILE *file, unsigned int number, unsigned int ent_size)
7009 if (fread (e_data, ent_size, number, file) != number)
7032 /* Dump the symbol table. */
7034 process_symbol_table (FILE *file)
7061 if (fseek (file,
7063 + offset_from_vma (file, dynamic_info[DT_HASH],
7071 if (fread (nb, hash_ent_size, 1, file) != 1)
7077 if (fread (nc, hash_ent_size, 1, file) != 1)
7086 buckets = get_dynamic_data (file, nbuckets, hash_ent_size);
7087 chains = get_dynamic_data (file, nchains, hash_ent_size);
7169 symtab = GET_ELF_SYMBOLS (file, section);
7184 strtab = get_data (NULL, file, string_sec->sh_offset,
7219 (file, version_info[DT_VERSIONTAGIDX (DT_VERSYM)],
7222 get_data (&data, file, offset + si * sizeof (vers_data),
7245 (file, version_info[DT_VERSIONTAGIDX (DT_VERNEED)],
7252 get_data (&evn, file, offset, sizeof (evn), 1,
7264 get_data (&evna, file, vna_off,
7293 error (_("bad dynamic symbol"));
7309 (file,
7317 get_data (&evd, file, offset, sizeof (evd),
7332 get_data (&evda, file, offset, sizeof (evda),
7357 (_("\nDynamic symbol information is not available for displaying symbols.\n"));
7435 if (fseek (file,
7437 + offset_from_vma (file, dynamic_info_DT_GNU_HASH,
7445 if (fread (nb, 16, 1, file) != 1)
7460 if (fseek (file,
7462 + offset_from_vma (file, buckets_vma, 4)),
7469 gnubuckets = get_dynamic_data (file, ngnubuckets, 4);
7489 if (fseek (file,
7491 + offset_from_vma (file, buckets_vma
7501 if (fread (nb, 4, 1, file) != 1)
7514 if (fseek (file,
7516 + offset_from_vma (file, buckets_vma + 4 * ngnubuckets, 4)),
7523 gnuchains = get_dynamic_data (file, maxchain, 4);
7587 process_syminfo (FILE *file ATTRIBUTE_UNUSED)
7596 /* There better should be a dynamic symbol section. */
7654 disassemble_section (Elf_Internal_Shdr *section, FILE *file)
7666 dump_section (Elf_Internal_Shdr *section, FILE *file)
7687 start = get_data (NULL, file, section->sh_offset, 1, bytes,
7797 debug_apply_rela_addends (void *file,
7824 if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size,
7829 symtab = GET_ELF_SYMBOLS (file, symsec);
7869 warn (_("skipping unexpected symbol type %s in relocation in section .rela%s\n"),
7879 symbol index followed by four individual byte fields.
7896 warn (_("skipping unexpected symbol type %s in relocation in section .rela.%s\n"),
7914 load_debug_section (enum dwarf_section_display_enum debug, void *file)
7932 section->start = get_data (NULL, file, sec->sh_offset, 1,
7936 debug_apply_rela_addends (file, sec, section->start);
7956 display_debug_section (Elf_Internal_Shdr *section, FILE *file)
7979 if (load_debug_section (i, file))
7981 result &= debug_displays[i].display (sec, file);
8026 process_section_contents (FILE *file)
8042 disassemble_section (section, file);
8045 dump_section (section, file);
8048 display_debug_section (section, file);
8295 process_arm_specific (FILE *file)
8313 contents = get_data (NULL, file, sect->sh_offset, 1, sect->sh_size,
8412 process_mips_specific (FILE *file)
8431 = offset_from_vma (file, entry->d_un.d_val,
8438 options_offset = offset_from_vma (file, entry->d_un.d_val, 0);
8442 = offset_from_vma (file, entry->d_un.d_val,
8457 elib = get_data (NULL, file, liblist_offset,
8547 eopt = get_data (NULL, file, options_offset, 1, sect->sh_size,
8739 error (_("conflict list found without a dynamic symbol table"));
8754 econf32 = get_data (NULL, file, conflicts_offset,
8768 econf64 = get_data (NULL, file, conflicts_offset,
8804 process_gnu_liblist (FILE *file)
8826 elib = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
8833 strtab = get_data (NULL, file, string_sec->sh_offset, 1,
9016 /* NetBSD-specific core file notes. */
9032 process_corefile_note_segment (FILE *file, bfd_vma offset, bfd_vma length)
9041 pnotes = get_data (NULL, file, offset, 1, length, _("notes"));
9114 process_corefile_note_segments (FILE *file)
9120 if (! get_program_headers (file))
9128 res &= process_corefile_note_segment (file,
9137 process_note_sections (FILE *file)
9147 res &= process_corefile_note_segment (file,
9155 process_notes (FILE *file)
9162 return process_note_sections (file);
9166 return process_corefile_note_segments (file);
9168 printf (_("No note segments present in the core file.\n"));
9173 process_arch_specific (FILE *file)
9181 return process_arm_specific (file);
9184 return process_mips_specific (file);
9193 get_file_header (FILE *file)
9196 if (fread (elf_header.e_ident, EI_NIDENT, 1, file) != 1)
9222 if (fread (ehdr32.e_type, sizeof (ehdr32) - EI_NIDENT, 1, file) != 1)
9254 if (fread (ehdr64.e_type, sizeof (ehdr64) - EI_NIDENT, 1, file) != 1)
9277 get_32bit_section_headers (file, 1);
9279 get_64bit_section_headers (file, 1);
9287 /* Process one ELF object file according to the command line options.
9288 This file may actually be stored in an archive. The file is
9292 process_object (char *file_name, FILE *file)
9296 if (! get_file_header (file))
9298 error (_("%s: Failed to read file header\n"), file_name);
9302 /* Initialise per file variables. */
9309 /* Process the file. */
9316 object file is processed. */
9333 if (! process_section_headers (file))
9343 if (! process_section_groups (file))
9349 if (process_program_headers (file))
9350 process_dynamic_section (file);
9352 process_relocs (file);
9354 process_unwind (file);
9356 process_symbol_table (file);
9358 process_syminfo (file);
9360 process_version_sections (file);
9362 process_section_contents (file);
9364 process_notes (file);
9366 process_gnu_liblist (file);
9368 process_arch_specific (file);
9437 /* Process an ELF archive. The file is positioned just after the
9441 process_archive (char *file_name, FILE *file)
9453 got = fread (&arhdr, 1, sizeof arhdr, file);
9465 /* This is the archive symbol table. Skip it.
9468 if (fseek (file, size + (size & 1), SEEK_CUR) != 0)
9470 error (_("%s: failed to skip archive symbol table\n"), file_name);
9474 got = fread (&arhdr, 1, sizeof arhdr, file);
9499 if (fread (longnames, longnames_size, 1, file) != 1)
9507 getc (file);
9509 got = fread (&arhdr, 1, sizeof arhdr, file);
9554 error (_("%s: bad archive file name\n"), file_name);
9573 archive_file_offset = ftell (file);
9576 ret |= process_object (namealc, file);
9580 if (fseek (file,
9591 got = fread (&arhdr, 1, sizeof arhdr, file);
9612 FILE *file;
9620 error (_("'%s': No such file\n"), file_name);
9629 error (_("'%s' is not an ordinary file\n"), file_name);
9633 file = fopen (file_name, "rb");
9634 if (file == NULL)
9636 error (_("Input file '%s' is not readable.\n"), file_name);
9640 if (fread (armag, SARMAG, 1, file) != 1)
9642 error (_("%s: Failed to read file header\n"), file_name);
9643 fclose (file);
9648 ret = process_archive (file_name, file);
9651 rewind (file);
9653 ret = process_object (file_name, file);
9656 fclose (file);