ARM® Compiler toolchain Using ARM C and C++ Libraries and Floating-Point Support

Version 5.01


List of Topics

Conventions and feedback
The ARM C and C++ libraries
Mandatory linkage with the C library
C and C++ runtime libraries
C and C++ library features
Library heap usage requirements of the ARM C and C++ libraries
Compliance with the Application Binary Interface (ABI) for the ARM architecture
Increasing portability of object files to other CLIBABI implementations
ARM C and C++ library directory structure
Selection of ARM C and C++ library variants based on build options
Thumb C libraries
C++ and C libraries and the std namespace
ARM C libraries and multithreading
ARM C libraries and reentrant functions
ARM C libraries and thread-safe functions
Use of static data in the C libraries
Use of the __user_libspace static data area by the C libraries
C library functions to access subsections of the __user_libspace static data area
Re-implementation of legacy function __user_libspace() in the C library
Management of locks in multithreaded applications
How to ensure re-implemented mutex functions are called
Using the ARM C library in a multithreaded environment
Thread safety in the ARM C library
Thread safety in the ARM C++ library
The floating-point status word in a multithreaded environment
Using the C library with an application
Using the C and C++ libraries with an application in a semihosting environment
Using $Sub$$ to mix semihosted and nonsemihosted I/O functionality
Using the libraries in a nonsemihosting environment
C++ exceptions in a non-semihosting environment
Direct semihosting C library function dependencies
Indirect semihosting C library function dependencies
C library API definitions for targeting a different environment
Building an application without the C library
Creating an application as bare machine C without the C library
Integer and floating-point compiler functions and building an application without the C library
Bare machine integer C
Bare machine C with floating-point processing
Customized C library startup code and access to C library functions
Program design when exploiting the C library
Using low-level functions when exploiting the C library
Using high-level functions when exploiting the C library
Using malloc() when exploiting the C library
Tailoring the C library to a new execution environment
How C and C++ programs use the library functions
Initialization of the execution environment and execution of the application
C++ initialization, construction and destruction
Legacy support for C$$pi_ctorvec instead of .init_array
Exceptions system initialization
Emergency buffer memory for exceptions
Library functions called from main()
Program exit and the assert macro
Assembler macros that tailor locale functions in the C library
Link time selection of the locale subsystem in the C library
ISO8859-1 implementation
Shift-JIS and UTF-8 implementation
Runtime selection of the locale subsystem in the C library
Definition of locale data blocks in the C library
LC_CTYPE data block
LC_COLLATE data block
LC_MONETARY data block
LC_NUMERIC data block
LC_TIME data block
Modification of C library functions for error signaling, error handling, and program exit
Modification of memory management functions in the C library
Avoiding the heap and heap-using library functions supplied by ARM
C library support for memory allocation functions
Heap1, standard heap implementation
Heap2, alternative heap implementation
Using a heap implementation from bare machine C
Stack pointer initialization and heap bounds
Defining __initial_sp, __heap_base and __heap_limit
Extending heap size at runtime
Legacy support for __user_initial_stackheap()
Tailoring input/output functions in the C and C++ libraries
Target dependencies on low-level functions in the C and C++ libraries
The C library printf family of functions
The C library scanf family of functions
Redefining low-level library functions to enable direct use of high-level library functions in the C library
The C library functions fread(), fgets() and gets()
Re-implementing __backspace() in the C library
Re-implementing __backspacewc() in the C library
Redefining target-dependent system I/O functions in the C library
Tailoring non-input/output C library functions
Real-time integer division in the ARM libraries
Selecting real-time division in the ARM libraries
How the ARM C library fulfills ISO C specification requirements
mathlib error handling
ISO-compliant implementation of signals supported by the signal() function in the C library and additional type arguments
ISO-compliant C library input/output characteristics
Standard C++ library implementation definition
C library functions and extensions
Persistence of C and C++ library names across releases of the ARM compilation tools
Link time selection of C and C++ libraries
Managing projects that have explicit C or C++ library names in makefiles
Compiler generated and library-resident helper functions
C and C++ library naming conventions
Using macro__ARM_WCHAR_NO_IO to disable FILE declaration and wide I/O function prototypes
The ARM C micro-library
About microlib
Differences between microlib and the default C library
Library heap usage requirements of the ARM C micro-library
ISO C features missing from microlib
Building an application with microlib
Creating an initial stack pointer for use with microlib
Creating the heap for use with microlib
Entering and exiting programs linked with microlib
Tailoring the microlib input/output functions
Floating-point support
About floating-point support
The software floating-point library, fplib
Calling fplib routines
fplib arithmetic on numbers in a particular format
fplib conversions between floats, doubles, and ints
fplib conversion between long longs, floats, and doubles
fplib comparisons between floats and doubles
fplib C99 functions
Controlling the ARM floating-point environment
Floating-point functions for compatibility with Microsoft products
C99-compatible functions for controlling the ARM floating-point environment
C99 rounding mode and floating-point exception macros
Exception flag handling
Functions for handling rounding modes
Functions for saving and restoring the whole floating-point environment
Functions for temporarily disabling exceptions
ARM floating-point compiler extensions to the C99 interface
Writing a custom exception trap handler
Example of a custom exception handler
Exception trap handling by signals
Using C99 signalling NaNs provided by mathlib (_WANT_SNAN)
mathlib double and single-precision floating-point functions
Nonstandard functions in mathlib
IEEE 754 arithmetic
Basic data types for IEEE 754 arithmetic
Single precision data type for IEEE 754 arithmetic
Double precision data type for IEEE 754 arithmetic
Sample single precision floating-point values for IEEE 754 arithmetic
Sample double precision floating-point values for IEEE 754 arithmetic
IEEE 754 arithmetic and rounding
Exceptions arising from IEEE 754 floating-point arithmetic
Ignoring exceptions from IEEE 754 floating-point arithmetic operations
Trapping exceptions from IEEE 754 floating-point arithmetic operations
Exception types recognized by the ARM floating-point environment
Using the Vector Floating-Point (VFP) support libraries
Revisions for Using ARM C and C++ Libraries and Floating-Point Support

