• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/contrib/binutils/binutils/

Lines Matching refs:section

223 /* A linked list of the section names for which dumps were requested
296 #define GET_ELF_SYMBOLS(file, section) \
297 (is_32bit_elf ? get_32bit_elf_symbols (file, section) \
298 : get_64bit_elf_symbols (file, section))
578 /* Return a pointer to section NAME, or NULL if no such section exists. */
1283 sprintf (name_buf, "<section 0x%x>",
2734 {"section-headers", no_argument, 0, 'S'},
2735 {"section-groups", no_argument, 0, 'g'},
2736 {"section-details", no_argument, 0, 't'},
2737 {"full-section-name",no_argument, 0, 'N'},
2769 -S --section-headers Display the sections' header\n\
2770 --sections An alias for --section-headers\n\
2771 -g --section-groups Display the section groups\n\
2772 -t --section-details Display the section details\n\
2779 -d --dynamic Display the dynamic section (if present)\n\
2782 -D --use-dynamic Use the dynamic section info when displaying symbols\n\
2783 -x --hex-dump=<number> Dump the contents of section <number>\n\
2790 Disassemble the contents of section <number>\n"));
2805 /* Record the fact that the user wants the contents of section number
2811 request_dump (unsigned int section, int type)
2813 if (section >= num_dump_sects)
2817 new_dump_sects = calloc (section + 1, 1);
2829 num_dump_sects = section + 1;
2834 dump_sects[section] |= type;
2839 /* Request a dump by section name. */
2842 request_dump_byname (const char *section, int type)
2850 new_request->name = strdup (section);
2872 int section;
2945 section = strtoul (optarg, & cp, 0);
2946 if (! *cp && section >= 0)
2947 request_dump (section, HEX_DUMP);
3096 section = strtoul (optarg, & cp, 0);
3097 if (! *cp && section >= 0)
3099 request_dump (section, DISASS_DUMP);
3219 printf (_(" (bytes into file)\n Start of section headers: "));
3232 printf (_(" Size of section headers: %ld (bytes)\n"),
3234 printf (_(" Number of section headers: %ld"),
3509 /* Try to locate the .dynamic section. If there is
3510 a section header table, we can easily locate it. */
3518 error (_("no .dynamic section in the dynamic segment\n"));
3530 warn (_("the .dynamic section is not contained within the dynamic segment\n"));
3532 warn (_("the .dynamic section is not the first section in the dynamic segment.\n"));
3537 section is the first section in the DYNAMIC segment. */
3578 Elf_Internal_Shdr *section;
3581 section = section_headers;
3585 for (j = 1; j < elf_header.e_shnum; j++, section++)
3587 if (ELF_IS_SECTION_IN_SEGMENT_MEMORY(section, segment))
3588 printf ("%s ", SECTION_NAME (section));
3638 elf_header.e_shentsize, num, _("section headers"));
3679 elf_header.e_shentsize, num, _("section headers"));
3713 get_32bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section)
3722 esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
3730 == (unsigned long) SECTION_HEADER_NUM (section - section_headers)))
3741 number = section->sh_size / section->sh_entsize;
3776 get_64bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section)
3785 esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
3793 == (unsigned long) SECTION_HEADER_NUM (section - section_headers)))
3804 number = section->sh_size / section->sh_entsize;
4015 Elf_Internal_Shdr *section;
4029 printf (_("There are %d section headers, starting at offset 0x%lx:\n"),
4044 section = SECTION_HEADER (elf_header.e_shstrndx);
4046 if (section->sh_size != 0)
4048 string_table = get_data (NULL, file, section->sh_offset,
4049 1, section->sh_size, _("string table"));
4051 string_table_length = string_table != NULL ? section->sh_size : 0;
4072 section, where XX is the size of longs in bits. Unfortunately,
4099 #define CHECK_ENTSIZE_VALUES(section, i, size32, size64) \
4104 if (section->sh_entsize != expected_entsize) \
4106 i, (unsigned long int) section->sh_entsize, \
4108 section->sh_entsize = expected_entsize; \
4111 #define CHECK_ENTSIZE(section, i, type) \
4112 CHECK_ENTSIZE_VALUES (section, i, sizeof (Elf32_External_##type), \
4115 for (i = 0, section = section_headers;
4117 i++, section++)
4119 char *name = SECTION_NAME (section);
4121 if (section->sh_type == SHT_DYNSYM)
4129 CHECK_ENTSIZE (section, i, Sym);
4130 num_dynamic_syms = section->sh_size / section->sh_entsize;
4131 dynamic_symbols = GET_ELF_SYMBOLS (file, section);
4133 else if (section->sh_type == SHT_STRTAB
4142 dynamic_strings = get_data (NULL, file, section->sh_offset,
4143 1, section->sh_size, _("dynamic strings"));
4144 dynamic_strings_length = section->sh_size;
4146 else if (section->sh_type == SHT_SYMTAB_SHNDX)
4153 symtab_shndx_hdr = section;
4155 else if (section->sh_type == SHT_SYMTAB)
4156 CHECK_ENTSIZE (section, i, Sym);
4157 else if (section->sh_type == SHT_GROUP)
4158 CHECK_ENTSIZE_VALUES (section, i, GRP_ENTRY_SIZE, GRP_ENTRY_SIZE);
4159 else if (section->sh_type == SHT_REL)
4160 CHECK_ENTSIZE (section, i, Rel);
4161 else if (section->sh_type == SHT_RELA)
4162 CHECK_ENTSIZE (section, i, Rela);
4185 /* linkonce section to be combined with .debug_info at link time. */
4241 for (i = 0, section = section_headers;
4243 i++, section++)
4249 SECTION_NAME (section));
4252 get_section_type_name (section->sh_type));
4257 SECTION_NAME (section),
4258 get_section_type_name (section->sh_type));
4262 print_vma (section->sh_addr, LONG_HEX);
4265 (unsigned long) section->sh_offset,
4266 (unsigned long) section->sh_size,
4267 (unsigned long) section->sh_entsize);
4272 printf (" %3s ", get_elf_section_flags (section->sh_flags));
4275 (unsigned long) section->sh_link,
4276 (unsigned long) section->sh_info,
4277 (unsigned long) section->sh_addralign);
4281 print_vma (section->sh_addr, LONG_HEX);
4283 if ((long) section->sh_offset == section->sh_offset)
4284 printf (" %6.6lx", (unsigned long) section->sh_offset);
4288 print_vma (section->sh_offset, LONG_HEX);
4291 if ((unsigned long) section->sh_size == section->sh_size)
4292 printf (" %6.6lx", (unsigned long) section->sh_size);
4296 print_vma (section->sh_size, LONG_HEX);
4299 if ((unsigned long) section->sh_entsize == section->sh_entsize)
4300 printf (" %2.2lx", (unsigned long) section->sh_entsize);
4304 print_vma (section->sh_entsize, LONG_HEX);
4310 printf (" %3s ", get_elf_section_flags (section->sh_flags));
4313 (unsigned long) section->sh_link,
4314 (unsigned long) section->sh_info);
4316 if ((unsigned long) section->sh_addralign == section->sh_addralign)
4317 printf ("%2ld\n", (unsigned long) section->sh_addralign);
4320 print_vma (section->sh_addralign, DEC);
4327 get_section_type_name (section->sh_type));
4328 print_vma (section->sh_addr, LONG_HEX);
4329 if ((long) section->sh_offset == section->sh_offset)
4330 printf (" %16.16lx", (unsigned long) section->sh_offset);
4334 print_vma (section->sh_offset, LONG_HEX);
4336 printf (" %ld\n ", (unsigned long) section->sh_link);
4337 print_vma (section->sh_size, LONG_HEX);
4339 print_vma (section->sh_entsize, LONG_HEX);
4342 (unsigned long) section->sh_info,
4343 (unsigned long) section->sh_addralign);
4348 print_vma (section->sh_addr, LONG_HEX);
4349 if ((long) section->sh_offset == section->sh_offset)
4350 printf (" %8.8lx", (unsigned long) section->sh_offset);
4354 print_vma (section->sh_offset, LONG_HEX);
4357 print_vma (section->sh_size, LONG_HEX);
4359 print_vma (section->sh_entsize, LONG_HEX);
4361 printf (" %3s ", get_elf_section_flags (section->sh_flags));
4364 (unsigned long) section->sh_link,
4365 (unsigned long) section->sh_info,
4366 (unsigned long) section->sh_addralign);
4370 printf (" %s\n", get_elf_section_flags (section->sh_flags));
4401 Elf_Internal_Shdr *section;
4409 /* Don't process section groups unless needed. */
4436 /* Scan the sections for the group section. */
4438 for (i = 0, section = section_headers;
4440 i++, section++)
4441 if (section->sh_type == SHT_GROUP)
4447 printf (_("\nThere are no section groups in this file.\n"));
4465 for (i = 0, section = section_headers, group = section_groups;
4467 i++, section++)
4469 if (section->sh_type == SHT_GROUP)
4471 char *name = SECTION_NAME (section);
4479 if (SECTION_HEADER_INDEX (section->sh_link) >= elf_header.e_shnum
4480 || ((sec = SECTION_HEADER (section->sh_link))->sh_type
4483 error (_("Bad sh_link in group section `%s'\n"), name);
4495 sym = symtab + section->sh_info;
4502 error (_("Bad sh_info in group section `%s'\n"), name);
4540 start = get_data (NULL, file, section->sh_offset,
4541 1, section->sh_size, _("section data"));
4544 size = (section->sh_size / section->sh_entsize) - 1;
4550 printf ("\n%s group section [%5u] `%s' [%s] contains %u sections:\n",
4567 error (_("section [%5u] in group section [%5u] > maximum section [%5u]\n"),
4573 error (_("invalid section [%5u] in group section [%5u]\n"),
4583 error (_("section [%5u] in group section [%5u] already in group section [%5u]\n"),
4590 /* Intel C/C++ compiler may put section 0 in a
4591 section group. We just warn it the first time
4596 error (_("section 0 in group section [%5u]\n"),
4645 /* Process the reloc section. */
4692 (_("\n'%s' relocation section at offset 0x%lx contains %ld bytes:\n"),
4708 Elf_Internal_Shdr *section;
4712 for (i = 0, section = section_headers;
4714 i++, section++)
4716 if ( section->sh_type != SHT_RELA
4717 && section->sh_type != SHT_REL)
4720 rel_offset = section->sh_offset;
4721 rel_size = section->sh_size;
4728 printf (_("\nRelocation section "));
4731 printf ("%d", section->sh_name);
4733 printf (_("'%s'"), SECTION_NAME (section));
4736 rel_offset, (unsigned long) (rel_size / section->sh_entsize));
4738 is_rela = section->sh_type == SHT_RELA;
4740 if (section->sh_link
4741 && SECTION_HEADER_INDEX (section->sh_link)
4750 symsec = SECTION_HEADER (section->sh_link);
4793 /* Process the unwind section. */
4797 /* An absolute address consists of a section and an offset. If the
4798 section is NULL, the offset itself is the address, otherwise, the
4799 address equals to LOAD_ADDRESS(section) + offset. */
4803 unsigned short section;
4808 ((a).section \
4809 ? section_headers [(a).section].sh_addr + (a).offset \
4849 && (addr.section == SHN_UNDEF || addr.section == sym->st_shndx)
4941 this section: */
4964 /* Second, build the unwind table from the contents of the unwind section: */
4974 tep->start.section = SHN_UNDEF;
4975 tep->end.section = SHN_UNDEF;
4976 tep->info.section = SHN_UNDEF;
5034 aux->table[i].start.section = sym->st_shndx;
5038 aux->table[i].end.section = sym->st_shndx;
5042 aux->table[i].info.section = sym->st_shndx;
5104 /* We need to find which section group it is in. */
5147 printf (_("\nCould not find unwind info section for "));
5161 printf (_("\nUnwind section "));
5322 this section. */
5346 section. */
5362 tep->start.section = SHN_UNDEF;
5363 tep->end.section = SHN_UNDEF;
5447 aux->table[i].start.section = sym->st_shndx;
5451 aux->table[i].end.section = sym->st_shndx;
5505 printf (_("\nUnwind section "));
5715 _("dynamic section"));
5719 /* SGI's ELF has more than one section in the DYNAMIC segment, and we
5720 might not have the luxury of section headers. Look for the DT_NULL
5759 _("dynamic section"));
5763 /* SGI's ELF has more than one section in the DYNAMIC segment, and we
5764 might not have the luxury of section headers. Look for the DT_NULL
5826 /* Parse and display the contents of the dynamic section. */
5836 printf (_("\nThere is no dynamic section in this file.\n"));
5856 Elf_Internal_Shdr section;
5867 section.sh_offset = offset_from_vma (file, entry->d_un.d_val, 0);
5870 section.sh_size = archive_file_size - section.sh_offset;
5876 section.sh_size = ftell (file) - section.sh_offset;
5880 section.sh_entsize = sizeof (Elf32_External_Sym);
5882 section.sh_entsize = sizeof (Elf64_External_Sym);
5884 num_dynamic_syms = section.sh_size / section.sh_entsize;
5891 dynamic_symbols = GET_ELF_SYMBOLS (file, &section);
5940 /* And find the syminfo section if available. */
5967 /* There is a syminfo section. Read the data. */
5994 printf (_("\nDynamic section at offset 0x%lx contains %u entries:\n"),
6425 Elf_Internal_Shdr *section;
6432 for (i = 0, section = section_headers;
6434 i++, section++)
6436 switch (section->sh_type)
6447 (_("\nVersion definition section '%s' contains %ld entries:\n"),
6448 SECTION_NAME (section), section->sh_info);
6451 printf_vma (section->sh_addr);
6453 (unsigned long) section->sh_offset, section->sh_link,
6454 SECTION_HEADER_INDEX (section->sh_link)
6456 ? SECTION_NAME (SECTION_HEADER (section->sh_link))
6459 edefs = get_data (NULL, file, section->sh_offset, 1,
6460 section->sh_size,
6461 _("version definition section"));
6465 for (idx = cnt = 0; cnt < section->sh_info; ++cnt)
6540 printf (_("\nVersion needs section '%s' contains %ld entries:\n"),
6541 SECTION_NAME (section), section->sh_info);
6544 printf_vma (section->sh_addr);
6545 printf (_(" Offset: %#08lx Link to section: %ld (%s)\n"),
6546 (unsigned long) section->sh_offset, section->sh_link,
6547 SECTION_HEADER_INDEX (section->sh_link)
6549 ? SECTION_NAME (SECTION_HEADER (section->sh_link))
6552 eneed = get_data (NULL, file, section->sh_offset, 1,
6553 section->sh_size,
6554 _("version need section"));
6558 for (idx = cnt = 0; cnt < section->sh_info; ++cnt)
6633 if (SECTION_HEADER_INDEX (section->sh_link) >= elf_header.e_shnum)
6636 link_section = SECTION_HEADER (section->sh_link);
6637 total = section->sh_size / sizeof (Elf_External_Versym);
6654 printf (_("\nVersion symbols section '%s' contains %d entries:\n"),
6655 SECTION_NAME (section), total);
6658 printf_vma (section->sh_addr);
6660 (unsigned long) section->sh_offset, section->sh_link,
7041 Elf_Internal_Shdr *section;
7151 for (i = 0, section = section_headers;
7153 i++, section++)
7162 if ( section->sh_type != SHT_SYMTAB
7163 && section->sh_type != SHT_DYNSYM)
7167 SECTION_NAME (section),
7168 (unsigned long) (section->sh_size / section->sh_entsize));
7174 symtab = GET_ELF_SYMBOLS (file, section);
7178 if (section->sh_link == elf_header.e_shstrndx)
7183 else if (SECTION_HEADER_INDEX (section->sh_link) < elf_header.e_shnum)
7187 string_sec = SECTION_HEADER (section->sh_link);
7195 si < section->sh_size / section->sh_entsize;
7214 if (section->sh_type == SHT_DYNSYM &&
7601 /* There better should be a dynamic symbol section. */
7659 disassemble_section (Elf_Internal_Shdr *section, FILE *file)
7661 printf (_("\nAssembly dump of section %s\n"),
7662 SECTION_NAME (section));
7671 dump_section (Elf_Internal_Shdr *section, FILE *file)
7679 bytes = section->sh_size;
7681 if (bytes == 0 || section->sh_type == SHT_NOBITS)
7684 SECTION_NAME (section));
7688 printf (_("\nHex dump of section '%s':\n"), SECTION_NAME (section));
7690 addr = section->sh_addr;
7692 start = get_data (NULL, file, section->sh_offset, 1, bytes,
7693 _("section data"));
7697 /* If the section being dumped has relocations against it the user might
7700 FIXME: Maybe we ought to have an option that dumps a section with
7708 || SECTION_HEADER (relsec->sh_info) != section
7713 printf (_(" NOTE: This section has relocations against it, but these have NOT been applied to this dump.\n"));
7803 Elf_Internal_Shdr *section,
7807 unsigned char *end = start + section->sh_size;
7828 || SECTION_HEADER (relsec->sh_info) != section
7848 warn (_("skipping relocation of unknown size against offset 0x%lx in section %s\n"),
7850 SECTION_NAME (section));
7857 warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),
7859 SECTION_NAME (section));
7878 warn (_("skipping unexpected symbol type %s in relocation in section .rela%s\n"),
7880 SECTION_NAME (section));
7905 warn (_("skipping unexpected symbol type %s in relocation in section .rela.%s\n"),
7907 SECTION_NAME (section));
7925 struct dwarf_section *section = &debug_displays [debug].section;
7930 if (section->start != NULL)
7933 /* Locate the debug section. */
7934 sec = find_section (section->name);
7938 snprintf (buf, sizeof (buf), _("%s section data"), section->name);
7939 section->address = sec->sh_addr;
7940 section->size = sec->sh_size;
7941 section->start = get_data (NULL, file, sec->sh_offset, 1,
7945 debug_apply_rela_addends (file, sec, section->start);
7947 return section->start != NULL;
7953 struct dwarf_section *section = &debug_displays [debug].section;
7955 if (section->start == NULL)
7958 free ((char *) section->start);
7959 section->start = NULL;
7960 section->address = 0;
7961 section->size = 0;
7965 display_debug_section (Elf_Internal_Shdr *section, FILE *file)
7967 char *name = SECTION_NAME (section);
7972 length = section->sh_size;
7982 /* See if we know how to display the contents of this section. */
7984 if (streq (debug_displays[i].section.name, name))
7986 struct dwarf_section *sec = &debug_displays [i].section;
8001 printf (_("Unrecognized debug section: %s\n"), name);
8009 based on section name. */
8037 Elf_Internal_Shdr *section;
8045 for (i = 0, section = section_headers;
8047 i++, section++)
8051 disassemble_section (section, file);
8054 dump_section (section, file);
8057 display_debug_section (section, file);
8061 dump of a section that does not exist. */
8088 /* ARM EABI attributes section. */
8472 /* Find the section header so that we get the size. */
8500 printf (_("ERROR: Bad section length (%d > %d)\n"),
8573 printf (" Unknown section contexts\n");
8738 /* Find the section header so that we get the size. */
8764 option->section = BYTE_GET (eoption->section);
8786 printf (" NULL %d %lx", option->section, option->info);
8907 option->kind, option->section, option->info);
9001 Elf_Internal_Shdr *section, *string_sec;
9011 for (i = 0, section = section_headers;
9013 i++, section++)
9015 switch (section->sh_type)
9018 if (SECTION_HEADER_INDEX (section->sh_link) >= elf_header.e_shnum)
9021 elib = get_data (NULL, file, section->sh_offset, 1, section->sh_size,
9026 string_sec = SECTION_HEADER (section->sh_link);
9033 || section->sh_entsize != sizeof (Elf32_External_Lib))
9039 printf (_("\nLibrary list section '%s' contains %lu entries:\n"),
9040 SECTION_NAME (section),
9041 (long) (section->sh_size / sizeof (Elf32_External_Lib)));
9045 for (cnt = 0; cnt < section->sh_size / sizeof (Elf32_External_Lib);
9413 Elf_Internal_Shdr *section;
9417 for (i = 0, section = section_headers;
9419 i++, section++)
9420 if (section->sh_type == SHT_NOTE)
9422 (bfd_vma) section->sh_offset,
9423 (bfd_vma) section->sh_size);
9551 /* There may be some extensions in the first section header. Don't
9612 /* Without loaded section headers we cannot process lots of
9622 /* Without loaded section groups we cannot process unwind. */