34#include "coff/internal.h"
35#include "coff/ecoff.h"
38#include "elf/common.h"
39#include "elf/internal.h"
77 if (!((*ecoff_backend (abfd)->
debug_swap.read_debug_info)
79 error (_(
"Error reading symbol table: %s"), bfd_errmsg (bfd_get_error ()));
116 unsigned char st_name[4];
117 unsigned char st_pad[4];
118 unsigned char st_value[8];
119 unsigned char st_size[4];
120 unsigned char st_info[1];
121 unsigned char st_other[1];
122 unsigned char st_shndx[2];
129 unsigned char d_tag[4];
130 unsigned char d_pad[4];
133 unsigned char d_ptr[8];
134 unsigned char d_val[4];
161 if (strcmp (sectp->name,
".dynsym") == 0)
163 else if (strcmp (sectp->name,
".dynstr") == 0)
165 else if (strcmp (sectp->name,
".dynamic") == 0)
167 else if (strcmp (sectp->name,
".got") == 0)
185 gdb_byte *dyninfo_end;
186 int got_entry_size = 8;
187 int dt_mips_local_gotno = -1;
188 int dt_mips_gotsym = -1;
191 if (bfd_get_arch (abfd) != bfd_arch_alpha)
195 memset ((
char *) &si, 0,
sizeof (si));
201 gdb::byte_vector sym_sec (bfd_section_size (si.
sym_sect));
202 gdb::byte_vector str_sec (bfd_section_size (si.
str_sect));
203 gdb::byte_vector dyninfo_sec (bfd_section_size (si.
dyninfo_sect));
204 gdb::byte_vector got_sec (bfd_section_size (si.
got_sect));
206 if (!bfd_get_section_contents (abfd, si.
sym_sect, sym_sec.data (),
207 (file_ptr) 0, sym_sec.size ()))
209 if (!bfd_get_section_contents (abfd, si.
str_sect, str_sec.data (),
210 (file_ptr) 0, str_sec.size ()))
212 if (!bfd_get_section_contents (abfd, si.
dyninfo_sect, dyninfo_sec.data (),
213 (file_ptr) 0, dyninfo_sec.size ()))
215 if (!bfd_get_section_contents (abfd, si.
got_sect, got_sec.data (),
216 (file_ptr) 0, got_sec.size ()))
221 for ((dyninfo_p = dyninfo_sec.data (),
222 dyninfo_end = dyninfo_p + dyninfo_sec.size ());
223 dyninfo_p < dyninfo_end;
229 dyn_tag = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->
d_tag);
230 if (dyn_tag == DT_NULL)
232 else if (dyn_tag == DT_MIPS_LOCAL_GOTNO)
234 if (dt_mips_local_gotno < 0)
236 = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->
d_un.
d_val);
238 else if (dyn_tag == DT_MIPS_GOTSYM)
240 if (dt_mips_gotsym < 0)
242 = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->
d_un.
d_val);
245 if (dt_mips_local_gotno < 0 || dt_mips_gotsym < 0)
251 stripped = (bfd_get_symcount (abfd) == 0);
261 unsigned char sym_info;
262 unsigned int sym_shndx;
266 strx = bfd_h_get_32 (abfd, (bfd_byte *) x_symp->
st_name);
267 if (strx >= str_sec.size ())
269 name = (
char *) (str_sec.data () + strx);
273 sym_value = bfd_h_get_64 (abfd, (bfd_byte *) x_symp->
st_value);
274 sym_info = bfd_h_get_8 (abfd, (bfd_byte *) x_symp->
st_info);
275 sym_shndx = bfd_h_get_16 (abfd, (bfd_byte *) x_symp->
st_shndx);
276 if (sym_shndx >= (SHN_LORESERVE & 0xffff))
277 sym_shndx += SHN_LORESERVE - (SHN_LORESERVE & 0xffff);
278 isglobal = (ELF_ST_BIND (sym_info) == STB_GLOBAL);
280 if (sym_shndx == SHN_UNDEF)
284 if (ELF_ST_TYPE (sym_info) != STT_FUNC
285 || ELF_ST_BIND (sym_info) != STB_GLOBAL)
307 int got_entry_offset =
308 (i - dt_mips_gotsym + dt_mips_local_gotno) * got_entry_size;
310 if (got_entry_offset < 0
311 || got_entry_offset >= got_sec.size ())
315 (bfd_byte *) (got_sec.data ()
316 + got_entry_offset));
330 if (sym_shndx == SHN_MIPS_TEXT)
337 else if (sym_shndx == SHN_MIPS_DATA)
344 else if (sym_shndx == SHN_MIPS_ACOMMON)
351 else if (sym_shndx == SHN_ABS)
void record(const char *name, CORE_ADDR address, enum minimal_symbol_type ms_type)
static struct ecoff_debug_info * debug_info
static const struct ecoff_debug_swap * debug_swap
void mdebug_build_psymtabs(minimal_symbol_reader &reader, struct objfile *objfile, const struct ecoff_debug_swap *swap, struct ecoff_debug_info *info)
static void mipscoff_new_init(struct objfile *ignore)
static void mipscoff_symfile_init(struct objfile *objfile)
void _initialize_mipsread()
static void alphacoff_locate_sections(bfd *ignore_abfd, asection *sectp, void *sip)
static void mipscoff_symfile_read(struct objfile *objfile, symfile_add_flags symfile_flags)
static void mipscoff_symfile_finish(struct objfile *objfile)
static const struct sym_fns ecoff_sym_fns
static void read_alphacoff_dynamic_symtab(minimal_symbol_reader &, struct objfile *objfile)
void stabsread_new_init(void)
union Elfalpha_External_Dyn::@97 d_un
unsigned char st_shndx[2]
unsigned char st_value[8]
void add_symtab_fns(enum bfd_flavour flavour, const struct sym_fns *sf)
void default_symfile_offsets(struct objfile *objfile, const section_addr_info &addrs)
symfile_segment_data_up default_symfile_segments(bfd *abfd)
bfd_byte * default_symfile_relocate(struct objfile *objfile, asection *sectp, bfd_byte *buf)