14.4 C and C++ library changes between RVCT v2.2 and RVCT v3.0

Various changes have been made to the ARM C and C++ library in RVCT v3.0.

The function __user_initial_stackheap() sets up and returns the locations of the initial stack and heap. In RVCT v3.x and later, ARM recommends you modify your source code to use __user_setup_stackheap() instead. __user_initial_stackheap() is still supported for backwards compatibility with earlier versions of the ARM C and C++ libraries.

If you continue to use __user_initial_stackheap(), be aware of the following changes in RVCT v3.0.

  • In RVCT v2.x and earlier, the default implementation of __user_initial_stackheap() uses the value of the symbol Image$$ZI$$Limit. This symbol is not defined if you specify a scatter file using the --scatter linker command line option. Therefore, you must re-implement __user_initial_stackheap() to set the heap and stack boundaries if you are using a scatter file, otherwise your link step fails.

    In RVCT v3.x and later, multiple implementations of __user_initial_stackheap() are provided by the ARM C library. RVCT automatically selects the correct implementation using information given in the scatter file. This means that you do not have to re-implement this function if you are using scatter files.

  • When migrating your application from RVCT v2.2 to RVCT v3.0, you might see the following linker error:

    Error L6218E: Undefined symbol main (referred from kernel.o).
    

    The linker is reporting that your application does not include a main() function. The error is generated because of the way RVCT v3.0 selects from the multiple implementations of __user_initial_stackheap(). These implementations refer to the __rt_exit() function. This is contained in kernel.o, that also contains the __rt_lib_init() function. Because the __rt_lib_init() function calls main(), this results in an undefined symbol error when main() is not present.

    If you do not provide a main() function as the entry point of your C code, the simplest solution is to implement either:

    • An empty, dummy main() function.

    • A dummy implementation of __rt_exit().

    If one of these stubs is contained in a separate source file, it is usually removed by the unused section elimination feature of the linker so there is no overhead in the final linked image.

Non-ConfidentialPDF file icon PDF versionARM DUI0530M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.