+2018-03-14 Alan Modra <amodra@gmail.com>
+
+ * elf64-ppc.c (sfpr_define): Adjust for stub_sec size having
+ sfpr size added before defining alias symbols.
+ (ppc64_elf_build_stubs): Add stub section padding before
+ copying sfpr contents and defining save/restore alias symbols.
+
2018-03-14 H.J. Lu <hongjiu.lu@intel.com>
PR ld/20882
{
s->root.type = bfd_link_hash_defined;
s->root.u.def.section = stub_sec;
- s->root.u.def.value = (stub_sec->size
+ s->root.u.def.value = (stub_sec->size - htab->sfpr->size
+ h->elf.root.u.def.value);
s->ref_regular = 1;
s->def_regular = 1;
for (group = htab->group; group != NULL; group = group->next)
if (group->needs_save_res)
- {
- stub_sec = group->stub_sec;
- memcpy (stub_sec->contents + stub_sec->size, htab->sfpr->contents,
- htab->sfpr->size);
- if (htab->params->emit_stub_syms)
- {
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE (save_res_funcs); i++)
- if (!sfpr_define (info, &save_res_funcs[i], stub_sec))
- return FALSE;
- }
- stub_sec->size += htab->sfpr->size;
- }
+ group->stub_sec->size += htab->sfpr->size;
if (htab->relbrlt != NULL)
htab->relbrlt->reloc_count = 0;
stub_sec->size = (stub_sec->size + (1 << align) - 1) & -(1 << align);
}
+ for (group = htab->group; group != NULL; group = group->next)
+ if (group->needs_save_res)
+ {
+ stub_sec = group->stub_sec;
+ memcpy (stub_sec->contents + stub_sec->size - htab->sfpr->size,
+ htab->sfpr->contents, htab->sfpr->size);
+ if (htab->params->emit_stub_syms)
+ {
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE (save_res_funcs); i++)
+ if (!sfpr_define (info, &save_res_funcs[i], stub_sec))
+ return FALSE;
+ }
+ }
+
for (group = htab->group; group != NULL; group = group->next)
if ((stub_sec = group->stub_sec) != NULL)
{