[cxx-abi-dev] Typo in ABI document

Martin v. Löwis loewis at informatik.hu-berlin.de
Fri Apr 12 09:11:38 UTC 2002


Jim Dehnert <dehnert at transmeta.com> writes:

> This is correct as it stands, though it may be confusing.  I'll explain
> more carefully what I meant in case that's the only problem.  The "value"
> of a linker symbol is the same thing as the address of a variable with
> that name.  The first requirement is simply that the linker associate a
> symbol (named __dso_handle) with some address in the object's data space.
> It therefore appears to C code that there is a variable named
> __dso_handle at the selected address, though there isn't any relevant
> data at that address.  When calling __cxa_finalize, we need to pass the
> address associated with __dso_handle, not the data at that address.
> We accomplish that by passing &__dso_handle.  The value of the resulting
> pointer parameter is what __cxa_finalize needs -- it doesn't need to
> dereference the pointer, as there's no data of interest at that address.
> 
> Does that help?

I agree with Jim's explanation: the idea is that each DSO has a
variable _dso_handle, and its *address* is the key for registering the
atexit handlers. Using the *value* of _dso_handle is error-prone;
also, it never says how much storage is allocate for the variable - '0
bytes' would be acceptable.

Regards,
Martin



More information about the cxx-abi-dev mailing list