This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PR 13894, ppc64 objdump -S segfault
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Cc: Russo John-RTCW50 <RTCW50 at freescale dot com>
- Date: Fri, 23 Mar 2012 17:10:19 +1030
- Subject: PR 13894, ppc64 objdump -S segfault
PowerPC64 -mcall-aixdesc object files or those produced by old versions
of gcc can reference global symbols from OPD entries. My 2012-01-23
patch http://sourceware.org/ml/binutils/2012-01/msg00232.html to
better support bfd_find_nearest_line on powerpc64 introduced a call
to opd_entry_value via elf_find_function. opd_entry_value therefore
needs to handle object files opened by objdump -S rather than just
those opened by the linker, and in particular needs to handle global
symbols when elf_sym_hashes is NULL.
PR binutils/13894
* elf64-ppc.c (opd_entry_value): Read full symbol table when
sym hashes unavailable.
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.377
diff -u -p -r1.377 elf64-ppc.c
--- bfd/elf64-ppc.c 13 Mar 2012 06:04:35 -0000 1.377
+++ bfd/elf64-ppc.c 23 Mar 2012 04:32:09 -0000
@@ -5585,15 +5585,18 @@ opd_entry_value (asection *opd_sec,
unsigned long symndx = ELF64_R_SYM (look->r_info);
asection *sec;
- if (symndx < symtab_hdr->sh_info)
+ if (symndx < symtab_hdr->sh_info
+ || elf_sym_hashes (opd_bfd) == NULL)
{
Elf_Internal_Sym *sym;
sym = (Elf_Internal_Sym *) symtab_hdr->contents;
if (sym == NULL)
{
- sym = bfd_elf_get_elf_syms (opd_bfd, symtab_hdr,
- symtab_hdr->sh_info,
+ size_t symcnt = symtab_hdr->sh_info;
+ if (elf_sym_hashes (opd_bfd) == NULL)
+ symcnt = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
+ sym = bfd_elf_get_elf_syms (opd_bfd, symtab_hdr, symcnt,
0, NULL, NULL, NULL);
if (sym == NULL)
break;
--
Alan Modra
Australia Development Lab, IBM