34 #include "coff/internal.h"
35 #include "coff/ecoff.h"
38 #include "elf/common.h"
39 #include "elf/internal.h"
71 bfd *abfd = objfile->
obfd;
80 if (!((*ecoff_backend (abfd)->
debug_swap.read_debug_info)
81 (abfd, (asection *) NULL, &ecoff_data (abfd)->
debug_info)))
82 error (
_(
"Error reading symbol table: %s"), bfd_errmsg (bfd_get_error ()));
120 unsigned char st_name[4];
121 unsigned char st_pad[4];
122 unsigned char st_value[8];
123 unsigned char st_size[4];
124 unsigned char st_info[1];
125 unsigned char st_other[1];
126 unsigned char st_shndx[2];
133 unsigned char d_tag[4];
134 unsigned char d_pad[4];
137 unsigned char d_ptr[8];
138 unsigned char d_val[4];
165 if (strcmp (sectp->name,
".dynsym") == 0)
167 else if (strcmp (sectp->name,
".dynstr") == 0)
169 else if (strcmp (sectp->name,
".dynamic") == 0)
171 else if (strcmp (sectp->name,
".got") == 0)
182 bfd *abfd = objfile->
obfd;
186 char *dyninfo_secptr;
188 bfd_size_type sym_secsize;
189 bfd_size_type str_secsize;
190 bfd_size_type dyninfo_secsize;
191 bfd_size_type got_secsize;
198 int got_entry_size = 8;
199 int dt_mips_local_gotno = -1;
200 int dt_mips_gotsym = -1;
204 if (bfd_get_arch (abfd) != bfd_arch_alpha)
208 memset ((
char *) &si, 0,
sizeof (si));
214 sym_secsize = bfd_get_section_size (si.
sym_sect);
215 str_secsize = bfd_get_section_size (si.
str_sect);
216 dyninfo_secsize = bfd_get_section_size (si.
dyninfo_sect);
217 got_secsize = bfd_get_section_size (si.
got_sect);
218 sym_secptr =
xmalloc (sym_secsize);
220 str_secptr =
xmalloc (str_secsize);
222 dyninfo_secptr =
xmalloc (dyninfo_secsize);
224 got_secptr =
xmalloc (got_secsize);
227 if (!bfd_get_section_contents (abfd, si.
sym_sect, sym_secptr,
228 (file_ptr) 0, sym_secsize))
233 if (!bfd_get_section_contents (abfd, si.
str_sect, str_secptr,
234 (file_ptr) 0, str_secsize))
239 if (!bfd_get_section_contents (abfd, si.
dyninfo_sect, dyninfo_secptr,
240 (file_ptr) 0, dyninfo_secsize))
245 if (!bfd_get_section_contents (abfd, si.
got_sect, got_secptr,
246 (file_ptr) 0, got_secsize))
254 for (dyninfo_p = dyninfo_secptr, dyninfo_end = dyninfo_p + dyninfo_secsize;
255 dyninfo_p < dyninfo_end;
261 dyn_tag = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->
d_tag);
262 if (dyn_tag == DT_NULL)
264 else if (dyn_tag == DT_MIPS_LOCAL_GOTNO)
266 if (dt_mips_local_gotno < 0)
268 = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->
d_un.
d_val);
270 else if (dyn_tag == DT_MIPS_GOTSYM)
272 if (dt_mips_gotsym < 0)
274 = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->
d_un.
d_val);
277 if (dt_mips_local_gotno < 0 || dt_mips_gotsym < 0)
286 stripped = (bfd_get_symcount (abfd) == 0);
297 unsigned int sym_shndx;
301 strx = bfd_h_get_32 (abfd, (bfd_byte *) x_symp->
st_name);
302 if (strx >= str_secsize)
304 name = str_secptr + strx;
305 if (*name ==
'\0' || *name ==
'.')
308 sym_value = bfd_h_get_64 (abfd, (bfd_byte *) x_symp->
st_value);
309 sym_info = bfd_h_get_8 (abfd, (bfd_byte *) x_symp->
st_info);
310 sym_shndx = bfd_h_get_16 (abfd, (bfd_byte *) x_symp->
st_shndx);
311 if (sym_shndx >= (SHN_LORESERVE & 0xffff))
312 sym_shndx += SHN_LORESERVE - (SHN_LORESERVE & 0xffff);
313 isglobal = (ELF_ST_BIND (sym_info) == STB_GLOBAL);
315 if (sym_shndx == SHN_UNDEF)
319 if (ELF_ST_TYPE (sym_info) != STT_FUNC
320 || ELF_ST_BIND (sym_info) != STB_GLOBAL)
342 int got_entry_offset =
343 (i - dt_mips_gotsym + dt_mips_local_gotno) * got_entry_size;
345 if (got_entry_offset < 0 || got_entry_offset >= got_secsize)
349 (bfd_byte *) (got_secptr + got_entry_offset));
363 if (sym_shndx == SHN_MIPS_TEXT)
370 else if (sym_shndx == SHN_MIPS_DATA)
377 else if (sym_shndx == SHN_MIPS_ACOMMON)
384 else if (sym_shndx == SHN_ABS)
void stabsread_new_init(void)
union Elfalpha_External_Dyn::@109 d_un
unsigned char st_value[8]
void prim_record_minimal_symbol(const char *name, CORE_ADDR address, enum minimal_symbol_type ms_type, struct objfile *objfile)
void add_symtab_fns(enum bfd_flavour flavour, const struct sym_fns *sf)
struct symfile_segment_data * default_symfile_segments(bfd *abfd)
static void mipscoff_new_init(struct objfile *ignore)
bfd_byte * default_symfile_relocate(struct objfile *objfile, asection *sectp, bfd_byte *buf)
void buildsym_new_init(void)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
static const struct ecoff_debug_swap * debug_swap
static void mipscoff_symfile_init(struct objfile *objfile)
static void mipscoff_symfile_read(struct objfile *objfile, int symfile_flags)
struct cleanup * make_cleanup_discard_minimal_symbols(void)
void init_minimal_symbol_collection(void)
static void mipscoff_symfile_finish(struct objfile *objfile)
static struct ecoff_debug_info * debug_info
const struct quick_symbol_functions psym_functions
void default_symfile_offsets(struct objfile *objfile, const struct section_addr_info *addrs)
void mdebug_build_psymtabs(struct objfile *objfile, const struct ecoff_debug_swap *swap, struct ecoff_debug_info *info)
static void read_alphacoff_dynamic_symtab(struct section_offsets *, struct objfile *objfile)
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
unsigned char st_shndx[2]
struct section_offsets * section_offsets
void install_minimal_symbols(struct objfile *objfile)
void error(const char *fmt,...)
static void sym_info(char *arg, int from_tty)
void _initialize_mipsread(void)
void do_cleanups(struct cleanup *old_chain)
static void alphacoff_locate_sections(bfd *ignore_abfd, asection *sectp, void *sip)