From 4fa1c2377aada42a2ecf3c3d16e1a3867fdd3d74 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 13 Dec 2005 05:39:34 +0000 Subject: [PATCH] * elf64-ppc.c (ppc64_elf_relocate_section): Force tail calls in shared libs to resolve locally. --- bfd/ChangeLog | 5 +++++ bfd/elf64-ppc.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cf86df406ae..f7ed00ac08d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2005-12-13 Alan Modra + + * elf64-ppc.c (ppc64_elf_relocate_section): Force tail calls in + shared libs to resolve locally. + 2005-12-12 Paul Brook * bfd-in2.h: Regenerate. diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index b72c6bd143d..da1550ea69f 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -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; -- 2.30.2