summaryrefslogtreecommitdiff
path: root/bfd/elfxx-tilegx.c
diff options
context:
space:
mode:
authorwalt <walt>2012-08-28 06:28:29 +0000
committerwalt <walt>2012-08-28 06:28:29 +0000
commit3b1b398082d999aef31551eebf347c2e31ba769f (patch)
treea764be17e88491273d71185958299006cdbf8d24 /bfd/elfxx-tilegx.c
parent55584203a9d02e10166f1cd1db122d09a924f0ab (diff)
downloadbinutils-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/elfxx-tilegx.c')
-rw-r--r--bfd/elfxx-tilegx.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c
index 1f5c4587da..c0daf18bd4 100644
--- a/bfd/elfxx-tilegx.c
+++ b/bfd/elfxx-tilegx.c
@@ -2470,10 +2470,10 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
/* Allocate room for the header and tail. */
if (s->size == 0)
{
- s->size = PLT_HEADER_SIZE + PLT_TAIL_SIZE;
+ s->size = PLT_ENTRY_SIZE;
}
- h->plt.offset = s->size - PLT_TAIL_SIZE;
+ h->plt.offset = s->size - PLT_ENTRY_SIZE + PLT_HEADER_SIZE;
/* If this symbol is not defined in a regular file, and we are
not generating a shared library, then set the symbol to this
@@ -4247,6 +4247,7 @@ tilegx_elf_finish_dynamic_sections (bfd *output_bfd,
bfd *dynobj;
asection *sdyn;
struct tilegx_elf_link_hash_table *htab;
+ size_t pad_size;
htab = tilegx_elf_hash_table (info);
BFD_ASSERT (htab != NULL);
@@ -4275,10 +4276,15 @@ tilegx_elf_finish_dynamic_sections (bfd *output_bfd,
tilegx64_plt0_entry : tilegx32_plt0_entry,
PLT_HEADER_SIZE);
- memcpy (splt->contents + splt->size - PLT_TAIL_SIZE,
+ memcpy (splt->contents + splt->size
+ - PLT_ENTRY_SIZE + PLT_HEADER_SIZE,
ABI_64_P (output_bfd) ?
tilegx64_plt_tail_entry : tilegx32_plt_tail_entry,
PLT_TAIL_SIZE);
+ /* Add padding so that the plt section is a multiple of its
+ entry size. */
+ pad_size = PLT_ENTRY_SIZE - PLT_HEADER_SIZE - PLT_TAIL_SIZE;
+ memset (splt->contents + splt->size - pad_size, 0, pad_size);
}
elf_section_data (splt->output_section)->this_hdr.sh_entsize