xcoff_initial_scan PARAMS ((struct objfile *, int));
static void
-scan_xcoff_symtab PARAMS ((struct section_offsets *, struct objfile *));
+scan_xcoff_symtab PARAMS ((struct objfile *));
static char *
xcoff_next_symbol_text PARAMS ((struct objfile *));
static void
xcoff_symfile_finish PARAMS ((struct objfile *));
-static struct section_offsets *
- xcoff_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
+static void
+ xcoff_symfile_offsets PARAMS ((struct objfile *, struct section_addr_info *addrs));
static void
find_linenos PARAMS ((bfd *, sec_ptr, PTR));
int targ_index;
int *resultp;
asection **bfd_sect;
+ struct objfile *objfile;
};
static void find_targ_sec PARAMS ((bfd *, asection *, void *));
PTR obj;
{
struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
+ struct objfile *objfile = args->objfile;
if (sect->target_index == args->targ_index)
{
/* This is the section. Figure out what SECT_OFF_* code it is. */
if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
- *args->resultp = SECT_OFF_TEXT;
+ *args->resultp = SECT_OFF_TEXT (objfile);
else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
- *args->resultp = SECT_OFF_DATA;
+ *args->resultp = SECT_OFF_DATA (objfile);
else
- *args->resultp = SECT_OFF_BSS;
+ *args->resultp = SECT_OFF_BSS (objfile);
*args->bfd_sect = sect;
}
}
int secnum;
struct objfile *objfile;
{
- int off = SECT_OFF_TEXT;
+ int off = SECT_OFF_TEXT (objfile);
asection *sect = NULL;
struct find_targ_sec_arg args;
args.targ_index = secnum;
args.resultp = &off;
args.bfd_sect = §
+ args.objfile = objfile;
bfd_map_over_sections (objfile->obfd, find_targ_sec, &args);
return off;
}
int secnum;
struct objfile *objfile;
{
- int off = SECT_OFF_TEXT;
+ int off = SECT_OFF_TEXT (objfile);
asection *sect = NULL;
struct find_targ_sec_arg args;
args.targ_index = secnum;
start_subfile (fakename, (char *) 0);
free (current_subfile->name);
}
- current_subfile->name = strdup (inclTable[ii].name);
+ current_subfile->name = xstrdup (inclTable[ii].name);
#endif
if (lv == lineTb)
? int_lnno.l_addr.l_paddr
: read_symbol_nvalue (int_lnno.l_addr.l_symndx));
addr += ANOFFSET (this_symtab_psymtab->objfile->section_offsets,
- SECT_OFF_TEXT);
+ SECT_OFF_TEXT (this_symtab_psymtab->objfile));
if (addr < startaddr || (endaddr && addr >= endaddr))
return;
if (last_source_file)
{
pst->symtab =
- end_symtab (cur_src_end_addr, objfile, SECT_OFF_TEXT);
+ end_symtab (cur_src_end_addr, objfile, SECT_OFF_TEXT (objfile));
end_stabs ();
}
{
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- end_symtab (file_end_addr, objfile, SECT_OFF_TEXT);
+ end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
end_stabs ();
start_stabs ();
/* Give all csects for this source file the same
file_start_addr =
cs->c_value + ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT);
+ SECT_OFF_TEXT (objfile));
file_end_addr = file_start_addr + CSECT_LEN (&main_aux);
if (cs->c_name && cs->c_name[0] == '.')
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- end_symtab (file_end_addr, objfile, SECT_OFF_TEXT);
+ end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
end_stabs ();
/* XCOFF, according to the AIX 3.2 documentation, puts the filename
if (STREQ (cs->c_name, ".bf"))
{
CORE_ADDR off = ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT);
+ SECT_OFF_TEXT (objfile));
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
0, cs->c_naux, &main_aux);
(fcn_cs_saved.c_value + off,
fcn_stab_saved.c_name, 0, 0, objfile);
if (new->name != NULL)
- SYMBOL_SECTION (new->name) = SECT_OFF_TEXT;
+ SYMBOL_SECTION (new->name) = SECT_OFF_TEXT (objfile);
}
else if (STREQ (cs->c_name, ".ef"))
{
(fcn_cs_saved.c_value
+ fcn_aux_saved.x_sym.x_misc.x_fsize
+ ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT)),
+ SECT_OFF_TEXT (objfile))),
objfile);
within_function = 0;
}
new = push_context (depth,
(cs->c_value
+ ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT)));
+ SECT_OFF_TEXT (objfile))));
}
else if (STREQ (cs->c_name, ".eb"))
{
new->start_addr,
(cs->c_value
+ ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT)),
+ SECT_OFF_TEXT (objfile))),
objfile);
}
local_symbols = new->locals;
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- s = end_symtab (file_end_addr, objfile, SECT_OFF_TEXT);
+ s = end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
/* When reading symbols for the last C_FILE of the objfile, try
to make sure that we set pst->symtab to the symtab for the
file, not to the _globals_ symtab. I'm not sure whether this
static unsigned int first_fun_line_offset;
static struct partial_symtab *xcoff_start_psymtab
- PARAMS ((struct objfile *, struct section_offsets *, char *, int,
+ PARAMS ((struct objfile *, char *, int,
struct partial_symbol **, struct partial_symbol **));
/* Allocate and partially fill a partial symtab. It will be
(normal). */
static struct partial_symtab *
-xcoff_start_psymtab (objfile, section_offsets,
- filename, first_symnum, global_syms, static_syms)
+xcoff_start_psymtab (objfile, filename, first_symnum, global_syms,
+ static_syms)
struct objfile *objfile;
- struct section_offsets *section_offsets;
char *filename;
int first_symnum;
struct partial_symbol **global_syms;
struct partial_symbol **static_syms;
{
struct partial_symtab *result =
- start_psymtab_common (objfile, section_offsets,
+ start_psymtab_common (objfile, objfile->section_offsets,
filename,
- /* We fill in textlow later. */
+ /* We fill in textlow later. */
0,
global_syms, static_syms);
}
static void
-scan_xcoff_symtab (section_offsets, objfile)
- struct section_offsets *section_offsets;
+scan_xcoff_symtab (objfile)
struct objfile *objfile;
{
CORE_ADDR toc_offset = 0; /* toc offset value in data section. */
/* Give all psymtabs for this source file the same
name. */
pst = xcoff_start_psymtab
- (objfile, section_offsets,
+ (objfile,
filestring,
symnum_before,
objfile->global_psymbols.next,
else
filestring = namestring;
- pst = xcoff_start_psymtab (objfile, section_offsets,
+ pst = xcoff_start_psymtab (objfile,
filestring,
symnum_before,
objfile->global_psymbols.next,
/* START_PSYMTAB and END_PSYMTAB are never used, because they are only
called from DBXREAD_ONLY or N_SO code. Likewise for the symnum
variable. */
-#define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms) 0
+#define START_PSYMTAB(ofile,fname,low,symoff,global_syms,static_syms) 0
#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set)\
do {} while (0)
/* We have already set the namestring. */
back_to = make_cleanup (really_free_pendings, 0);
init_minimal_symbol_collection ();
- make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+ make_cleanup_discard_minimal_symbols ();
/* Now that the symbol table data of the executable file are all in core,
process them and define symbols accordingly. */
- scan_xcoff_symtab (objfile->section_offsets, objfile);
+ scan_xcoff_symtab (objfile);
/* Install any minimal symbols that have been collected as the current
minimal symbols for this objfile. */
do_cleanups (back_to);
}
\f
-static struct section_offsets *
-xcoff_symfile_offsets (objfile, addr)
+static void
+xcoff_symfile_offsets (objfile, addrs)
struct objfile *objfile;
- CORE_ADDR addr;
+ struct section_addr_info *addrs;
{
- struct section_offsets *section_offsets;
+ asection *sect = NULL;
int i;
objfile->num_sections = SECT_OFF_MAX;
- section_offsets = (struct section_offsets *)
+ objfile->section_offsets = (struct section_offsets *)
obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
- /* syms_from_objfile kindly subtracts from addr the bfd_section_vma
- of the .text section. This strikes me as wrong--whether the
- offset to be applied to symbol reading is relative to the start
- address of the section depends on the symbol format. In any
- event, this whole "addr" concept is pretty broken (it doesn't
- handle any section but .text sensibly), so just ignore the addr
- parameter and use 0. rs6000-nat.c will set the correct section
- offsets via objfile_relocate. */
- for (i = 0; i < objfile->num_sections; ++i)
- ANOFFSET (section_offsets, i) = 0;
+ /* Initialize the section indexes for future use. */
+ sect = bfd_get_section_by_name (objfile->obfd, ".text");
+ if (sect)
+ objfile->sect_index_text = sect->index;
+
+ sect = bfd_get_section_by_name (objfile->obfd, ".data");
+ if (sect)
+ objfile->sect_index_data = sect->index;
- return section_offsets;
+ sect = bfd_get_section_by_name (objfile->obfd, ".bss");
+ if (sect)
+ objfile->sect_index_bss = sect->index;
+
+ sect = bfd_get_section_by_name (objfile->obfd, ".rodata");
+ if (sect)
+ objfile->sect_index_rodata = sect->index;
+
+ for (i = 0; i < objfile->num_sections; ++i)
+ {
+ /* syms_from_objfile kindly subtracts from addr the
+ bfd_section_vma of the .text section. This strikes me as
+ wrong--whether the offset to be applied to symbol reading is
+ relative to the start address of the section depends on the
+ symbol format. In any event, this whole "addr" concept is
+ pretty broken (it doesn't handle any section but .text
+ sensibly), so just ignore the addr parameter and use 0.
+ rs6000-nat.c will set the correct section offsets via
+ objfile_relocate. */
+ ANOFFSET (objfile->section_offsets, i) = 0;
+ }
}
/* Register our ability to parse symbols for xcoff BFD files. */