x86: Add elf_x86_compute_jump_table_size
Share elf_x86_compute_jump_table_size in elf32-i386.c and elf64-x86-64.c. * elf32-i386.c (elf_i386_compute_jump_table_size): Removed. (elf_i386_allocate_dynrelocs): Replace elf_i386_compute_jump_table_size with elf_x86_compute_jump_table_size. (elf_i386_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf_x86_64_compute_jump_table_size): Removed. (elf_x86_64_allocate_dynrelocs): Replace elf_x86_64_compute_jump_table_size with elf_x86_compute_jump_table_size. (elf_x86_64_size_dynamic_sections): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize got_entry_size. * elfxx-x86.h (elf_x86_link_hash_table): Add got_entry_size. (elf_x86_compute_jump_table_size): New.
This commit is contained in:
parent
503294e755
commit
9ff114ca5d
5 changed files with 29 additions and 11 deletions
|
@ -1,3 +1,20 @@
|
|||
2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* elf32-i386.c (elf_i386_compute_jump_table_size): Removed.
|
||||
(elf_i386_allocate_dynrelocs): Replace
|
||||
elf_i386_compute_jump_table_size with
|
||||
elf_x86_compute_jump_table_size.
|
||||
(elf_i386_size_dynamic_sections): Likewise.
|
||||
* elf64-x86-64.c (elf_x86_64_compute_jump_table_size): Removed.
|
||||
(elf_x86_64_allocate_dynrelocs): Replace
|
||||
elf_x86_64_compute_jump_table_size with
|
||||
elf_x86_compute_jump_table_size.
|
||||
(elf_x86_64_size_dynamic_sections): Likewise.
|
||||
* elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
|
||||
got_entry_size.
|
||||
* elfxx-x86.h (elf_x86_link_hash_table): Add got_entry_size.
|
||||
(elf_x86_compute_jump_table_size): New.
|
||||
|
||||
2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
|
||||
|
|
|
@ -858,9 +858,6 @@ static const struct elf_i386_backend_data elf_i386_arch_bed =
|
|||
&& elf_tdata (bfd) != NULL \
|
||||
&& elf_object_id (bfd) == I386_ELF_DATA)
|
||||
|
||||
#define elf_i386_compute_jump_table_size(htab) \
|
||||
((htab)->elf.srelplt->reloc_count * 4)
|
||||
|
||||
/* Return TRUE if the TLS access code sequence support transition
|
||||
from R_TYPE. */
|
||||
|
||||
|
@ -2206,7 +2203,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
|||
if (GOT_TLS_GDESC_P (tls_type))
|
||||
{
|
||||
eh->tlsdesc_got = htab->elf.sgotplt->size
|
||||
- elf_i386_compute_jump_table_size (htab);
|
||||
- elf_x86_compute_jump_table_size (htab);
|
||||
htab->elf.sgotplt->size += 8;
|
||||
h->got.offset = (bfd_vma) -2;
|
||||
}
|
||||
|
@ -2637,7 +2634,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
|||
if (GOT_TLS_GDESC_P (*local_tls_type))
|
||||
{
|
||||
*local_tlsdesc_gotent = htab->elf.sgotplt->size
|
||||
- elf_i386_compute_jump_table_size (htab);
|
||||
- elf_x86_compute_jump_table_size (htab);
|
||||
htab->elf.sgotplt->size += 8;
|
||||
*local_got = (bfd_vma) -2;
|
||||
}
|
||||
|
|
|
@ -973,9 +973,6 @@ static const struct elf_x86_64_backend_data elf_x86_64_arch_bed =
|
|||
&& elf_tdata (bfd) != NULL \
|
||||
&& elf_object_id (bfd) == X86_64_ELF_DATA)
|
||||
|
||||
#define elf_x86_64_compute_jump_table_size(htab) \
|
||||
((htab)->elf.srelplt->reloc_count * GOT_ENTRY_SIZE)
|
||||
|
||||
static bfd_boolean
|
||||
elf64_x86_64_elf_object_p (bfd *abfd)
|
||||
{
|
||||
|
@ -2632,7 +2629,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
|||
if (GOT_TLS_GDESC_P (tls_type))
|
||||
{
|
||||
eh->tlsdesc_got = htab->elf.sgotplt->size
|
||||
- elf_x86_64_compute_jump_table_size (htab);
|
||||
- elf_x86_compute_jump_table_size (htab);
|
||||
htab->elf.sgotplt->size += 2 * GOT_ENTRY_SIZE;
|
||||
h->got.offset = (bfd_vma) -2;
|
||||
}
|
||||
|
@ -3035,7 +3032,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
|
|||
if (GOT_TLS_GDESC_P (*local_tls_type))
|
||||
{
|
||||
*local_tlsdesc_gotent = htab->elf.sgotplt->size
|
||||
- elf_x86_64_compute_jump_table_size (htab);
|
||||
- elf_x86_compute_jump_table_size (htab);
|
||||
htab->elf.sgotplt->size += 2 * GOT_ENTRY_SIZE;
|
||||
*local_got = (bfd_vma) -2;
|
||||
}
|
||||
|
@ -3099,7 +3096,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
|
|||
if (htab->elf.srelplt)
|
||||
{
|
||||
htab->sgotplt_jump_table_size
|
||||
= elf_x86_64_compute_jump_table_size (htab);
|
||||
= elf_x86_compute_jump_table_size (htab);
|
||||
htab->next_irelative_index = htab->elf.srelplt->reloc_count - 1;
|
||||
}
|
||||
else if (htab->elf.irelplt)
|
||||
|
|
|
@ -278,6 +278,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->got_entry_size = 8;
|
||||
ret->pointer_r_type = R_X86_64_64;
|
||||
ret->dynamic_interpreter = ELF64_DYNAMIC_INTERPRETER;
|
||||
ret->dynamic_interpreter_size = sizeof ELF64_DYNAMIC_INTERPRETER;
|
||||
|
@ -291,6 +292,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd)
|
|||
if (bed->target_id == X86_64_ELF_DATA)
|
||||
{
|
||||
ret->sizeof_reloc = sizeof (Elf32_External_Rela);
|
||||
ret->got_entry_size = 8;
|
||||
ret->pointer_r_type = R_X86_64_32;
|
||||
ret->dynamic_interpreter = ELFX32_DYNAMIC_INTERPRETER;
|
||||
ret->dynamic_interpreter_size
|
||||
|
@ -300,6 +302,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd)
|
|||
else
|
||||
{
|
||||
ret->sizeof_reloc = sizeof (Elf32_External_Rel);
|
||||
ret->got_entry_size = 4;
|
||||
ret->pointer_r_type = R_386_32;
|
||||
ret->dynamic_interpreter = ELF32_DYNAMIC_INTERPRETER;
|
||||
ret->dynamic_interpreter_size
|
||||
|
|
|
@ -314,6 +314,7 @@ struct elf_x86_link_hash_table
|
|||
bfd_vma (*r_info) (bfd_vma, bfd_vma);
|
||||
bfd_vma (*r_sym) (bfd_vma);
|
||||
unsigned int sizeof_reloc;
|
||||
unsigned int got_entry_size;
|
||||
unsigned int pointer_r_type;
|
||||
int dynamic_interpreter_size;
|
||||
const char *dynamic_interpreter;
|
||||
|
@ -382,6 +383,9 @@ struct elf_x86_plt
|
|||
#define elf_x86_local_tlsdesc_gotent(abfd) \
|
||||
(elf_x86_tdata (abfd)->local_tlsdesc_gotent)
|
||||
|
||||
#define elf_x86_compute_jump_table_size(htab) \
|
||||
((htab)->elf.srelplt->reloc_count * (htab)->got_entry_size)
|
||||
|
||||
extern bfd_boolean _bfd_x86_elf_mkobject
|
||||
(bfd *);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue