summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-12-21 18:15:20 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-12-21 18:15:20 +0000
commitdf658ec29b4551b4146f9ba96209db0640bb65e0 (patch)
treea72f05d43ca4add8f4fcd1ca5eac22093a209140
parent83709d4333f490d16d81965e82a564aa501f925e (diff)
downloadgdb-df658ec29b4551b4146f9ba96209db0640bb65e0.tar.gz
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.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf32-i386.c5
-rw-r--r--bfd/elf64-x86-64.c5
3 files changed, 15 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2ceee8dc1e4..48f94dad222 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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-19 H.J. Lu <hongjiu.lu@intel.com>
* elf32-i386.c (elf_i386_relocate_section): Replace
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index fce70b95cfa..f76c7a7f404 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2031,8 +2031,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 a37f793e232..11ec917e696 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2090,8 +2090,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;
}
}