wide function pointer type

Martin Uecker ma.uecker@gmail.com
Mon Oct 18 07:56:14 GMT 2021


Am Montag, den 18.10.2021, 09:36 +0200 schrieb Florian Weimer:
> * Martin Uecker via Libffi-discuss:
> 
> > In particular, I would be good to know whether
> > implementing a perfectly forwarding stub for
> > a variadic functions that loads the static
> > is possible on all architectures. I assume so,
> > but I am not entirely sure.
> 
> Are you asking if it is possible to consume an argument in a variadic
> wrapper and forward the remaining arguments to a variadic function?  The
> answer to that is no.

Yes, I assumed this does not work. The question 
is more whether architectures exist where the
existing ABI states that the static chain has to be
passed as a first argument (which would then need to be
removed when calling a regular function).

The implementation most architectures
would use is that 1) the static chain is loaded from
the wide pointer 2) stored in the designated register
or stack slot and then 3) a call is performed
using the same calling convention as used for
regular functions.

If a regular function is converted to a wide pointer,
then the static chain would simply be NULL which
should not affect the function.


Martin





More information about the Libffi-discuss mailing list