summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2011-08-14 09:17:16 +0000
committerAlan Modra <amodra@bigpond.net.au>2011-08-14 09:17:16 +0000
commit906950a50d19e469f6b97a613e540d6caae25247 (patch)
tree3b16ffd225b00f8003c6969b9b340c388a14994a
parent4d56b6f9d1e6ad2f4094e1123e26470e58a57173 (diff)
downloadgdb-906950a50d19e469f6b97a613e540d6caae25247.tar.gz
* elf32-ppc.c (ppc_elf_select_plt_layout): Force bss-plt when
shared and call to _mcount will go via plt.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-ppc.c27
2 files changed, 31 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0b31af428b9..d3ec8300434 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2011-08-14 Alan Modra <amodra@gmail.com>
+ * elf32-ppc.c (ppc_elf_select_plt_layout): Force bss-plt when
+ shared and call to _mcount will go via plt.
+
+2011-08-14 Alan Modra <amodra@gmail.com>
+
* elf64-ppc.c: Prefix all einfo error strings with "%P: ".
* elf32-ppc.c: Likewise.
(ppc_elf_select_plt_layout): Use einfo rather than info to report
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 7de93f619de..cfb473479f9 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -4256,8 +4256,27 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->plt_type == PLT_UNSET)
{
+ struct elf_link_hash_entry *h;
+
if (plt_style == PLT_OLD)
htab->plt_type = PLT_OLD;
+ else if (info->shared
+ && htab->elf.dynamic_sections_created
+ && (h = elf_link_hash_lookup (&htab->elf, "_mcount",
+ FALSE, FALSE, TRUE)) != NULL
+ && (h->type == STT_FUNC
+ || h->needs_plt)
+ && h->ref_regular
+ && !(SYMBOL_CALLS_LOCAL (info, h)
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)))
+ {
+ /* Profiling of shared libs (and pies) is not supported with
+ secure plt, because ppc32 does profiling before a
+ function prologue and a secure plt pic call stubs needs
+ r30 to be set up. */
+ htab->plt_type = PLT_OLD;
+ }
else
{
bfd *ibfd;
@@ -4285,7 +4304,13 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED,
}
}
if (htab->plt_type == PLT_OLD && plt_style == PLT_NEW)
- info->callbacks->einfo (_("%P: bss-plt forced due to %B\n"), htab->old_bfd);
+ {
+ if (htab->old_bfd != NULL)
+ info->callbacks->einfo (_("%P: bss-plt forced due to %B\n"),
+ htab->old_bfd);
+ else
+ info->callbacks->einfo (_("%P: bss-plt forced by profiling\n"));
+ }
BFD_ASSERT (htab->plt_type != PLT_VXWORKS);