* elf64-ppc.c (ppc64_elf_relocate_section): Force tail calls in
authorAlan Modra <amodra@gmail.com>
Tue, 13 Dec 2005 05:39:34 +0000 (05:39 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 13 Dec 2005 05:39:34 +0000 (05:39 +0000)
shared libs to resolve locally.

bfd/ChangeLog
bfd/elf64-ppc.c

index cf86df406aec8731e782c4e1ac1b0b2e3ce7d257..f7ed00ac08d1b4f159af23dd820b51aaa412ae9f 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-13  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-ppc.c (ppc64_elf_relocate_section): Force tail calls in
+       shared libs to resolve locally.
+
 2005-12-12  Paul Brook  <paul@codesourcery.com>
 
        * bfd-in2.h: Regenerate.
index b72c6bd143dfd4b70be8f647e1242f4b3a25d1df..da1550ea69f3fcab93e7e3eda4c825c7a0fd9b45 100644 (file)
@@ -10070,10 +10070,12 @@ ppc64_elf_relocate_section (bfd *output_bfd,
                  if (stub_entry->stub_type == ppc_stub_plt_call)
                    {
                      /* If this is a plain branch rather than a branch
-                        and link, don't require a nop.  */
+                        and link, don't require a nop.  However, don't
+                        allow tail calls in a shared library as they
+                        will result in r2 being corrupted.  */
                      unsigned long br;
                      br = bfd_get_32 (input_bfd, contents + rel->r_offset);
-                     if ((br & 1) == 0)
+                     if (info->executable && (br & 1) == 0)
                        can_plt_call = TRUE;
                      else
                        stub_entry = NULL;