|Non-Confidential||PDF version||ARM 100073_0608_00_en|
|Home > The ARM C and C++ Libraries > Multithreaded support in ARM C libraries > Use of static data in the C libraries|
Static data refers to persistent read/write data that is not stored on the stack or the heap. Callouts from the C library enable access to static data.
Static data can be external or internal in scope, and is:
-fnorwpi. This is the default.
r9, when compiled with
pc), when compiled with
Libraries that use static data might be reentrant, but this depends on
their use of the
__user_libspace static data area, and on
the build options you choose:
-fnorwpi, read/write static data is addressed in a position-dependent fashion. This is the default. Code from these variants is single-threaded because it uses read/write static data.
-frwpi, read/write static data is addressed in a position-independent fashion using offsets from the static base register
sb. Code from these variants is reentrant and can be multithreaded if each thread uses a different static base value.
The following describes how the C libraries use static data:
fj_*do not use static data and are always reentrant. For software floating-point, the
g_*libraries use static data to store the Floating-Point (FP) status word. For hardware floating-point, the
g_*libraries do not use static data.
-frwpiand the callers use different values in
Callouts from the C library enable access to static data. C library functions that use static data can be categorized as:
When the C library does something that requires implicit static data, it uses a callout to a function you can replace. These functions are shown in the following table. They do not use semihosting.
Table 1-1 C library callouts
||Called to get the address of the variable
||Called by the floating-point support code to get the address of the floating-point status word|
The default implementation of
__user_libspace creates a 96-byte block in the ZI region. Even if your
application does not have a
main() function, the
__user_libspace() function does not normally have to be