aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-01-05 13:14:20 -0800
committerH.J. Lu <hjl.tools@gmail.com>2022-01-05 13:22:31 -0800
commitbbdeb108d81cd0430d93cd93dbeaa8b4d24a96db (patch)
tree04057a8135df8dcffa9bcfd7e3dde276d85aec9c /bfd/elf32-i386.c
parent39fb369834a39e80d9bee9c55f029c543a7d797c (diff)
downloadgdb-bbdeb108d81cd0430d93cd93dbeaa8b4d24a96db.zip
gdb-bbdeb108d81cd0430d93cd93dbeaa8b4d24a96db.tar.gz
gdb-bbdeb108d81cd0430d93cd93dbeaa8b4d24a96db.tar.bz2
x86: Add elf_x86_allocate_local_got_info
Add elf_x86_allocate_local_got_info to allocate x86 GOT info for local symbols. * elf32-i386.c (elf_i386_check_relocs): Call elf_x86_allocate_local_got_info. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elfxx-x86.h (elf_x86_allocate_local_got_info): New.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index aa7d028..9796207 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1668,25 +1668,12 @@ elf_i386_check_relocs (bfd *abfd,
{
bfd_signed_vma *local_got_refcounts;
+ if (!elf_x86_allocate_local_got_info (abfd,
+ symtab_hdr->sh_info))
+ goto error_return;
+
/* This is a global offset table entry for a local symbol. */
local_got_refcounts = elf_local_got_refcounts (abfd);
- if (local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= (sizeof (bfd_signed_vma)
- + sizeof (bfd_vma) + sizeof(char));
- local_got_refcounts = (bfd_signed_vma *)
- bfd_zalloc (abfd, size);
- if (local_got_refcounts == NULL)
- goto error_return;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- elf_x86_local_tlsdesc_gotent (abfd)
- = (bfd_vma *) (local_got_refcounts + symtab_hdr->sh_info);
- elf_x86_local_got_tls_type (abfd)
- = (char *) (local_got_refcounts + 2 * symtab_hdr->sh_info);
- }
local_got_refcounts[r_symndx] = 1;
old_tls_type = elf_x86_local_got_tls_type (abfd) [r_symndx];
}