forked from Imagelibrary/binutils-gdb
* coffread.c (cs_to_section): Use gdb_bfd_section_index.
* elfread.c (record_minimal_symbol, elf_symtab_read): Use gdb_bfd_section_index. * gdb_bfd.c (gdb_bfd_section_index, gdb_bfd_count_sections): New functions. * gdb_bfd.h (gdb_bfd_section_index, gdb_bfd_count_sections): Declare. * machoread.c (macho_symtab_add_minsym, macho_symfile_offsets): Update. * objfiles.c (add_to_objfile_sections_full): New function. (add_to_objfile_sections): Use it. (build_section_table): Rewrite. (objfile_relocate1): Use gdb_bfd_section_index. Update. * objfiles.h (obj_section_offset): Use gdb_bfd_section_index. (struct objfile) <sections>: Update comment. (ALL_OBJFILE_OSECTIONS): Skip sections where the_bfd_section is NULL. (ALL_OBJSECTIONS): Use it. * solib-dsbt.c (dsbt_relocate_main_executable): Update. * solib-frv.c (frv_relocate_main_executable): Update. * solib-target.c (solib_target_relocate_section_addresses): Use gdb_bfd_section_index. * symfile.c (build_section_addr_info_from_section_table): Use gdb_bfd_section_index. (build_section_addr_info_from_bfd, place_section): Likewise. * symtab.c (fixup_section): Update. * xcoffread.c (find_targ_sec): Use gdb_bfd_section_index.
This commit is contained in:
@@ -605,6 +605,36 @@ gdb_bfd_fdopenr (const char *filename, const char *target, int fd)
|
||||
|
||||
|
||||
|
||||
gdb_static_assert (ARRAY_SIZE (_bfd_std_section) == 4);
|
||||
|
||||
/* See gdb_bfd.h. */
|
||||
|
||||
int
|
||||
gdb_bfd_section_index (bfd *abfd, asection *section)
|
||||
{
|
||||
if (section == NULL)
|
||||
return -1;
|
||||
else if (section == bfd_com_section_ptr)
|
||||
return bfd_count_sections (abfd) + 1;
|
||||
else if (section == bfd_und_section_ptr)
|
||||
return bfd_count_sections (abfd) + 2;
|
||||
else if (section == bfd_abs_section_ptr)
|
||||
return bfd_count_sections (abfd) + 3;
|
||||
else if (section == bfd_ind_section_ptr)
|
||||
return bfd_count_sections (abfd) + 4;
|
||||
return section->index;
|
||||
}
|
||||
|
||||
/* See gdb_bfd.h. */
|
||||
|
||||
int
|
||||
gdb_bfd_count_sections (bfd *abfd)
|
||||
{
|
||||
return bfd_count_sections (abfd) + 4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* A callback for htab_traverse that prints a single BFD. */
|
||||
|
||||
static int
|
||||
|
||||
Reference in New Issue
Block a user