]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Also check local IFUNC references
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 20 Dec 2012 18:52:21 +0000 (18:52 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 20 Dec 2012 18:52:21 +0000 (18:52 +0000)
bfd/

PR ld/14968
* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Also check
local IFUNC references.
* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.

ld/testsuite/

PR ld/14968
* ld-ifunc/ifunc-18a-i386.d: New file.
* ld-ifunc/ifunc-18a-x86-64.d: Likewise.
* ld-ifunc/ifunc-18a.s: Likewise.
* ld-ifunc/ifunc-18b-i386.d: Likewise.
* ld-ifunc/ifunc-18b-x86-64.d: Likewise.
* ld-ifunc/ifunc-18b.s: Likewise.
* ld-ifunc/ifunc-19a-i386.d: Likewise.
* ld-ifunc/ifunc-19a-x86-64.d: Likewise.
* ld-ifunc/ifunc-19a.s: Likewise.
* ld-ifunc/ifunc-19b-i386.d: Likewise.
* ld-ifunc/ifunc-19b-x86-64.d: Likewise.
* ld-ifunc/ifunc-19b.s: Likewise.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c
ld/testsuite/ChangeLog

index cfa358ca66202d53f514babbc34533b87bc647ba..ce91c412de6ab3e4e92bef0a90c4575c43a20105 100644 (file)
@@ -1,3 +1,10 @@
+2012-12-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/14968
+       * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Also check
+       local IFUNC references.
+       * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.
+
 2012-12-20  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/14956
index 987416c57f71a423c43f66d03ff304f0750914a8..70a0d30de2fb7277f1454fa6d22e504fd20d57ff 100644 (file)
@@ -2072,11 +2072,12 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* STT_GNU_IFUNC symbol must go through PLT. */
   if (h->type == STT_GNU_IFUNC)
     {
-      /* Check local STT_GNU_IFUNC calls.  */
+      /* All local STT_GNU_IFUNC references must be treate as local
+        calls via local PLT.  */
       if (h->ref_regular
          && SYMBOL_CALLS_LOCAL (info, h))
        {
-         bfd_size_type pc_count = 0;
+         bfd_size_type pc_count = 0, count = 0;
          struct elf_dyn_relocs **pp;
 
          eh = (struct elf_i386_link_hash_entry *) h;
@@ -2085,13 +2086,14 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
              pc_count += p->pc_count;
              p->count -= p->pc_count;
              p->pc_count = 0;
+             count += p->count;
              if (p->count == 0)
                *pp = p->next;
              else
                pp = &p->next;
            }
 
-         if (pc_count)
+         if (pc_count || count)
            {
              h->needs_plt = 1;
              h->plt.refcount += 1;
index 9fcf73a72f6a964e15febbbce697a30908e489d9..c72d316f8c823afb8e8632a6e00abf7dab261685 100644 (file)
@@ -2140,11 +2140,12 @@ elf_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* STT_GNU_IFUNC symbol must go through PLT. */
   if (h->type == STT_GNU_IFUNC)
     {
-      /* Check local STT_GNU_IFUNC calls.  */
+      /* All local STT_GNU_IFUNC references must be treate as local
+        calls via local PLT.  */
       if (h->ref_regular
          && SYMBOL_CALLS_LOCAL (info, h))
        {
-         bfd_size_type pc_count = 0;
+         bfd_size_type pc_count = 0, count = 0;
          struct elf_dyn_relocs **pp;
 
          eh = (struct elf_x86_64_link_hash_entry *) h;
@@ -2153,13 +2154,14 @@ elf_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
              pc_count += p->pc_count;
              p->count -= p->pc_count;
              p->pc_count = 0;
+             count += p->count;
              if (p->count == 0)
                *pp = p->next;
              else
                pp = &p->next;
            }
 
-         if (pc_count)
+         if (pc_count || count)
            {
              h->needs_plt = 1;
              h->plt.refcount += 1;
index 7e3bad506c1fde7c0087e4355a3846e01bed17a3..21fcbe1d7edc8d472eabcfcb1c106ad8602cfd0c 100644 (file)
@@ -1,3 +1,19 @@
+2012-12-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/14968
+       * ld-ifunc/ifunc-18a-i386.d: New file.
+       * ld-ifunc/ifunc-18a-x86-64.d: Likewise.
+       * ld-ifunc/ifunc-18a.s: Likewise.
+       * ld-ifunc/ifunc-18b-i386.d: Likewise.
+       * ld-ifunc/ifunc-18b-x86-64.d: Likewise.
+       * ld-ifunc/ifunc-18b.s: Likewise.
+       * ld-ifunc/ifunc-19a-i386.d: Likewise.
+       * ld-ifunc/ifunc-19a-x86-64.d: Likewise.
+       * ld-ifunc/ifunc-19a.s: Likewise.
+       * ld-ifunc/ifunc-19b-i386.d: Likewise.
+       * ld-ifunc/ifunc-19b-x86-64.d: Likewise.
+       * ld-ifunc/ifunc-19b.s: Likewise.
+
 2012-12-20  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/14956