summaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-05-27 14:32:24 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-05-27 14:32:24 -0700
commit8ded2ddc8bac501c1ee0706cb3d3ef3fb1c10b85 (patch)
treee9aa707387d1a08ca901853b0b1887839590338e /bfd/elf32-i386.c
parent924c2928ae3f7a9fa1130103e6a83ff2b1ff17dd (diff)
downloadbinutils-gdb-8ded2ddc8bac501c1ee0706cb3d3ef3fb1c10b85.tar.gz
Convert PLT reloc only if pointer equality isn't needed
When pointer equality needed, we can't replace PLT relocations with GOT relocations for -z now. This patch checks if pointer equality is needed before converting PLT relocations to GOT relocations. bfd/ PR binutils/18458 * elf32-i386.c (elf_i386_check_relocs): Create .plt.got section for now binding only if pointer equality isn't needed. (elf_i386_allocate_dynrelocs): Use .plt.got section for now binding only if pointer equality isn't needed. * elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got section for now binding only if pointer equality isn't needed. (elf_x86_64_allocate_dynrelocs): Use .plt.got section for now binding only if pointer equality isn't needed. ld/testsuite/ PR binutils/18458 * ld-elf/shared.exp (build_tests): Build libpr18458a.so and libpr18458b.so. (run_tests): Run pr18458 test. * ld-elf/pr18458a.c: New file. * ld-elf/pr18458b.c: Likewise. * ld-elf/pr18458c.c: Likewise.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 23d50e1193d..f3aee96822f 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1885,7 +1885,8 @@ do_size:
if (use_plt_got
&& h != NULL
&& h->plt.refcount > 0
- && ((info->flags & DF_BIND_NOW) || h->got.refcount > 0)
+ && (((info->flags & DF_BIND_NOW) && !h->pointer_equality_needed)
+ || h->got.refcount > 0)
&& htab->plt_got == NULL)
{
/* Create the GOT procedure linkage table. */
@@ -2323,7 +2324,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
{
bfd_boolean use_plt_got;
- if ((info->flags & DF_BIND_NOW))
+ if ((info->flags & DF_BIND_NOW) && !h->pointer_equality_needed)
{
/* Don't use the regular PLT for DF_BIND_NOW. */
h->plt.offset = (bfd_vma) -1;