author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
sl@0 | 2 |
// All rights reserved. |
sl@0 | 3 |
// This component and the accompanying materials are made available |
sl@0 | 4 |
// under the terms of the License "ARM EABI LICENCE.txt" |
sl@0 | 5 |
// which accompanies this distribution, and is available |
sl@0 | 6 |
// in kernel/eka/compsupp. |
sl@0 | 7 |
// |
sl@0 | 8 |
// Initial Contributors: |
sl@0 | 9 |
// Nokia Corporation - initial contribution. |
sl@0 | 10 |
// |
sl@0 | 11 |
// Contributors: |
sl@0 | 12 |
// |
sl@0 | 13 |
// Description: |
sl@0 | 14 |
// toplevel destruction routines for 'user side' code compiled |
sl@0 | 15 |
// with the ARMEDG compiler. |
sl@0 | 16 |
// |
sl@0 | 17 |
// |
sl@0 | 18 |
|
sl@0 | 19 |
#include "cppinit.h" |
sl@0 | 20 |
|
sl@0 | 21 |
extern "C" { |
sl@0 | 22 |
|
sl@0 | 23 |
// Need to decide what this should do |
sl@0 | 24 |
//void CppInitializationPanic(){}; |
sl@0 | 25 |
|
sl@0 | 26 |
#define MAX_DTOR_RECORDS 256 |
sl@0 | 27 |
static dtd dtor_rec[MAX_DTOR_RECORDS]; |
sl@0 | 28 |
|
sl@0 | 29 |
typedef dtd **dso_handle; |
sl@0 | 30 |
dtd * __dso_handle = &dtor_rec[MAX_DTOR_RECORDS]; |
sl@0 | 31 |
|
sl@0 | 32 |
int __cxa_atexit ( void (*f)(void *), void *p, dso_handle d ) |
sl@0 | 33 |
{ |
sl@0 | 34 |
dtd * drec = *d; |
sl@0 | 35 |
drec--; |
sl@0 | 36 |
// This is what the spec says to do!! |
sl@0 | 37 |
if (drec < &dtor_rec[0]) return -1; |
sl@0 | 38 |
|
sl@0 | 39 |
drec->dtor = f; |
sl@0 | 40 |
drec->obj = p; |
sl@0 | 41 |
*d = drec; |
sl@0 | 42 |
return 0; |
sl@0 | 43 |
} |
sl@0 | 44 |
|
sl@0 | 45 |
void __cxa_finalize ( dso_handle d ) |
sl@0 | 46 |
{ |
sl@0 | 47 |
dtd * drec = * d; |
sl@0 | 48 |
dtd * lim = &dtor_rec[MAX_DTOR_RECORDS]; |
sl@0 | 49 |
while (drec < lim) |
sl@0 | 50 |
{ |
sl@0 | 51 |
drec->dtor(drec->obj); |
sl@0 | 52 |
drec++; |
sl@0 | 53 |
} |
sl@0 | 54 |
*d = drec; |
sl@0 | 55 |
} |
sl@0 | 56 |
|
sl@0 | 57 |
void run_static_dtors (void) |
sl@0 | 58 |
{ |
sl@0 | 59 |
__cxa_finalize(&__dso_handle); |
sl@0 | 60 |
} |
sl@0 | 61 |
} |
sl@0 | 62 |