* symfile.c (init_objfile_sect_indices): New function.
(default_symfile_offsets): Move the section-index-initializing stuff into init_objfile_sect_indices, and call that.
This commit is contained in:
parent
b29c9944fa
commit
e828957292
|
@ -1,5 +1,9 @@
|
||||||
2002-11-25 Jim Blandy <jimb@redhat.com>
|
2002-11-25 Jim Blandy <jimb@redhat.com>
|
||||||
|
|
||||||
|
* symfile.c (init_objfile_sect_indices): New function.
|
||||||
|
(default_symfile_offsets): Move the section-index-initializing
|
||||||
|
stuff into init_objfile_sect_indices, and call that.
|
||||||
|
|
||||||
* symtab.h (SIZEOF_N_SECTION_OFFSETS): New macro.
|
* symtab.h (SIZEOF_N_SECTION_OFFSETS): New macro.
|
||||||
(SIZEOF_SECTION_OFFSETS): Use SIZEOF_N_SECTION_OFFSETS.
|
(SIZEOF_SECTION_OFFSETS): Use SIZEOF_N_SECTION_OFFSETS.
|
||||||
|
|
||||||
|
|
|
@ -473,43 +473,13 @@ free_section_addr_info (struct section_addr_info *sap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Parse the user's idea of an offset for dynamic linking, into our idea
|
/* Initialize OBJFILE's sect_index_* members. */
|
||||||
of how to represent it for fast symbol reading. This is the default
|
static void
|
||||||
version of the sym_fns.sym_offsets function for symbol readers that
|
init_objfile_sect_indices (struct objfile *objfile)
|
||||||
don't need to do anything special. It allocates a section_offsets table
|
|
||||||
for the objectfile OBJFILE and stuffs ADDR into all of the offsets. */
|
|
||||||
|
|
||||||
void
|
|
||||||
default_symfile_offsets (struct objfile *objfile,
|
|
||||||
struct section_addr_info *addrs)
|
|
||||||
{
|
{
|
||||||
|
asection *sect;
|
||||||
int i;
|
int i;
|
||||||
asection *sect = NULL;
|
|
||||||
|
|
||||||
objfile->num_sections = SECT_OFF_MAX;
|
|
||||||
objfile->section_offsets = (struct section_offsets *)
|
|
||||||
obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
|
|
||||||
memset (objfile->section_offsets, 0, SIZEOF_SECTION_OFFSETS);
|
|
||||||
|
|
||||||
/* Now calculate offsets for section that were specified by the
|
|
||||||
caller. */
|
|
||||||
for (i = 0; i < MAX_SECTIONS && addrs->other[i].name; i++)
|
|
||||||
{
|
|
||||||
struct other_sections *osp ;
|
|
||||||
|
|
||||||
osp = &addrs->other[i] ;
|
|
||||||
if (osp->addr == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Record all sections in offsets */
|
|
||||||
/* The section_offsets in the objfile are here filled in using
|
|
||||||
the BFD index. */
|
|
||||||
(objfile->section_offsets)->offsets[osp->sectindex] = osp->addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remember the bfd indexes for the .text, .data, .bss and
|
|
||||||
.rodata sections. */
|
|
||||||
|
|
||||||
sect = bfd_get_section_by_name (objfile->obfd, ".text");
|
sect = bfd_get_section_by_name (objfile->obfd, ".text");
|
||||||
if (sect)
|
if (sect)
|
||||||
objfile->sect_index_text = sect->index;
|
objfile->sect_index_text = sect->index;
|
||||||
|
@ -556,6 +526,46 @@ default_symfile_offsets (struct objfile *objfile,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Parse the user's idea of an offset for dynamic linking, into our idea
|
||||||
|
of how to represent it for fast symbol reading. This is the default
|
||||||
|
version of the sym_fns.sym_offsets function for symbol readers that
|
||||||
|
don't need to do anything special. It allocates a section_offsets table
|
||||||
|
for the objectfile OBJFILE and stuffs ADDR into all of the offsets. */
|
||||||
|
|
||||||
|
void
|
||||||
|
default_symfile_offsets (struct objfile *objfile,
|
||||||
|
struct section_addr_info *addrs)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
objfile->num_sections = SECT_OFF_MAX;
|
||||||
|
objfile->section_offsets = (struct section_offsets *)
|
||||||
|
obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
|
||||||
|
memset (objfile->section_offsets, 0, SIZEOF_SECTION_OFFSETS);
|
||||||
|
|
||||||
|
/* Now calculate offsets for section that were specified by the
|
||||||
|
caller. */
|
||||||
|
for (i = 0; i < MAX_SECTIONS && addrs->other[i].name; i++)
|
||||||
|
{
|
||||||
|
struct other_sections *osp ;
|
||||||
|
|
||||||
|
osp = &addrs->other[i] ;
|
||||||
|
if (osp->addr == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Record all sections in offsets */
|
||||||
|
/* The section_offsets in the objfile are here filled in using
|
||||||
|
the BFD index. */
|
||||||
|
(objfile->section_offsets)->offsets[osp->sectindex] = osp->addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remember the bfd indexes for the .text, .data, .bss and
|
||||||
|
.rodata sections. */
|
||||||
|
init_objfile_sect_indices (objfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Process a symbol file, as either the main file or as a dynamically
|
/* Process a symbol file, as either the main file or as a dynamically
|
||||||
loaded file.
|
loaded file.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue