This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [ppc] fix a couple of relax bugs
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: binutils <binutils at sources dot redhat dot com>
- Date: Mon, 10 Aug 2009 22:14:15 +0930
- Subject: Re: [ppc] fix a couple of relax bugs
- References: <4A800BEB.7060303@codesourcery.com>
On Mon, Aug 10, 2009 at 01:00:43PM +0100, Nathan Sidwell wrote:
> This patch fixes two relax bugs
Thanks for finding and fixing this!
> *************** ppc_elf_relax_section (bfd *abfd,
> *** 6120,6127 ****
> if (tsec->output_section == NULL)
> continue;
>
> - symaddr = tsec->output_section->vma + tsec->output_offset + toff;
> -
> roff = irel->r_offset;
> reladdr = isec->output_section->vma + isec->output_offset + roff;
>
I'd prefer if you kept symaddr around. It was quite handy when
debugging PR10474 the other day. Perhaps rewrite like this
roff = irel->r_offset;
/* If the branch is in range, no need to do anything. */
if (tsec != bfd_und_section_ptr
&& (!link_info->relocatable
/* A relocatable link may have sections moved during
final link, so do not presume they remain in range. */
|| tsec->output_section == isec->output_section))
{
bfd_vma symaddr, reladdr;
symaddr = tsec->output_section->vma + tsec->output_offset + toff;
reladdr = isec->output_section->vma + isec->output_offset + roff;
if (symaddr - reladdr + max_branch_offset < 2 * max_branch_offset)
continue;
}
Patch otherwise OK. Hmm, we ought to just continue on local SHN_UNDEF
and SHN_COMMON too.
--
Alan Modra
Australia Development Lab, IBM