This is the mail archive of the
mailing list for the glibc project.
Re: ppc relocs
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Roland McGrath <roland at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com, Paul Mackerras <paulus at samba dot org>, Steven Munroe <sjmunroe at us dot ibm dot com>
- Date: Sun, 2 Mar 2003 23:21:15 +1030
- Subject: Re: ppc relocs
- References: <200303021156.h22Buqs21416@magilla.sf.frob.com>
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?
> 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
> 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.
IBM OzLabs - Linux Technology Centre