From: H.J. Lu Date: Fri, 21 Dec 2012 18:21:06 +0000 (+0000) Subject: Properly adjust h->plt.refcount X-Git-Tag: binutils-2_23_2~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af9a1934c007b4dc410546c6c092ce4ce923dbcc;p=thirdparty%2Fbinutils-gdb.git Properly adjust h->plt.refcount 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ce91c412de6..acb0d651d3c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2012-12-21 H.J. Lu + + 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 PR ld/14968 diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 70a0d30de2f..37587b8d668 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -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; } } diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index c72d316f8c8..ef20bd8ed38 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -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; } } diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 21fcbe1d7ed..d4550d84dfd 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2012-12-21 H.J. Lu + + 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 PR ld/14968