4.27 __rt_lib_init()

Defined in rt_misc.h, this is the library initialization function and is the companion to __rt_lib_shutdown().

Syntax

For AArch32 targets:

extern __attribute__((value_in_regs)) struct __argc_argv __rt_lib_init(unsigned heapbase, unsigned heaptop);

For AArch64 targets:

extern __attribute__((value_in_regs)) struct __argc_argv __rt_lib_init(unsigned long heapbase, unsigned long heaptop);

where:

heapbase

is the start of the heap memory block.

heaptop

is the end of the heap memory block.

Usage

This function is called immediately after __rt_stackheap_init() and is passed an initial chunk of memory to use as a heap. This function is the standard ARM® C library initialization function and it must not be reimplemented.

Returns

This function returns argc and argv ready to be passed to main(). The structure is returned in the registers.

For AArch32 targets:

struct __argc_argv
{   int argc;
    char **argv;
    void *r2;  // optional extra arguments that on entry to main() are
    void *r3;  // found in registers R2 and R3.
};

For AArch64 targets:

struct __argc_argv
{   long argc;
    char **argv;
    void *r2;  // optional extra arguments that on entry to main() are
    void *r3;  // found in registers X2 (alias for R2) and X3 (alias for R3).
}; 
Non-ConfidentialPDF file icon PDF versionARM 100073_0607_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.