diff options
author | Alan Modra <amodra@gmail.com> | 2013-05-06 09:32:55 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2013-05-06 09:32:55 +0000 |
commit | 128205bb36e521955248a7ab895bd3e79e4f58d5 (patch) | |
tree | e60b74f774a00799a8876c4944786f219a5ed0f0 | |
parent | f45794cb5190f2c5a467996070bb0e941c314074 (diff) | |
download | gdb-128205bb36e521955248a7ab895bd3e79e4f58d5.zip gdb-128205bb36e521955248a7ab895bd3e79e4f58d5.tar.gz gdb-128205bb36e521955248a7ab895bd3e79e4f58d5.tar.bz2 |
* elf64-ppc.c (opd_entry_value): Handle case where symbol
hashes are not available.
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 29 |
2 files changed, 29 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0434e70..8e2308e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ 2013-05-06 Alan Modra <amodra@gmail.com> + * elf64-ppc.c (opd_entry_value): Handle case where symbol + hashes are not available. + +2013-05-06 Alan Modra <amodra@gmail.com> + * elflink.c (elf_link_add_object_symbols): Don't save symbol hashes around loading as-needed library. Zero them on allocation, and restore to initial all-zero state if library not needed. diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index cb33821..d4415e4 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -5665,11 +5665,30 @@ opd_entry_value (asection *opd_sec, sym_hashes = elf_sym_hashes (opd_bfd); rh = sym_hashes[symndx - symtab_hdr->sh_info]; - rh = elf_follow_link (rh); - BFD_ASSERT (rh->root.type == bfd_link_hash_defined - || rh->root.type == bfd_link_hash_defweak); - val = rh->root.u.def.value; - sec = rh->root.u.def.section; + if (rh != NULL) + { + rh = elf_follow_link (rh); + BFD_ASSERT (rh->root.type == bfd_link_hash_defined + || rh->root.type == bfd_link_hash_defweak); + val = rh->root.u.def.value; + sec = rh->root.u.def.section; + } + else + { + /* Handle the odd case where we can be called + during bfd_elf_link_add_symbols before the + symbol hashes have been fully populated. */ + Elf_Internal_Sym *sym; + + sym = bfd_elf_get_elf_syms (opd_bfd, symtab_hdr, 1, + symndx, NULL, NULL, NULL); + if (sym == NULL) + break; + + val = sym->st_value; + sec = bfd_section_from_elf_index (opd_bfd, sym->st_shndx); + free (sym); + } } val += look->r_addend; if (code_off != NULL) |