summaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-12-13 21:07:14 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-12-13 21:07:14 +0000
commit17dbfb0a6623a63bed2329ecf3a18e625dada7e1 (patch)
treedc6232f42762f14b90c2f972b660f7da9168d996 /bfd/elf32-i386.c
parentf003c0def792e961f3d43a9d8958149ad5042a4e (diff)
downloadbinutils-redhat-17dbfb0a6623a63bed2329ecf3a18e625dada7e1.tar.gz
Check local IFUNC calls
bfd/ 2012-12-13 H.J. Lu <hongjiu.lu@intel.com> PR ld/14956 * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Check local IFUNC calls. * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise. ld/testsuite/ 2012-12-13 H.J. Lu <hongjiu.lu@intel.com> PR ld/14956 * ld-ifunc/ifunc-14-i386.d: Renamed to ... * ld-ifunc/ifunc-14a-i386.d: This. * ld-ifunc/ifunc-14-x86-64.d: Renamed to ... * ld-ifunc/ifunc-14a-x86-64.d: This. * ld-ifunc/ifunc-14b-i386.d: New file. * ld-ifunc/ifunc-14b-x86-64.d: Likewise. * ld-ifunc/ifunc-14c-i386.d: Likewise. * ld-ifunc/ifunc-14c-x86-64.d: Likewise. * ld-ifunc/ifunc-14d-i386.d: Likewise. * ld-ifunc/ifunc-14d-x86-64.d: Likewise.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 1b04a6ef1f..bb41302b8e 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2066,10 +2066,39 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
{
struct elf_i386_link_hash_table *htab;
asection *s;
+ struct elf_i386_link_hash_entry *eh;
+ struct elf_dyn_relocs *p;
/* STT_GNU_IFUNC symbol must go through PLT. */
if (h->type == STT_GNU_IFUNC)
{
+ /* Check local STT_GNU_IFUNC calls. */
+ if (h->ref_regular
+ && SYMBOL_CALLS_LOCAL (info, h))
+ {
+ bfd_size_type pc_count = 0;
+ struct elf_dyn_relocs **pp;
+
+ eh = (struct elf_i386_link_hash_entry *) h;
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+ {
+ pc_count += p->pc_count;
+ p->count -= p->pc_count;
+ p->pc_count = 0;
+ if (p->count == 0)
+ *pp = p->next;
+ else
+ pp = &p->next;
+ }
+
+ if (pc_count)
+ {
+ h->needs_plt = 1;
+ h->plt.refcount += 1;
+ h->non_got_ref = 1;
+ }
+ }
+
if (h->plt.refcount <= 0)
{
h->plt.offset = (bfd_vma) -1;
@@ -2155,9 +2184,6 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
if (ELIMINATE_COPY_RELOCS
&& !get_elf_i386_backend_data (info->output_bfd)->is_vxworks)
{
- struct elf_i386_link_hash_entry * eh;
- struct elf_dyn_relocs *p;
-
eh = (struct elf_i386_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
{