os/kernelhwsrv/kernel/eka/compsupp/rvct2_1/ucppinit.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/compsupp/rvct2_1/ucppinit.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,50 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "ARM EABI LICENCE.txt"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// in kernel/eka/compsupp.
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// toplevel initialization/destruction routines for 'user side' code compiled 
    1.18 +// with the ARMEDG compiler. intended for static linking
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +#include "cppinit.h"
    1.23 +
    1.24 +NUKE_SYMBOL(__call_ctors(void));
    1.25 +NUKE_SYMBOL(__call_dtors(void));
    1.26 +
    1.27 +extern "C" {
    1.28 +// linker symbols 
    1.29 +__weak PFV C$$pi_ctorvec$$Base;
    1.30 +__weak PFV C$$pi_ctorvec$$Limit;
    1.31 +__weak void _fp_init(void);
    1.32 +
    1.33 +
    1.34 +// This calls each of the compiler constructed functions referenced from pi_ctorvec.
    1.35 +// These functions arrange to 'call' the appropriate constructor for the 'static' instance
    1.36 +// (in fact the call may be inlined). If the class of the instance has a destructor then 
    1.37 +// compiler records that this object needs 'destructing' at 'exit' time. It does this by 
    1.38 +// calling the function __cxa_atexit. We provide our own definition of this.
    1.39 +// 
    1.40 +void __cpp_initialise(void)
    1.41 +    {
    1.42 +    void (*fp_init_fn)(void) = _fp_init;
    1.43 +    if (fp_init_fn) fp_init_fn();
    1.44 +    PFV * ctor_vec = &C$$pi_ctorvec$$Base;
    1.45 +    PFV * ctor_limit = &C$$pi_ctorvec$$Limit;
    1.46 +    for(; ctor_vec < ctor_limit; ctor_vec++) (RELOCATE(ctor_vec, PFV))();
    1.47 +    }
    1.48 +}	  
    1.49 +
    1.50 +
    1.51 +
    1.52 +
    1.53 +