This is the mail archive of the
mailing list for the glibc project.
Re: [RFC PATCH] Introduce pt-compat-stubs and use it to replace pt-vfork. (Architecture maintainer feedback wanted.)
On Fri, Mar 23, 2018 at 03:32:09PM -0400, Zack Weinberg wrote:
> On Thu, Mar 22, 2018 at 7:47 PM, Alan Modra <firstname.lastname@example.org> wrote:
> > ELFv1 code would look like:
> > .section .opd,"aw",@progbits
> > .global __pstub_vfork
> > .type __pstub_vfork,@function
> > __pstub_vfork:
> > .quad 0f,.TOC.,0
> > .text
> > 0:
> > addis 11,2,1f-0b@ha
> > addi 11,11,1f-0b@l
> Is this really correct? 1f-0b here is the offset from the beginning
> of the function to the global it wants to reference in .data, but r2
> is the TOC pointer, not the beginning of the function.
No, it's broken, sorry. Not enough editing when copying the ELFv2
or better, since we do have the required relocs in this case
Hmm, I also missed a ".p2align 3" when emitting the address to .data,
and didn't write a proper OPD entry. :-( You could also put the
function pointer in .toc which would be better for relro and huge
ELFv1 shared libraries (not the case here but nicer example code for
others to copy), or in .data.rel.ro.
Revised ELFv1 code
In reply to your other email, the third load is the static chain and
can be omitted for C. I also happen to have been working on inline
plt call support for powerpc ld, which will give you the ability to
write stubs that support lazy linking.
Australia Development Lab, IBM