This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PPC64 GOT alignment trouble
- From: Andrew Stubbs <ams at codesourcery dot com>
- To: Binutils <binutils at sourceware dot org>, Alan Modra <amodra at gmail dot com>
- Date: Thu, 15 Oct 2015 12:31:30 +0100
- Subject: Re: PPC64 GOT alignment trouble
- Authentication-results: sourceware.org; auth=none
- References: <561F7683 dot 7070304 at codesourcery dot com>
On 15/10/15 10:48, Andrew Stubbs wrote:
Is this breakage unintentional? Was it supposed to continue to work when
not 256-byte aligned?
It needs to either Just Work, or fail with a useful diagnostic, but I
don't know which?
I'm still not clear whether it was supposed to realign the section
automatically?
Anyway, in the meantime, this warning would have made my life much easier.
OK to commit?
Andrew
2015-10-15 Andrew Stubbs <ams@codesourcery.com>
bfd/
* elf64-ppc.c (ppc64_elf_set_toc): Warn about misaligned sections.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index e5344df..520770e 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -12615,6 +12615,7 @@ ppc64_elf_set_toc (struct bfd_link_info *info, bfd *obfd)
{
asection *s;
bfd_vma TOCstart, adjust;
+ static bfd_boolean warned = FALSE;
if (info != NULL)
{
@@ -12690,6 +12691,14 @@ ppc64_elf_set_toc (struct bfd_link_info *info, bfd *obfd)
if (s != NULL)
TOCstart = s->output_section->vma + s->output_offset;
+ if (!warned && (TOCstart & 0xff) != 0)
+ {
+ info->callbacks->einfo
+ (_("%B: warning: section `%A' not 256-byte aligned in linker script\n"),
+ obfd, s);
+ warned = TRUE;
+ }
+
/* Force alignment. */
adjust = TOCstart & (TOC_BASE_ALIGN - 1);
TOCstart -= adjust;