From: Alan Modra Date: Fri, 22 Feb 2013 23:24:24 +0000 (+0000) Subject: * elfread.c (elf_symtab_read): Do not use udata.p here to find X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=24c274a1338fdc8295f85a2a4854cfa80a1712da;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d853da03273..322762f267f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2013-02-23 Alan Modra + + * 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 Code cleanup. diff --git a/gdb/elfread.c b/gdb/elfread.c index 4b9562715cb..43c32b2c63e 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -556,21 +556,14 @@ elf_symtab_read (struct objfile *objfile, int type, 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 - ELF-private part. However, in some cases (e.g. synthetic - '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. */ + ELF-private part. */ if (type != ST_SYNTHETIC) - elf_sym = (elf_symbol_type *) sym; - else - elf_sym = (elf_symbol_type *) sym->udata.p; - - if (elf_sym) - SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size); + { + /* Pass symbol size field in via BFD. FIXME!!! */ + elf_symbol_type *elf_sym = (elf_symbol_type *) sym; + SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size); + } msym->filename = filesymname; gdbarch_elf_make_msymbol_special (gdbarch, sym, msym); diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 7c2712d9a78..0fc6fe03b9c 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1336,6 +1336,9 @@ ppc_linux_init_abi (struct gdbarch_info info, set_gdbarch_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. */ set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code); set_solib_svr4_fetch_link_map_offsets diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c index 9c3616a1a27..f636b4d450b 100644 --- a/gdb/ppc64-tdep.c +++ b/gdb/ppc64-tdep.c @@ -22,6 +22,7 @@ #include "gdbcore.h" #include "ppc-tdep.h" #include "ppc64-tdep.h" +#include "elf-bfd.h" /* Macros for matching instructions. Note that, since all the 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; } + +/* 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); + } +} diff --git a/gdb/ppc64-tdep.h b/gdb/ppc64-tdep.h index c4c9d99455a..62900bab5ee 100644 --- a/gdb/ppc64-tdep.h +++ b/gdb/ppc64-tdep.h @@ -31,4 +31,6 @@ extern CORE_ADDR ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ); +extern void ppc64_elf_make_msymbol_special (asymbol *, + struct minimal_symbol *); #endif /* PPC64_TDEP_H */ diff --git a/gdb/ppcfbsd-tdep.c b/gdb/ppcfbsd-tdep.c index f18ed4fa757..f9e04341534 100644 --- a/gdb/ppcfbsd-tdep.c +++ b/gdb/ppcfbsd-tdep.c @@ -325,6 +325,9 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { set_gdbarch_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_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_lp64_fetch_link_map_offsets);