aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-05-11 07:42:30 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-05-11 07:45:59 -0700
commitdc2be3d2f6de530aac40983e79e29e050f40e759 (patch)
tree07603beeba1b30451b6608cbfe6e6944f288b938 /bfd
parentf96f371cbb33454544a9f1827c239c4375f0b60e (diff)
downloadfsf-binutils-gdb-dc2be3d2f6de530aac40983e79e29e050f40e759.zip
fsf-binutils-gdb-dc2be3d2f6de530aac40983e79e29e050f40e759.tar.gz
fsf-binutils-gdb-dc2be3d2f6de530aac40983e79e29e050f40e759.tar.bz2
x86: Generate PLT relocations for -z now
This patch partially reverses: commit 25070364b0ce33eed46aa5d78ebebbec6accec7e Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat May 16 07:00:21 2015 -0700 Don't generate PLT relocations for now binding to support LD_AUDIT and LD_PROFILE with -z now. If there is an existing GOT relocation, it is still used to avoid PLT relocation against the same function symbol. bfd/ * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert commit 25070364b0ce33eed46aa5d78ebebbec6accec7e. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse. ld/ * testsuite/ld-i386/plt-pic2.dd: Updated. * testsuite/ld-i386/plt2.dd: Likewise. * testsuite/ld-i386/plt2.rd: Likewise. * testsuite/ld-i386/pr17689now.rd: Likewise. * testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise. * testsuite/ld-ifunc/pr17154-i386-now.d: Likewise. * testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise. * testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise. * testsuite/ld-x86-64/plt2.dd: Likewise. * testsuite/ld-x86-64/plt2.rd: Likewise. * testsuite/ld-x86-64/pr17689now.rd: Likewise. * testsuite/ld-x86-64/pr21038b-now.d: Likewise. * testsuite/ld-x86-64/pr21038c-now.d: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-i386.c16
-rw-r--r--bfd/elf64-x86-64.c16
3 files changed, 8 insertions, 30 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 713614d..05c3837 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-05-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert
+ commit 25070364b0ce33eed46aa5d78ebebbec6accec7e.
+ * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse.
+
2017-05-10 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf64-sparc.c (elf64_sparc_set_reloc): New function.
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 227cd25..6f59fb7 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2657,26 +2657,12 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
&& (h->plt.refcount > eh->func_pointer_refcount
|| eh->plt_got.refcount > 0))
{
- bfd_boolean use_plt_got;
+ bfd_boolean use_plt_got = eh->plt_got.refcount > 0;
/* Clear the reference count of function pointer relocations
if PLT is used. */
eh->func_pointer_refcount = 0;
- if (htab->plt_got != NULL
- && (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;
-
- /* Use the GOT PLT. */
- h->got.refcount = 1;
- eh->plt_got.refcount = 1;
- }
-
- use_plt_got = eh->plt_got.refcount > 0;
-
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index fb9336d..8b217b4 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3057,26 +3057,12 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
&& (h->plt.refcount > eh->func_pointer_refcount
|| eh->plt_got.refcount > 0))
{
- bfd_boolean use_plt_got;
+ bfd_boolean use_plt_got = eh->plt_got.refcount > 0;
/* Clear the reference count of function pointer relocations
if PLT is used. */
eh->func_pointer_refcount = 0;
- if (htab->plt_got != NULL
- && (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;
-
- /* Use the GOT PLT. */
- h->got.refcount = 1;
- eh->plt_got.refcount = 1;
- }
-
- use_plt_got = eh->plt_got.refcount > 0;
-
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1