[prev in list] [next in list] [prev in thread] [next in thread] 

List:       binutils
Subject:    ppc476 patch area size miscalculation
From:       Alan Modra <amodra () gmail ! com>
Date:       2014-08-30 0:57:43
Message-ID: 20140830004543.GB17693 () bubble ! grove ! modra ! org
[Download RAW message or body]

ppc476 sections that end exactly on a page boundary need the
workaround applied when a function ends in "bctr", or when pasting
together code from multiple sections.  The space allocated for the
patch area didn't allow for this case, while the code in
relocate_section performing the patches did, leading to an assertion
failure.

	* elf32-ppc.c (ppc_elf_relax_section): Fix off by one error.

diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 97f4724..6fb603d 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -7165,7 +7165,7 @@ ppc_elf_relax_section (bfd *abfd,
       bfd_vma pagesize = (bfd_vma) 1 << htab->params->pagesize_p2;
 
       addr = isec->output_section->vma + isec->output_offset;
-      end_addr = addr + trampoff - 1;
+      end_addr = addr + trampoff;
       addr &= -pagesize;
       crossings = ((end_addr & -pagesize) - addr) >> htab->params->pagesize_p2;
       if (crossings != 0)

-- 
Alan Modra
Australia Development Lab, IBM

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic