]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Properly adjust h->plt.refcount
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 21 Dec 2012 18:21:06 +0000 (18:21 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 21 Dec 2012 18:21:06 +0000 (18:21 +0000)
bfd/

PR ld/14980
* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Properly
adjust h->plt.refcount.
* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.

ld/testsuite/

PR ld/14980
* ld-ifunc/ifunc-14c.s: New file.
* ld-ifunc/ifunc-14e-i386.d: Likewise.
* ld-ifunc/ifunc-14e-x86-64.d: Likewise.
* ld-ifunc/ifunc-14f-i386.d: Likewise.
* ld-ifunc/ifunc-14f-x86-64.d: Likewise.

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

index ce91c412de6ab3e4e92bef0a90c4575c43a20105..acb0d651d3ceeced4f5321583e4cfefaf1bd51cb 100644 (file)
@@ -1,3 +1,10 @@
+2012-12-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/14980
+       * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Properly
+       adjust h->plt.refcount.
+       * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.
+
 2012-12-20  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/14968
index 70a0d30de2fb7277f1454fa6d22e504fd20d57ff..37587b8d6686c002d7e24200612f1411604c8fbc 100644 (file)
@@ -2096,8 +2096,11 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
          if (pc_count || count)
            {
              h->needs_plt = 1;
-             h->plt.refcount += 1;
              h->non_got_ref = 1;
+             if (h->plt.refcount <= 0)
+               h->plt.refcount = 1;
+             else
+               h->plt.refcount += 1;
            }
        }
 
index c72d316f8c823afb8e8632a6e00abf7dab261685..ef20bd8ed389920fe9c65003f8bf72d7d080dfb2 100644 (file)
@@ -2164,8 +2164,11 @@ elf_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
          if (pc_count || count)
            {
              h->needs_plt = 1;
-             h->plt.refcount += 1;
              h->non_got_ref = 1;
+             if (h->plt.refcount <= 0)
+               h->plt.refcount = 1;
+             else
+               h->plt.refcount += 1;
            }
        }
 
index 21fcbe1d7edc8d472eabcfcb1c106ad8602cfd0c..d4550d84dfd8cf8844de0e26fd0ab0976eea18a4 100644 (file)
@@ -1,3 +1,12 @@
+2012-12-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/14980
+       * ld-ifunc/ifunc-14c.s: New file.
+       * ld-ifunc/ifunc-14e-i386.d: Likewise.
+       * ld-ifunc/ifunc-14e-x86-64.d: Likewise.
+       * ld-ifunc/ifunc-14f-i386.d: Likewise.
+       * ld-ifunc/ifunc-14f-x86-64.d: Likewise.
+
 2012-12-20  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/14968