sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "ARM EABI LICENCE.txt" sl@0: // which accompanies this distribution, and is available sl@0: // in kernel/eka/compsupp. sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // toplevel initialization/destruction routines for 'user side' code compiled sl@0: // with the ARMEDG compiler. intended for static linking sl@0: // sl@0: // sl@0: sl@0: #include "cppinit.h" sl@0: sl@0: NUKE_SYMBOL(__call_ctors(void)); sl@0: NUKE_SYMBOL(__call_dtors(void)); sl@0: sl@0: extern "C" { sl@0: // linker symbols sl@0: __weak PFV C$$pi_ctorvec$$Base; sl@0: __weak PFV C$$pi_ctorvec$$Limit; sl@0: __weak void _fp_init(void); sl@0: sl@0: sl@0: // This calls each of the compiler constructed functions referenced from pi_ctorvec. sl@0: // These functions arrange to 'call' the appropriate constructor for the 'static' instance sl@0: // (in fact the call may be inlined). If the class of the instance has a destructor then sl@0: // compiler records that this object needs 'destructing' at 'exit' time. It does this by sl@0: // calling the function __cxa_atexit. We provide our own definition of this. sl@0: // sl@0: void __cpp_initialise(void) sl@0: { sl@0: void (*fp_init_fn)(void) = _fp_init; sl@0: if (fp_init_fn) fp_init_fn(); sl@0: PFV * ctor_vec = &C$$pi_ctorvec$$Base; sl@0: PFV * ctor_limit = &C$$pi_ctorvec$$Limit; sl@0: for(; ctor_vec < ctor_limit; ctor_vec++) (RELOCATE(ctor_vec, PFV))(); sl@0: } sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: