* elfread.c (elf_symtab_read): Create trampolines for @plt symbols.

* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Renamed from
	lookup_minimal_symbol_by_pc_section.  Prefer trampolines if requested.
	(lookup_minimal_symbol_by_pc_section): Use
	lookup_minimal_symbol_by_pc_section_1.
	(lookup_solib_trampoline_symbol_by_pc): Likewise.
This commit is contained in:
Daniel Jacobowitz
2008-05-14 18:14:34 +00:00
parent 86a4952b14
commit 2eaf8d2a14
3 changed files with 79 additions and 4 deletions

View File

@ -521,6 +521,33 @@ elf_symtab_read (struct objfile *objfile, int type,
if (msym != NULL)
msym->filename = filesymname;
gdbarch_elf_make_msymbol_special (gdbarch, sym, msym);
/* 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
trying to find the target. */
if (msym && ms_type == mst_text && type == ST_SYNTHETIC)
{
int len = strlen (sym->name);
if (len > 4 && strcmp (sym->name + len - 4, "@plt") == 0)
{
char *base_name = alloca (len - 4 + 1);
struct minimal_symbol *mtramp;
memcpy (base_name, sym->name, len - 4);
base_name[len - 4] = '\0';
mtramp = record_minimal_symbol (base_name, symaddr,
mst_solib_trampoline,
sym->section, objfile);
if (mtramp)
{
MSYMBOL_SIZE (mtramp) = MSYMBOL_SIZE (msym);
mtramp->filename = filesymname;
gdbarch_elf_make_msymbol_special (gdbarch, sym, mtramp);
}
}
}
}
}
}