]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR 21847, PowerPC64 --plt-localentry again
authorAlan Modra <amodra@gmail.com>
Mon, 31 Jul 2017 00:48:46 +0000 (10:18 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 31 Jul 2017 03:50:44 +0000 (13:20 +0930)
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.

bfd/ChangeLog
bfd/elf64-ppc.c
gold/ChangeLog
gold/powerpc.cc
ld/ChangeLog
ld/ld.texinfo

index 41c935dd0d84431f91b5156828cb3b951749b95c..9839a3487f5e78e1d858fafc13908063f26170b9 100644 (file)
@@ -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
index 5f3c79f81118e29b7f27154ecb2f53b5bf9a2c5f..7f4f7b6b86f42d6a5ca501c3cc4eebcd3ae7570e 100644 (file)
@@ -8372,6 +8372,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",
index a0193937001cef75c411f2f8e2b47466adc74499..e7567e659263b0760206c0d66fcc98cda3156d0e 100644 (file)
@@ -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
index e322d6f8836ea85b1ec4bd7e39c5b0061c0dbbab..14e56d88f9dd6e3169ab8ef98ea45510e078d4b5 100644 (file)
@@ -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;
index 2a371b9c250096b2480aa5edf5f958dfb9551074..3c918e6c58337a2a0f13e49122e0cadfd0149c50 100644 (file)
@@ -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.
index 172c1ddd9fad8dbace48fa673274b6a6510ea09e..ebe7e7b7bdf250b4c4d1c4f5778f03986dcdc89e 100644 (file)
@@ -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