summaryrefslogtreecommitdiff
path: root/bfd/elf-ifunc.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-07-13 16:59:09 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-07-13 16:59:09 +0000
commit6f03b2b0bea6a6a11684e5547775d0b565a6bb01 (patch)
tree16e6a7b5c10cd825dc59e819bd99d932af3ef498 /bfd/elf-ifunc.c
parentc57c768ab65354cf4dacf1d5a3fa1e18467429dd (diff)
downloadbinutils-redhat-6f03b2b0bea6a6a11684e5547775d0b565a6bb01.tar.gz
Support garbage collection against STT_GNU_IFUNC symbols.
bfd/ 2010-07-13 H.J. Lu <hongjiu.lu@intel.com> PR ld/11791 * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Support garbage collection against STT_GNU_IFUNC symbols. * elf32-i386.c (elf_i386_get_local_sym_hash): Don't set elf.plt.offset/elf.got.offset to -1. (elf_i386_tls_transition): Skip TLS transition for functions. (elf_i386_gc_sweep_hook): Support STT_GNU_IFUNC symbols. * elf64-x86-64.c (elf64_x86_64_get_local_sym_hash): Don't set elf.plt.offset/elf.got.offset to -1. (elf64_x86_64_tls_transition): Skip TLS transition for functions. (elf64_x86_64_gc_sweep_hook): Support STT_GNU_IFUNC symbols. ld/testsuite/ 2010-07-13 H.J. Lu <hongjiu.lu@intel.com> PR ld/11791 * ld-ifunc/ifunc-10-i386.d: New. * ld-ifunc/ifunc-10-i386.s: Likewise. * ld-ifunc/ifunc-10-x86-64.d: Likewise. * ld-ifunc/ifunc-10-x86-64.s: Likewise. * ld-ifunc/ifunc-11-i386.d: Likewise. * ld-ifunc/ifunc-11-i386.s: Likewise. * ld-ifunc/ifunc-11-x86-64.d: Likewise. * ld-ifunc/ifunc-11-x86-64.s: Likewise.
Diffstat (limited to 'bfd/elf-ifunc.c')
-rw-r--r--bfd/elf-ifunc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
index 0de236f8c2..760fc26c1a 100644
--- a/bfd/elf-ifunc.c
+++ b/bfd/elf-ifunc.c
@@ -187,6 +187,15 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
htab = elf_hash_table (info);
+ /* Support garbage collection against STT_GNU_IFUNC symbols. */
+ if (h->plt.refcount <= 0 && h->got.refcount <= 0)
+ {
+ h->got = htab->init_got_offset;
+ h->plt = htab->init_plt_offset;
+ *head = NULL;
+ return TRUE;
+ }
+
/* Return and discard space for dynamic relocations against it if
it is never referenced in a non-shared object. */
if (!h->ref_regular)