This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: elf64-ppc.c *r_offset patch
- From: Jakub Jelinek <jakub at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Mon, 16 Jun 2003 05:37:20 -0400
- Subject: Re: elf64-ppc.c *r_offset patch
- References: <20030614095552.GU23826@bubble.sa.bigpond.net.au> <20030614102652.GE24872@sunsite.ms.mff.cuni.cz> <20030614125547.GV23826@bubble.sa.bigpond.net.au> <20030614151535.N15481@devserv.devel.redhat.com> <20030614235412.GW23826@bubble.sa.bigpond.net.au> <20030615001712.GX23826@bubble.sa.bigpond.net.au> <20030615085622.P15481@devserv.devel.redhat.com> <20030616040839.GB23826@bubble.sa.bigpond.net.au> <20030616080448.GB20507@sunsite.ms.mff.cuni.cz> <20030616092234.GC23826@bubble.sa.bigpond.net.au>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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