This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_29-branch] PR 21847, PowerPC64 --plt-localentry again


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d941b247607b41e08e2f7ff322402e35945d9d95

commit d941b247607b41e08e2f7ff322402e35945d9d95
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Jul 31 10:18:46 2017 +0930

    PR 21847, PowerPC64 --plt-localentry again
    
    This makes ld warn about --plt-localentry if a version of glibc
    without the necessary ld.so checks is detected, and revises the
    documentation.
    
    bfd/
    	* elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry
    	without ld.so checks.
    gold/
    	* powerpc.cc (Target_powerpc::scan_relocs): Warn on --plt-localentry
    	without ld.so checks.
    ld/
    	* ld.texinfo (plt-localentry): Revise.

Diff:
---
 bfd/ChangeLog   | 5 +++++
 bfd/elf64-ppc.c | 6 ++++++
 gold/ChangeLog  | 5 +++++
 gold/powerpc.cc | 4 ++++
 ld/ChangeLog    | 4 ++++
 ld/ld.texinfo   | 7 +++++--
 6 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b209923..1478710 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2017-07-31  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry
+	without ld.so checks.
+
 2017-07-29  Alan Modra  <amodra@gmail.com>
 
 	PR 21847
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 4e2d355..689eac8 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -8369,6 +8369,12 @@ ppc64_elf_tls_setup (struct bfd_link_info *info)
      --plt-localentry can cause trouble.  */
   if (htab->params->plt_localentry0 < 0)
     htab->params->plt_localentry0 = 0;
+  if (htab->params->plt_localentry0
+      && elf_link_hash_lookup (&htab->elf, "GLIBC_2.26",
+			       FALSE, FALSE, FALSE) == NULL)
+    info->callbacks->einfo
+      (_("%P: warning: --plt-localentry is especially dangerous without "
+	 "ld.so support to detect ABI violations.\n"));
 
   htab->tls_get_addr = ((struct ppc_link_hash_entry *)
 			elf_link_hash_lookup (&htab->elf, ".__tls_get_addr",
diff --git a/gold/ChangeLog b/gold/ChangeLog
index f027ec0..39a6bf1 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,8 @@
+2017-07-31  Alan Modra  <amodra@gmail.com>
+
+	* powerpc.cc (Target_powerpc::scan_relocs): Warn on --plt-localentry
+	without ld.so checks.
+
 2017-07-29  Alan Modra  <amodra@gmail.com>
 
 	PR 21847
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 2fbdf6f..b0d7585 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -7660,6 +7660,10 @@ Target_powerpc<size, big_endian>::scan_relocs(
 	{
 	  if (parameters->options().user_set_plt_localentry())
 	    plt_localentry0 = parameters->options().plt_localentry();
+	  if (plt_localentry0
+	      && symtab->lookup("GLIBC_2.26", NULL) == NULL)
+	    gold_warning(_("--plt-localentry is especially dangerous without "
+			   "ld.so support to detect ABI violations"));
 	}
       this->plt_localentry0_ = plt_localentry0;
       this->plt_localentry0_init_ = true;
diff --git a/ld/ChangeLog b/ld/ChangeLog
index ce43aea..d16399b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2017-07-31  Alan Modra  <amodra@gmail.com>
+
+	* ld.texinfo (plt-localentry): Revise.
+
 2017-07-29  Alan Modra  <amodra@gmail.com>
 
 	* ld.texinfo (plt-localentry): Document.
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index b4222ab..5d0b007 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -7613,8 +7613,11 @@ Such an external function can be called via the PLT without saving r2
 or restoring it on return, avoiding a common load-hit-store for small
 functions.   The optimization is attractive, with up to 40% reduction
 in execution time for a small function, but can result in symbol
-interposition failures.  Use with care.  @option{--no-plt-localentry}
-is the default.
+interposition failures.  Also, minor changes in a shared library,
+including system libraries, can cause a function that was localentry:0
+to become localentry:8.  This will result in a dynamic loader
+complaint and failure to run.  The option is experimental, use with
+care.  @option{--no-plt-localentry} is the default.
 @end table
 
 @ifclear GENERIC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]