While investigating the remaining testsuite failures in libstdc++, the
GNU C++ runtime library, on GCC mainline, I came across two that were
due to the fact that static destructors weren't run in the order
prescribed by the C++ Standard:

        PATCH: Reguire __cxa_atexit for ext/{new, 
throw}_allocator/deallocate_global.cc
        http://gcc.gnu.org/ml/gcc-patches/2010-02/msg00995.html

While looking into atexit in libc, I found a reference to
_get_exit_frame_monitor, which is used by libCrun to deal with exactly
this problem.  Unfortunately, there isn't enough information to use this
as is, and the interface is Contract Private, thus unappropriate for use
in GCC without a contract.

I've been told that this was introduced in

        PSARC 1999/485 atexit support for C++

(not in the caselog).

As a first step to remedy this and to allow this part of G++ to be
standards conformant, I'd like to ask that this case (and possible
followup cases) be opened to determine how to proceed from there.  I see
two possible ways forward:

* Establish a contract for GCC to use those interfaces as is.

* On most other platforms, GCC uses the __cxa_atexit interface to handle
  exactly this problem.  This is a function defined in the Itanium C++
  ABI (which GCC uses on every platform, not only IA-64):

        Itanium C++ ABI ($Revision: 1.86 $)
        3.3.5 DSO Object Destruction API 
        http://www.codesourcery.com/public/cxx-abi/abi.html#dso-dtor

  Maybe it is possible to implement (part of) that ABI as a Comitted
  interface in libc, perhaps prototyped in a private implemenation in
  GCC first.

This would allow Solaris 2 to be a first-class GCC citizen and improve
the user experience considerably.

Thanks.
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to