address = gdbarch_addr_bits_remove (gdbarch, address);
return prim_record_minimal_symbol_full (name, name_len, copy_name, address,
- ms_type, bfd_section->index,
- bfd_section, objfile);
+ ms_type,
+ gdb_bfd_section_index (objfile->obfd,
+ bfd_section),
+ objfile);
}
/* Read the symbol table of an ELF file.
continue;
}
- offset = ANOFFSET (objfile->section_offsets, sym->section->index);
+ offset = ANOFFSET (objfile->section_offsets,
+ gdb_bfd_section_index (objfile->obfd, sym->section));
if (type == ST_DYNAMIC
&& sym->section == bfd_und_section_ptr
&& (sym->flags & BSF_FUNCTION))
&& bfd_get_section_by_name (abfd, ".plt") != NULL)
continue;
- symaddr += ANOFFSET (objfile->section_offsets, sect->index);
+ symaddr += ANOFFSET (objfile->section_offsets,
+ gdb_bfd_section_index (objfile->obfd, sect));
msym = record_minimal_symbol
(sym->name, strlen (sym->name), copy_names,
}
else if (sym->flags & BSF_SECTION_SYM)
continue;
- else if (sym->flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK))
+ else if (sym->flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK
+ | BSF_GNU_UNIQUE))
{
struct minimal_symbol *msym;
}
else if (sym->section->flags & SEC_CODE)
{
- if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
+ if (sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE))
{
if (sym->flags & BSF_GNU_INDIRECT_FUNCTION)
ms_type = mst_text_gnu_ifunc;
}
else if (sym->section->flags & SEC_ALLOC)
{
- if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
+ if (sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE))
{
if (sym->section->flags & SEC_LOAD)
{
gdbarch_elf_make_msymbol_special (gdbarch, sym, msym);
}
+ /* If we see a default versioned symbol, install it under
+ its version-less name. */
+ if (msym != NULL)
+ {
+ const char *atsign = strchr (sym->name, '@');
+
+ if (atsign != NULL && atsign[1] == '@' && atsign > sym->name)
+ {
+ int len = atsign - sym->name;
+
+ record_minimal_symbol (sym->name, len, 1, symaddr,
+ ms_type, sym->section, objfile);
+ }
+ }
+
/* For @plt symbols, also record a trampoline to the
destination symbol. The @plt symbol will be used in
disassembly, and the trampoline will be used when we are
static int
elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
{
- struct minimal_symbol *msym;
+ struct bound_minimal_symbol msym;
asection *sect;
struct objfile *objfile;
htab_t htab;
void **slot;
msym = lookup_minimal_symbol_by_pc (addr);
- if (msym == NULL)
+ if (msym.minsym == NULL)
return 0;
- if (SYMBOL_VALUE_ADDRESS (msym) != addr)
+ if (SYMBOL_VALUE_ADDRESS (msym.minsym) != addr)
return 0;
/* minimal symbols have always SYMBOL_OBJ_SECTION non-NULL. */
- sect = SYMBOL_OBJ_SECTION (msym)->the_bfd_section;
- objfile = SYMBOL_OBJ_SECTION (msym)->objfile;
+ sect = SYMBOL_OBJ_SECTION (msym.objfile, msym.minsym)->the_bfd_section;
+ objfile = msym.objfile;
/* If .plt jumps back to .plt the symbol is still deferred for later
resolution and it has no use for GDB. Besides ".text" this symbol can
return probe->pops->get_probe_argument_count (probe);
}
+/* Implementation of `sym_can_evaluate_probe_arguments', as documented in
+ symfile.h. */
+
+static int
+elf_can_evaluate_probe_arguments (struct probe *probe)
+{
+ return probe->pops->can_evaluate_probe_arguments (probe);
+}
+
/* Implementation of `sym_evaluate_probe_argument', as documented in
symfile.h. */
static void
elf_symfile_relocate_probe (struct objfile *objfile,
- struct section_offsets *new_offsets,
- struct section_offsets *delta)
+ const struct section_offsets *new_offsets,
+ const struct section_offsets *delta)
{
int ix;
VEC (probe_p) *probes = objfile_data (objfile, probe_key);
static const struct sym_probe_fns elf_probe_fns =
{
- elf_get_probes, /* sym_get_probes */
- elf_get_probe_argument_count, /* sym_get_probe_argument_count */
- elf_evaluate_probe_argument, /* sym_evaluate_probe_argument */
- elf_compile_to_ax, /* sym_compile_to_ax */
- elf_symfile_relocate_probe, /* sym_relocate_probe */
+ elf_get_probes, /* sym_get_probes */
+ elf_get_probe_argument_count, /* sym_get_probe_argument_count */
+ elf_can_evaluate_probe_arguments, /* sym_can_evaluate_probe_arguments */
+ elf_evaluate_probe_argument, /* sym_evaluate_probe_argument */
+ elf_compile_to_ax, /* sym_compile_to_ax */
+ elf_symfile_relocate_probe, /* sym_relocate_probe */
};
/* Register that we are able to handle ELF object file formats. */