os/kernelhwsrv/kernel/eka/compsupp/rvct2_2/ucppinit.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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 initialization/destruction routines for 'user side' code compiled 
sl@0
    15
// with the ARMEDG compiler. intended for static linking
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
#include "cppinit.h"
sl@0
    20
sl@0
    21
NUKE_SYMBOL(__call_ctors(void));
sl@0
    22
NUKE_SYMBOL(__call_dtors(void));
sl@0
    23
sl@0
    24
extern "C" {
sl@0
    25
// linker symbols 
sl@0
    26
__weak PFV C$$pi_ctorvec$$Base;
sl@0
    27
__weak PFV C$$pi_ctorvec$$Limit;
sl@0
    28
__weak void _fp_init(void);
sl@0
    29
sl@0
    30
sl@0
    31
// This calls each of the compiler constructed functions referenced from pi_ctorvec.
sl@0
    32
// These functions arrange to 'call' the appropriate constructor for the 'static' instance
sl@0
    33
// (in fact the call may be inlined). If the class of the instance has a destructor then 
sl@0
    34
// compiler records that this object needs 'destructing' at 'exit' time. It does this by 
sl@0
    35
// calling the function __cxa_atexit. We provide our own definition of this.
sl@0
    36
// 
sl@0
    37
void __cpp_initialise(void)
sl@0
    38
    {
sl@0
    39
    void (*fp_init_fn)(void) = _fp_init;
sl@0
    40
    if (fp_init_fn) fp_init_fn();
sl@0
    41
    PFV * ctor_vec = &C$$pi_ctorvec$$Base;
sl@0
    42
    PFV * ctor_limit = &C$$pi_ctorvec$$Limit;
sl@0
    43
    for(; ctor_vec < ctor_limit; ctor_vec++) (RELOCATE(ctor_vec, PFV))();
sl@0
    44
    }
sl@0
    45
}	  
sl@0
    46
sl@0
    47
sl@0
    48
sl@0
    49
sl@0
    50