aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfxx-x86.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-09-02 05:55:25 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-09-02 05:55:25 -0700
commit503294e755498eb6545ca72b338c5037facab7f7 (patch)
tree44db44a6e4c36a032082c8704ea8d3c7b688428a /bfd/elfxx-x86.c
parent9a742a902f48369144cdbf5333392f128c74ab7b (diff)
downloadgdb-503294e755498eb6545ca72b338c5037facab7f7.zip
gdb-503294e755498eb6545ca72b338c5037facab7f7.tar.gz
gdb-503294e755498eb6545ca72b338c5037facab7f7.tar.bz2
x86: Add sizeof_reloc to elf_x86_link_hash_table
Initialize htab->sizeof_reloc once, instead of computing it every time. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize sizeof_reloc. (_bfd_x86_elf_adjust_dynamic_symbol): Use sizeof_reloc. * elfxx-x86.h (elf_x86_link_hash_table): Add sizeof_reloc.
Diffstat (limited to 'bfd/elfxx-x86.c')
-rw-r--r--bfd/elfxx-x86.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 50d945e..fe5d211 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -277,6 +277,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd)
{
ret->r_info = elf64_r_info;
ret->r_sym = elf64_r_sym;
+ ret->sizeof_reloc = sizeof (Elf64_External_Rela);
ret->pointer_r_type = R_X86_64_64;
ret->dynamic_interpreter = ELF64_DYNAMIC_INTERPRETER;
ret->dynamic_interpreter_size = sizeof ELF64_DYNAMIC_INTERPRETER;
@@ -289,6 +290,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd)
ret->r_sym = elf32_r_sym;
if (bed->target_id == X86_64_ELF_DATA)
{
+ ret->sizeof_reloc = sizeof (Elf32_External_Rela);
ret->pointer_r_type = R_X86_64_32;
ret->dynamic_interpreter = ELFX32_DYNAMIC_INTERPRETER;
ret->dynamic_interpreter_size
@@ -297,6 +299,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd)
}
else
{
+ ret->sizeof_reloc = sizeof (Elf32_External_Rel);
ret->pointer_r_type = R_386_32;
ret->dynamic_interpreter = ELF32_DYNAMIC_INTERPRETER;
ret->dynamic_interpreter_size
@@ -735,9 +738,7 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
}
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
{
- srel->size += ((bed->target_id == I386_ELF_DATA)
- ? sizeof (Elf32_External_Rel)
- : bed->s->sizeof_rela);
+ srel->size += htab->sizeof_reloc;
h->needs_copy = 1;
}