diff options
author | walt <walt> | 2012-08-28 06:28:29 +0000 |
---|---|---|
committer | walt <walt> | 2012-08-28 06:28:29 +0000 |
commit | 3b1b398082d999aef31551eebf347c2e31ba769f (patch) | |
tree | a764be17e88491273d71185958299006cdbf8d24 /bfd/elf32-tilepro.c | |
parent | 55584203a9d02e10166f1cd1db122d09a924f0ab (diff) | |
download | binutils-redhat-3b1b398082d999aef31551eebf347c2e31ba769f.tar.gz |
Add padding to the plt section so that its size is a multiple of its
entry size.
* elf32-tilepro.c (allocate_dynrelocs): Use PLT_ENTRY_SIZE as size
of header.
(tilepro_plt_entry_build): Account for new header size.
(tilepro_elf_finish_dynamic_sections): Ditto.
(tilepro_elf_plt_sym_val): Ditto.
* elfxx-tilegx.c (allocate_dynrelocs): Use PLT_ENTRY_SIZE as size
of header + tail.
(tilegx_elf_finish_dynamic_sections): Account for new padding.
Diffstat (limited to 'bfd/elf32-tilepro.c')
-rw-r--r-- | bfd/elf32-tilepro.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index fa883e19d6..aa2dfd616e 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -1105,7 +1105,7 @@ static int tilepro_plt_entry_build (asection *splt, asection *sgotplt, bfd_vma offset, bfd_vma *r_offset) { - int plt_index = (offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE; + int plt_index = (offset - PLT_ENTRY_SIZE) / PLT_ENTRY_SIZE; int got_offset = plt_index * GOT_ENTRY_SIZE + GOTPLT_HEADER_SIZE; tilepro_bundle_bits *pc; @@ -2193,7 +2193,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Allocate room for the header. */ if (s->size == 0) { - s->size = PLT_HEADER_SIZE; + s->size = PLT_ENTRY_SIZE; } h->plt.offset = s->size; @@ -3867,7 +3867,11 @@ tilepro_elf_finish_dynamic_sections (bfd *output_bfd, /* Fill in the first entry in the procedure linkage table. */ if (splt->size > 0) - memcpy (splt->contents, tilepro_plt0_entry, PLT_HEADER_SIZE); + { + memcpy (splt->contents, tilepro_plt0_entry, PLT_HEADER_SIZE); + memset (splt->contents + PLT_HEADER_SIZE, 0, + PLT_ENTRY_SIZE - PLT_HEADER_SIZE); + } elf_section_data (splt->output_section)->this_hdr.sh_entsize = PLT_ENTRY_SIZE; @@ -3924,7 +3928,7 @@ static bfd_vma tilepro_elf_plt_sym_val (bfd_vma i, const asection *plt, const arelent *rel ATTRIBUTE_UNUSED) { - return plt->vma + PLT_HEADER_SIZE + i * PLT_ENTRY_SIZE; + return plt->vma + (i + 1) * PLT_ENTRY_SIZE; } static enum elf_reloc_type_class |