This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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 relocs


On Sun, Mar 02, 2003 at 03:56:52AM -0800, Roland McGrath wrote:
> I spent a while trying to figure out the right thing for the 16-bit relocs,
> and then punted.  I think these relocs are not produced in PIC code linked
> with ld -shared.  Is that right?

Yes.

> Does the PPC32 or PPC64 ABI permit non-PIC code in shared libraries?

ppc32 does.  gcc currently always produces PIC code for ppc64.

> If not, then we don't need to handle these.

True enough I suppose for ppc64.  I know Steve has some cleanups for
ppc64 dl-machine.h in the pipeline, eg. remove all DTPREL16 reloc
support.

> If that's the case I am confused by the 16-bit reloc handling in
> powerpc64/dl-machine.h.  Firstly, does it really need to be there at all?
> For the *_DS and *_LO_DS relocs, the calculations also don't jibe with what
> I see in PPC-elf64abi.txt.  The document shows the calculations "(S + A) >>
> 2" and "#lo(S + A) >> 2".  I take this to mean that the symbol value plus
> addend should be shifted right two bits before being stored at the r_offset
> address.  Otherwise it would be the same as the non-_DS variants.  But
> powerpc64/dl-machine.h treats them the same except for the error checking.
> Is that really supposed to be the only difference between
> e.g. R_PPC64_ADDR16 and R_PPC64_ADDR16_DS?

What you're missing is the description of the half16ds field, which
is a half16 field without the bottom two bits.  So we calculated the
field value with ">> 2" then install to a 16 bit word with "<< 2", or
equivalently, forget about the shifts and instead mask.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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