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: [ppc] fix a couple of relax bugs


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


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