* elf64-ppc.c (toc_adjusting_stub_needed): Any call via the plt

needs r2 valid, not just those to external syms.
This commit is contained in:
Alan Modra 2008-08-11 14:38:40 +00:00
parent 818236e51d
commit 90aecf7a80
2 changed files with 18 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2008-08-11 Alan Modra <amodra@bigpond.net.au>
* elf64-ppc.c (toc_adjusting_stub_needed): Any call via the plt
needs r2 valid, not just those to external syms.
2008-08-09 Pedro Alves <pedro@codesourcery.com> 2008-08-09 Pedro Alves <pedro@codesourcery.com>
* archive.c (_bfd_archive_bsd_update_armap_timestamp): Cast stat * archive.c (_bfd_archive_bsd_update_armap_timestamp): Cast stat

View File

@ -9184,6 +9184,7 @@ toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec)
enum elf_ppc64_reloc_type r_type; enum elf_ppc64_reloc_type r_type;
unsigned long r_symndx; unsigned long r_symndx;
struct elf_link_hash_entry *h; struct elf_link_hash_entry *h;
struct ppc_link_hash_entry *eh;
Elf_Internal_Sym *sym; Elf_Internal_Sym *sym;
asection *sym_sec; asection *sym_sec;
struct _opd_sec_data *opd; struct _opd_sec_data *opd;
@ -9206,24 +9207,21 @@ toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec)
} }
/* Calls to dynamic lib functions go through a plt call stub /* Calls to dynamic lib functions go through a plt call stub
that uses r2. Branches to undefined symbols might be a call that uses r2. */
using old-style dot symbols that can be satisfied by a plt eh = (struct ppc_link_hash_entry *) h;
call into a new-style dynamic library. */ if (eh != NULL
if (sym_sec == NULL) && (eh->elf.plt.plist != NULL
|| (eh->oh != NULL
&& eh->oh->elf.plt.plist != NULL)))
{ {
struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) h; ret = 1;
if (eh != NULL break;
&& eh->oh != NULL
&& eh->oh->elf.plt.plist != NULL)
{
ret = 1;
break;
}
/* Ignore other undefined symbols. */
continue;
} }
if (sym_sec == NULL)
/* Ignore other undefined symbols. */
continue;
/* Assume branches to other sections not included in the link need /* Assume branches to other sections not included in the link need
stubs too, to cover -R and absolute syms. */ stubs too, to cover -R and absolute syms. */
if (sym_sec->output_section == NULL) if (sym_sec->output_section == NULL)