You can use either the Arm® C and C++ libraries or platform libraries with the SysV linking model.
Use of the Arm® C and
C++ libraries
You can use the Arm C and C++ libraries with the SysV linking model by statically linking the main executable with them. You must appropriately retarget the library for the platform.
Note:
When performing the standard library selection as described in C3.10 How the linker searches for the Arm® standard libraries, the linker selects the best-suited variants of the C and C++ libraries with the SysV linking model by statically linking the main executable with them. You must appropriately retarget the library for the platform.Arm C and C++ libraries based only on the attributes of input objects that are used to build the main executable. Shared libraries used in the link and their input objects do not affect the library selection
Integration with a dynamic loader
The Arm C and C++ libraries with the SysV linking model by statically linking the main C library executes pre-initialization (.prenit_array) and initialization functions (.init_array) that are present only in the main executable. The library is not aware of initialization functions in loaded shared objects.
To enable running initialization routines in the whole program, you can link
the main executable with armlink
--no_preinit--no_cppinit and provide custom implementation of
__arm_preinit_() and
__cpp_initialize__aeabi_(). The overridden functions
must integrate with a platform dynamic loader to execute all initialization
functions.
The dynamic loader can use dynamic entries DT_PREINIT_ARRAY,
DT_INIT_ARRAY, DT_INIT to obtain
initialization functions in the executable and each shared object.
The Arm C++
library by default supports exceptions only in the main executable. To allow
exceptions in loaded shared objects, you can provide implementation of
__arm_find_exidx_section() (in AArch32 state) and
__arm_find_eh_frame_hdr_section() (in AArch64
state):
The
functions receive an address of code that needs to be unwound and must find
an exception-index section associated with this location. Parameter
target_addr specifies an address of code that needs to
be unwound. Parameters base and length
point to values that must be set by the function to the address and size of
the found exception-index section. Return value 0 indicates
success, non-zero value indicates a failure. The dynamic loader can use
segments PT_ARM_EXIDX (in AArch32 state) and
PT_GNU_EH_FRAME (in AArch64 state) to locate the
exception-index sections.
Use of the platform C and C++ libraries
It is possible to use system libraries that come with the target platform.
The code of the program must be compiled with the -nostdlib and -nostdlibincarmclang command-line options to indicate to the compiler to not use the Arm C and C++ libraries.
Executable and shared objects should be linked with the --no_scanlibarmlink command-line option.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.