[ppc] fix a couple of relax bugs
Alan Modra
amodra@bigpond.net.au
Mon Aug 10 12:44:00 GMT 2009
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
More information about the Binutils
mailing list