equal
deleted
inserted
replaced
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. |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // toplevel destruction routines for 'user side' code compiled |
|
15 // with the ARMEDG compiler. |
|
16 // |
|
17 // |
|
18 |
|
19 #include "cppinit.h" |
|
20 |
|
21 extern "C" { |
|
22 |
|
23 // Need to decide what this should do |
|
24 //void CppInitializationPanic(){}; |
|
25 |
|
26 #define MAX_DTOR_RECORDS 256 |
|
27 static dtd dtor_rec[MAX_DTOR_RECORDS]; |
|
28 |
|
29 typedef dtd **dso_handle; |
|
30 dtd * __dso_handle = &dtor_rec[MAX_DTOR_RECORDS]; |
|
31 |
|
32 int __cxa_atexit ( void (*f)(void *), void *p, dso_handle d ) |
|
33 { |
|
34 dtd * drec = *d; |
|
35 drec--; |
|
36 // This is what the spec says to do!! |
|
37 if (drec < &dtor_rec[0]) return -1; |
|
38 |
|
39 drec->dtor = f; |
|
40 drec->obj = p; |
|
41 *d = drec; |
|
42 return 0; |
|
43 } |
|
44 |
|
45 void __cxa_finalize ( dso_handle d ) |
|
46 { |
|
47 dtd * drec = * d; |
|
48 dtd * lim = &dtor_rec[MAX_DTOR_RECORDS]; |
|
49 while (drec < lim) |
|
50 { |
|
51 drec->dtor(drec->obj); |
|
52 drec++; |
|
53 } |
|
54 *d = drec; |
|
55 } |
|
56 |
|
57 void run_static_dtors (void) |
|
58 { |
|
59 __cxa_finalize(&__dso_handle); |
|
60 } |
|
61 } |
|
62 |
|