aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-ppc.c7
-rw-r--r--bfd/elf64-ppc.c15
3 files changed, 20 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f1c5c41..3c8fcf3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-18 Alan Modra <amodra@gmail.com>
+
+ * elf32-ppc.c (ppc_elf_create_glink): Correct alignment of .glink.
+ * elf64-ppc.c (ppc64_elf_size_stubs): Handle negative plt_stub_align.
+ (ppc64_elf_build_stubs): Likewise.
+
2018-01-17 Nick Clifton <nickc@redhat.com>
* po/ru.po: Updated Russian translation.
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 73701d4..32104a1 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -3475,14 +3475,17 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info)
struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
asection *s;
flagword flags;
+ int p2align;
flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY | SEC_HAS_CONTENTS
| SEC_IN_MEMORY | SEC_LINKER_CREATED);
s = bfd_make_section_anyway_with_flags (abfd, ".glink", flags);
htab->glink = s;
+ p2align = htab->params->ppc476_workaround ? 6 : 4;
+ if (p2align < htab->params->plt_stub_align)
+ p2align = htab->params->plt_stub_align;
if (s == NULL
- || !bfd_set_section_alignment (abfd, s,
- htab->params->ppc476_workaround ? 6 : 4))
+ || !bfd_set_section_alignment (abfd, s, p2align))
return FALSE;
if (!info->no_ld_generated_unwind_info)
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 65cf7fe..b2d288b 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -12743,9 +12743,11 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
if (htab->params->plt_stub_align != 0)
for (group = htab->group; group != NULL; group = group->next)
if (group->stub_sec != NULL)
- group->stub_sec->size = ((group->stub_sec->size
- + (1 << htab->params->plt_stub_align) - 1)
- & -(1 << htab->params->plt_stub_align));
+ {
+ int align = abs (htab->params->plt_stub_align);
+ group->stub_sec->size
+ = (group->stub_sec->size + (1 << align) - 1) & -(1 << align);
+ }
for (group = htab->group; group != NULL; group = group->next)
if (group->stub_sec != NULL
@@ -13285,9 +13287,10 @@ ppc64_elf_build_stubs (struct bfd_link_info *info,
if (htab->params->plt_stub_align != 0)
for (group = htab->group; group != NULL; group = group->next)
if ((stub_sec = group->stub_sec) != NULL)
- stub_sec->size = ((stub_sec->size
- + (1 << htab->params->plt_stub_align) - 1)
- & -(1 << htab->params->plt_stub_align));
+ {
+ int align = abs (htab->params->plt_stub_align);
+ stub_sec->size = (stub_sec->size + (1 << align) - 1) & -(1 << align);
+ }
for (group = htab->group; group != NULL; group = group->next)
if ((stub_sec = group->stub_sec) != NULL)