Proprietary Notice

Words and logos marked with ™ or ® are registered trademarks or trademarks of ARM in the EU and other countries, except as otherwise stated below in this proprietary notice. Other brands and names mentioned herein may be the trademarks of their respective owners.

Neither the whole nor any part of the information contained in, or the product described in, this document may be adapted or reproduced in any material form except with the prior written permission of the copyright holder.

The product described in this document is subject to continuous developments and improvements. All particulars of the product and its use contained in this document are given by ARM in good faith. However, all warranties implied or expressed, including but not limited to implied warranties of merchantability, or fitness for purpose, are excluded.

This document is intended only to assist the reader in the use of the product. ARM shall not be liable for any loss or damage arising from the use of any information in this document, or any error or omission in such information, or any incorrect use of the product.

Where the term ARM is used it means “ARM or any of its subsidiaries as appropriate”.

Some material in this document is based on IEEE 754 - 1985 IEEE Standard for Binary Floating-Point Arithmetic. The IEEE disclaims any responsibility or liability resulting from the placement and use in the described manner.

Confidentiality Status

This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in accordance with the terms of the agreement entered into by ARM and the party that ARM delivered this document to.

Product Status

The information in this document is final, that is for a developed product.

Revision History
Revision A28 May 2010ARM Compiler toolchain v4.1 Release
Revision B30 September 2010Update 1 for ARM Compiler toolchain v4.1
Revision C28 January 2011Update 2 for ARM Compiler toolchain v4.1 Patch 3
Revision D30 April 2011ARM Compiler toolchain v5.0 Release
Revision E29 July 2011Update 1 for ARM Compiler toolchain v5.0
Revision F30 August 2011ARM Compiler toolchain v5.01 Release
Revision G29 February 2012Document update 1 for ARM Compiler toolchain v5.01 Release
Copyright © 2010-2012 ARM. All rights reserved.ARM DUI 0475G
Non-ConfidentialID021412