|Non-Confidential||PDF version||ARM 100073_0607_00_en|
|Home > The ARM C and C++ Libraries > Tailoring the C library to a new execution environment > Initialization of the execution environment and execution of the application|
You can customize execution initialization by defining your own __main that branches to __rt_entry.
The entry point of a program is at __main in the C library where library code:
Copies non-root (RO and RW) execution regions from their load addresses to their execution addresses. Also, if any data sections are compressed, they are decompressed from the load address to the execution address.
Zeroes ZI regions.
Branches to __rt_entry.
If you do not want the library to perform these actions,
you can define your own __main that branches to
__rt_entry. Use the
armclang option or
--entry armlink option to specify __main as
the entry point. For example:
.global __rt_entry .global __main __main: B__rt_entry
The library function
__rt_entry() runs the
program as follows:
Sets up the stack and the heap by one of a number of means that include
__rt_stackheap_init(), or loading the absolute addresses of
__rt_lib_init() to initialize
referenced library functions, initialize the locale and, if necessary, set up argc and argv for
For C++, calls the constructors for any top-level objects by way of __cpp_initialize__aeabi_.
main(), the user-level root of
main(), your program might call,
among other things, library functions.
exit() with the value returned