* elfread.c (elf_symtab_read): Do not use udata.p here to find

symbol size.
	* ppc64-tdep.c (ppc64_elf_make_msymbol_special): New function.
	* ppc64-tdep.h (ppc64_elf_make_msymbol_special): Declare.
	* ppc-linux-tdep.c (ppc_linux_init_abi): Set up to use the above.
	* ppcfbsd-tdep.c (ppcfbsd_init_abi): Likewise.
This commit is contained in:
Alan Modra 2013-02-22 23:24:24 +00:00
parent d38b600c90
commit 24c274a133
6 changed files with 38 additions and 13 deletions

View File

@ -1,3 +1,12 @@
2013-02-23 Alan Modra <amodra@gmail.com>
* elfread.c (elf_symtab_read): Do not use udata.p here to find
symbol size.
* ppc64-tdep.c (ppc64_elf_make_msymbol_special): New function.
* ppc64-tdep.h (ppc64_elf_make_msymbol_special): Declare.
* ppc-linux-tdep.c (ppc_linux_init_abi): Set up to use the above.
* ppcfbsd-tdep.c (ppcfbsd_init_abi): Likewise.
2013-02-22 Jan Kratochvil <jan.kratochvil@redhat.com> 2013-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup. Code cleanup.

View File

@ -556,21 +556,14 @@ elf_symtab_read (struct objfile *objfile, int type,
if (msym) if (msym)
{ {
/* Pass symbol size field in via BFD. FIXME!!! */
elf_symbol_type *elf_sym;
/* NOTE: uweigand-20071112: A synthetic symbol does not have an /* NOTE: uweigand-20071112: A synthetic symbol does not have an
ELF-private part. However, in some cases (e.g. synthetic ELF-private part. */
'dot' symbols on ppc64) the udata.p entry is set to point back
to the original ELF symbol it was derived from. Get the size
from that symbol. */
if (type != ST_SYNTHETIC) if (type != ST_SYNTHETIC)
elf_sym = (elf_symbol_type *) sym; {
else /* Pass symbol size field in via BFD. FIXME!!! */
elf_sym = (elf_symbol_type *) sym->udata.p; elf_symbol_type *elf_sym = (elf_symbol_type *) sym;
SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size);
if (elf_sym) }
SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size);
msym->filename = filesymname; msym->filename = filesymname;
gdbarch_elf_make_msymbol_special (gdbarch, sym, msym); gdbarch_elf_make_msymbol_special (gdbarch, sym, msym);

View File

@ -1336,6 +1336,9 @@ ppc_linux_init_abi (struct gdbarch_info info,
set_gdbarch_convert_from_func_ptr_addr set_gdbarch_convert_from_func_ptr_addr
(gdbarch, ppc64_convert_from_func_ptr_addr); (gdbarch, ppc64_convert_from_func_ptr_addr);
set_gdbarch_elf_make_msymbol_special (gdbarch,
ppc64_elf_make_msymbol_special);
/* Shared library handling. */ /* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code); set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
set_solib_svr4_fetch_link_map_offsets set_solib_svr4_fetch_link_map_offsets

View File

@ -22,6 +22,7 @@
#include "gdbcore.h" #include "gdbcore.h"
#include "ppc-tdep.h" #include "ppc-tdep.h"
#include "ppc64-tdep.h" #include "ppc64-tdep.h"
#include "elf-bfd.h"
/* Macros for matching instructions. Note that, since all the /* Macros for matching instructions. Note that, since all the
operands are masked off before they're or-ed into the instruction, operands are masked off before they're or-ed into the instruction,
@ -361,3 +362,17 @@ ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
return addr; return addr;
} }
/* A synthetic 'dot' symbols on ppc64 has the udata.p entry pointing
back to the original ELF symbol it was derived from. Get the size
from that symbol. */
void
ppc64_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
{
if ((sym->flags & BSF_SYNTHETIC) != 0 && sym->udata.p != NULL)
{
elf_symbol_type *elf_sym = (elf_symbol_type *) sym->udata.p;
SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size);
}
}

View File

@ -31,4 +31,6 @@ extern CORE_ADDR ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
CORE_ADDR addr, CORE_ADDR addr,
struct target_ops *targ); struct target_ops *targ);
extern void ppc64_elf_make_msymbol_special (asymbol *,
struct minimal_symbol *);
#endif /* PPC64_TDEP_H */ #endif /* PPC64_TDEP_H */

View File

@ -325,6 +325,9 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{ {
set_gdbarch_convert_from_func_ptr_addr set_gdbarch_convert_from_func_ptr_addr
(gdbarch, ppc64_convert_from_func_ptr_addr); (gdbarch, ppc64_convert_from_func_ptr_addr);
set_gdbarch_elf_make_msymbol_special (gdbarch,
ppc64_elf_make_msymbol_special);
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code); set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
set_solib_svr4_fetch_link_map_offsets (gdbarch, set_solib_svr4_fetch_link_map_offsets (gdbarch,
svr4_lp64_fetch_link_map_offsets); svr4_lp64_fetch_link_map_offsets);