Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "ARM EABI LICENCE.txt"
5 // which accompanies this distribution, and is available
6 // in kernel/eka/compsupp.
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // toplevel destruction routines for 'user side' code compiled
15 // with the ARMEDG compiler.
23 #define MAX_DTOR_RECORDS 256
24 static dtd dtor_rec[MAX_DTOR_RECORDS];
26 typedef dtd **dso_handle;
27 dtd * __dso_handle = &dtor_rec[MAX_DTOR_RECORDS];
29 void __cxa_finalize ( dso_handle d );
31 // Need to decide what this should do we run out of dtor space.
32 // Probably need to run __cxa_finalize then do some kind of panic.
33 void CppBSSInitializationError()
35 // __cxa_finalize(&dtor_rec[0]);
38 // This is called by compiler generated code to record needed destructions of
39 // dynamically initialized (ctor) top level (BSS) data.
40 // I guess this is more efficient for the compiler than __cxa_atexit, since
41 // it takes the object that needs dtoring as its first arg, which means its in
42 // the right register when the ctor returns.
43 void __aeabi_atexit(void *aObject, void (*aDtor)(void *), dso_handle aHandle)
45 dtd * drec = *aHandle;
48 if (drec < &dtor_rec[0])
49 // Need to decide what to do here
50 return CppBSSInitializationError();
57 int __cxa_atexit ( void (*aDtor)(void *), void *aObject, dso_handle aHandle )
59 __aeabi_atexit(aObject, aDtor, aHandle);
61 // This is what the C++ GABI spec says to do!!
62 if (*aHandle < &dtor_rec[0])
67 void __cxa_finalize ( dso_handle d )
70 dtd * lim = &dtor_rec[MAX_DTOR_RECORDS];
73 drec->dtor(drec->obj);
79 void run_static_dtors (void)
81 __cxa_finalize(&__dso_handle);