34 #include "coff/internal.h" 35 #include "coff/ecoff.h" 38 #include "elf/common.h" 39 #include "elf/internal.h" 79 if (!((*ecoff_backend (abfd)->
debug_swap.read_debug_info)
80 (abfd, (asection *) NULL, &ecoff_data (abfd)->
debug_info)))
81 error (
_(
"Error reading symbol table: %s"), bfd_errmsg (bfd_get_error ()));
118 unsigned char st_name[4];
119 unsigned char st_pad[4];
120 unsigned char st_value[8];
121 unsigned char st_size[4];
122 unsigned char st_info[1];
123 unsigned char st_other[1];
124 unsigned char st_shndx[2];
131 unsigned char d_tag[4];
132 unsigned char d_pad[4];
135 unsigned char d_ptr[8];
136 unsigned char d_val[4];
163 if (strcmp (sectp->name,
".dynsym") == 0)
165 else if (strcmp (sectp->name,
".dynstr") == 0)
167 else if (strcmp (sectp->name,
".dynamic") == 0)
169 else if (strcmp (sectp->name,
".got") == 0)
185 char *dyninfo_secptr;
187 bfd_size_type sym_secsize;
188 bfd_size_type str_secsize;
189 bfd_size_type dyninfo_secsize;
190 bfd_size_type got_secsize;
197 int got_entry_size = 8;
198 int dt_mips_local_gotno = -1;
199 int dt_mips_gotsym = -1;
203 if (bfd_get_arch (abfd) != bfd_arch_alpha)
207 memset ((
char *) &si, 0,
sizeof (si));
209 if (si.sym_sect == NULL || si.str_sect == NULL
210 || si.dyninfo_sect == NULL || si.got_sect == NULL)
213 sym_secsize = bfd_get_section_size (si.sym_sect);
214 str_secsize = bfd_get_section_size (si.str_sect);
215 dyninfo_secsize = bfd_get_section_size (si.dyninfo_sect);
216 got_secsize = bfd_get_section_size (si.got_sect);
217 sym_secptr = (
char *)
xmalloc (sym_secsize);
219 str_secptr = (
char *)
xmalloc (str_secsize);
221 dyninfo_secptr = (
char *)
xmalloc (dyninfo_secsize);
223 got_secptr = (
char *)
xmalloc (got_secsize);
226 if (!bfd_get_section_contents (abfd, si.sym_sect, sym_secptr,
227 (file_ptr) 0, sym_secsize))
232 if (!bfd_get_section_contents (abfd, si.str_sect, str_secptr,
233 (file_ptr) 0, str_secsize))
238 if (!bfd_get_section_contents (abfd, si.dyninfo_sect, dyninfo_secptr,
239 (file_ptr) 0, dyninfo_secsize))
244 if (!bfd_get_section_contents (abfd, si.got_sect, got_secptr,
245 (file_ptr) 0, got_secsize))
253 for (dyninfo_p = dyninfo_secptr, dyninfo_end = dyninfo_p + dyninfo_secsize;
254 dyninfo_p < dyninfo_end;
260 dyn_tag = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->
d_tag);
261 if (dyn_tag == DT_NULL)
263 else if (dyn_tag == DT_MIPS_LOCAL_GOTNO)
265 if (dt_mips_local_gotno < 0)
267 = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->
d_un.
d_val);
269 else if (dyn_tag == DT_MIPS_GOTSYM)
271 if (dt_mips_gotsym < 0)
273 = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->
d_un.
d_val);
276 if (dt_mips_local_gotno < 0 || dt_mips_gotsym < 0)
285 stripped = (bfd_get_symcount (abfd) == 0);
295 unsigned char sym_info;
296 unsigned int sym_shndx;
300 strx = bfd_h_get_32 (abfd, (bfd_byte *) x_symp->
st_name);
301 if (strx >= str_secsize)
303 name = str_secptr + strx;
307 sym_value = bfd_h_get_64 (abfd, (bfd_byte *) x_symp->
st_value);
308 sym_info = bfd_h_get_8 (abfd, (bfd_byte *) x_symp->
st_info);
309 sym_shndx = bfd_h_get_16 (abfd, (bfd_byte *) x_symp->
st_shndx);
310 if (sym_shndx >= (SHN_LORESERVE & 0xffff))
311 sym_shndx += SHN_LORESERVE - (SHN_LORESERVE & 0xffff);
312 isglobal = (ELF_ST_BIND (sym_info) == STB_GLOBAL);
314 if (sym_shndx == SHN_UNDEF)
318 if (ELF_ST_TYPE (sym_info) != STT_FUNC
319 || ELF_ST_BIND (sym_info) != STB_GLOBAL)
341 int got_entry_offset =
342 (i - dt_mips_gotsym + dt_mips_local_gotno) * got_entry_size;
344 if (got_entry_offset < 0 || got_entry_offset >= got_secsize)
348 (bfd_byte *) (got_secptr + got_entry_offset));
362 if (sym_shndx == SHN_MIPS_TEXT)
369 else if (sym_shndx == SHN_MIPS_DATA)
376 else if (sym_shndx == SHN_MIPS_ACOMMON)
383 else if (sym_shndx == SHN_ABS)
void stabsread_new_init(void)
void record(const char *name, CORE_ADDR address, enum minimal_symbol_type ms_type)
unsigned char st_value[8]
void * memset(T *s, int c, size_t n)=delete
void add_symtab_fns(enum bfd_flavour flavour, const struct sym_fns *sf)
struct symfile_segment_data * default_symfile_segments(bfd *abfd)
static void read_alphacoff_dynamic_symtab(minimal_symbol_reader &, struct section_offsets *, struct objfile *objfile)
void mdebug_build_psymtabs(minimal_symbol_reader &reader, struct objfile *objfile, const struct ecoff_debug_swap *swap, struct ecoff_debug_info *info)
static const struct sym_fns ecoff_sym_fns
static void mipscoff_new_init(struct objfile *ignore)
bfd_byte * default_symfile_relocate(struct objfile *objfile, asection *sectp, bfd_byte *buf)
union Elfalpha_External_Dyn::@96 d_un
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, symfile_add_flags symfile_flags)
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)
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 error(const char *fmt,...)
void _initialize_mipsread(void)
void do_cleanups(struct cleanup *old_chain)
static void alphacoff_locate_sections(bfd *ignore_abfd, asection *sectp, void *sip)