This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PPC64 GOT alignment trouble


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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]