New powerpc vdso calling convention
Segher Boessenkool
segher at kernel.crashing.org
Wed May 6 07:56:24 AEST 2020
Hi!
On Wed, Apr 29, 2020 at 12:39:22PM +1000, Nicholas Piggin wrote:
> Excerpts from Adhemerval Zanella's message of April 27, 2020 11:09 pm:
> >> Right, I'm just talking about those comments -- it seems like the kernel
> >> vdso should contain an .opd section with function descriptors in it for
> >> elfv1 calls, rather than the hack it has now of creating one in the
> >> caller's .data section.
> >>
> >> But all that function descriptor code is gated by
> >>
> >> #if (defined(__PPC64__) || defined(__powerpc64__)) && _CALL_ELF != 2
> >>
> >> So it seems PPC32 does not use function descriptors but a direct pointer
> >> to the entry point like PPC64 with ELFv2.
> >
> > Yes, this hack is only for ELFv1. The missing ODP has not been an issue
> > or glibc because it has been using the inline assembly to emulate the
> > functions call since initial vDSO support (INTERNAL_VSYSCALL_CALL_TYPE).
> > It just has become an issue when I added a ifunc optimization to
> > gettimeofday so it can bypass the libc.so and make plt branch to vDSO
> > directly.
>
> I can't understand if it's actually a problem for you or not.
>
> Regardless if you can hack around it, it seems to me that if we're going
> to add sane calling conventions to the vdso, then we should also just
> have a .opd section for it as well, whether or not a particular libc
> requires it.
An OPD ("official procedure descriptor") is required for every function,
to have proper C semantics, so that pointers to functions (which are
pointers to descriptors, in fact) are unique. You can "manually" make
descriptors just fine, and use those to call functions -- but you cannot
(in general) use a pointer to such a "fake" descriptor as the "id" of
the function.
The way the ABIs define the OPDs makes them guaranteed unique.
Segher
More information about the Linuxppc-dev
mailing list