This is the mail archive of the binutils@sources.redhat.com 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: elf64-ppc.c *r_offset patch


On Mon, Jun 16, 2003 at 06:52:34PM +0930, Alan Modra wrote:
> > >  	      if (! relocate)
> > > -		continue;
> > > +		{
> > > +		  relocation = 0;
> > > +		  addend = 0;
> > > +		  unresolved_reloc = FALSE;
> > > +		}
> > 
> > Will this handle pc relative relocs correctly?
> > Stuff like:
> > echo '.data; .8byte foo + 128 - .' > test.s
> > gcc -shared -o test.so test.s -nostdlib
> 
> Sure.  Since we are RELA, the section contents can be ignored by ld.so.
> We do this except for the special case of .opd, where we might access
> the section contents before they have been relocated (and we know all
> .opd relocs are R_PPC64_RELATIVE).  See elf_machine_fixup_plt.

What I meant is if setting relocation = 0; addend = 0; won't cause
pc_relative relocs to end up with -r_offset at *r_offset.
Will build binutils with your patch now and check it out.

> If we want R_PPC64_ADDR64 to have *r_offset == r_addend, it's just a
> matter of adding
> 
> 		  if (r_type == R_PPC64_ADDR64)
> 		    addend = outrel.r_addend;
> 
> in the hunk you quote above.  I suppose that's not too big a price to
> pay for improved backward compatibility.

I think this would be helpful (and certainly shouldn't ever result
in relocations truncated to fit, as 64-bit addend will certainly fit
into 64-bit *r_offset.

	Jakub


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