PR11375, powerpc64 segfault in call_gmon_start
Alan Modra
amodra@gmail.com
Fri Mar 12 22:46:00 GMT 2010
My 2009-09-18 change to ppc64_elf_relocate_section broke linking of
large old-style dot-symbol binaries. If they happened to need toc
adjusting stubs to support multiple toc sections, the lookup in
relocate_section failed to match the stub created. (The lookup used
the function descriptor symbol but the stub was created with the
entry dot-symbol.) This meant you'd get a call that used the wrong
toc pointer, usually causing a crash at startup in call_gmon_start.
PR ld/11375
* elf64-ppc.c (ppc_type_of_stub): Always set *hash to the
function descriptor symbol if there is one, not just for plt stubs.
(ppc64_elf_relocate_section): Use fdh on all ppc_get_stub_entry calls.
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.319
diff -u -p -r1.319 elf64-ppc.c
--- bfd/elf64-ppc.c 19 Feb 2010 05:07:49 -0000 1.319
+++ bfd/elf64-ppc.c 12 Mar 2010 22:26:32 -0000
@@ -8976,13 +8976,15 @@ ppc_type_of_stub (asection *input_sec,
struct ppc_link_hash_entry *fdh = h;
if (h->oh != NULL
&& h->oh->is_func_descriptor)
- fdh = ppc_follow_link (h->oh);
+ {
+ fdh = ppc_follow_link (h->oh);
+ *hash = fdh;
+ }
for (ent = fdh->elf.plt.plist; ent != NULL; ent = ent->next)
if (ent->addend == rel->r_addend
&& ent->plt.offset != (bfd_vma) -1)
{
- *hash = fdh;
*plt_ent = ent;
return ppc_stub_plt_call;
}
@@ -11933,7 +11935,7 @@ ppc64_elf_relocate_section (bfd *output_
>= 2 * max_br_offset)
&& r_type != R_PPC64_ADDR14_BRTAKEN
&& r_type != R_PPC64_ADDR14_BRNTAKEN)
- stub_entry = ppc_get_stub_entry (input_section, sec, h, rel,
+ stub_entry = ppc_get_stub_entry (input_section, sec, fdh, rel,
htab);
if (stub_entry != NULL)
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list