sizeof(function pointer)

Alexander Kabaev kabaev at gmail.com
Wed Jun 1 15:44:21 UTC 2011


On Tue, 31 May 2011 21:09:10 -0700
Marcel Moolenaar <marcel at xcllnt.net> wrote:

> 
> On May 31, 2011, at 5:06 PM, Alexander Kabaev wrote:
> >> Usually it is different only on segmented architectures like 16-bit
> >> x86.
> >> 
> > 
> > Not so on ia64, where they have special function descriptor type.
> 
> Actually, no. On ia64 a function pointer has the same size as a
> data pointer. It's just that a function pointer does not point
> to the actual function (i.e. the first instruction of a function),
> but to a function descriptor. The function descriptor contains the
> address of the actual function and the value of the GP register
> that needs to be set before entering the function.
> 
> As such, only virtual functions in C++ are impacted by this. The
> function descriptor needs to be stored in the object instead of
> the function pointer in that case.
> 
> FYI,
> 
> -- 
Oh, you are correct. I forgot the double indirection we do to support
that in dlsym, where we are maintain our own 'virtual table' of
function descriptors within rtld itself.
-- 
Alexander Kabaev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110601/66c15671/signature.pgp


More information about the freebsd-hackers mailing list