This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: __cxa_atexit question
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: mark at codesourcery dot com
- Cc: drepper at redhat dot com, bkoz at redhat dot com, libstdc++ at gcc dot gnu dot org
- Date: Thu, 18 May 2006 11:34:06 -0700 (PDT)
- Subject: Re: __cxa_atexit question
> I do not know what (or if) system-specific tricks are used to make sure
> that the libCsup.so version of atexit is used instead of the libc.so
> version when a C shared library is incorporated into a C++ application.
> However, I do see that atexit is reported as WEAK PROTECTED by readelf
> in libc, and as GLOBAL DEFAULT in libCsup. Perhaps Steve can tell us
> exactly what is being done.
The WEAK does not do anything, the PROTECTED means that if there were a
call to atexit from libc itself it would use the atexit in libc (make a
direct call). I don't think there are any calls to atexit in libc
though. So basically, which atexit you get depends on the binding order
of the libraries, the first one found gets used. Since libc is usually
specified last you should get the libCsup version in all normal cases,
but you could probably make a program pick up the libc version if you
did a link line with -lc before -lCsup.
Steve Ellcey
sje@cup.hp.com