aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-10 15:52:39 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-10 15:52:39 -0700
commit0f09b4d8d8f7c5d249c8375c5c42d4eba3bdc858 (patch)
tree9bca357bd0597b03ae9aef012325061e696dba8c /bfd/elf64-x86-64.c
parent2f20e312aad64c0f5257b9725fa5ffa3e8a93ca2 (diff)
downloadgdb-0f09b4d8d8f7c5d249c8375c5c42d4eba3bdc858.zip
gdb-0f09b4d8d8f7c5d249c8375c5c42d4eba3bdc858.tar.gz
gdb-0f09b4d8d8f7c5d249c8375c5c42d4eba3bdc858.tar.bz2
x86: Set GOT refcount to 1
Since x86 check_relocs is called after opening all inputs and garbage collection, they never see the removed sections. There is no need for incrementing GOT refcount. But since PLT refcount is also used in /* Don't create the PLT entry if there are only function pointer relocations which can be resolved at run-time. */ else if (htab->elf.dynamic_sections_created && (h->plt.refcount > eh->func_pointer_refcount || eh->plt_got.refcount > 0)) { we must increment it. * elf32-i386.c (elf_i386_check_relocs): Set GOT refcount to 1 instead of incrementing it. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 0b0aa6c..7d65dca 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1950,7 +1950,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
switch (r_type)
{
case R_X86_64_TLSLD:
- htab->tls_ld_or_ldm_got.refcount += 1;
+ htab->tls_ld_or_ldm_got.refcount = 1;
goto create_got;
case R_X86_64_TPOFF32:
@@ -1992,7 +1992,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (h != NULL)
{
- h->got.refcount += 1;
+ h->got.refcount = 1;
old_tls_type = eh->tls_type;
}
else
@@ -2018,7 +2018,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
elf_x86_local_got_tls_type (abfd)
= (char *) (local_got_refcounts + 2 * symtab_hdr->sh_info);
}
- local_got_refcounts[r_symndx] += 1;
+ local_got_refcounts[r_symndx] = 1;
old_tls_type
= elf_x86_local_got_tls_type (abfd) [r_symndx];
}