ARM® Compiler ARM C and C++ Libraries and Floating-Point Support User Guide

Version 6.5


Table of Contents

Preface
About this book
Using this book
Glossary
Typographic conventions
Feedback
Other information
1 The ARM C and C++ Libraries
1.1 Support level definitions
1.2 Mandatory linkage with the C library
1.3 C and C++ runtime libraries
1.3.1 Summary of the C and C++ runtime libraries
1.3.2 Compliance with the Application Binary Interface (ABI) for the ARM architecture
1.3.3 Increasing portability of object files to other CLIBABI implementations
1.3.4 ARM C and C++ library directory structure
1.3.5 Selection of ARM® C and C++ library variants based on build options
1.3.6 T32 C libraries
1.4 C and C++ library features
1.5 C++ and C libraries and the std namespace
1.6 Multithreaded support in ARM C libraries
1.6.1 ARM C libraries and multithreading
1.6.2 ARM C libraries and reentrant functions
1.6.3 ARM C libraries and thread-safe functions
1.6.4 Use of static data in the C libraries
1.6.5 Use of the __user_libspace static data area by the C libraries
1.6.6 C library functions to access subsections of the __user_libspace static data area
1.6.7 Re-implementation of legacy function __user_libspace() in the C library
1.6.8 Management of locks in multithreaded applications
1.6.9 How to ensure re-implemented mutex functions are called
1.6.10 Using the ARM C library in a multithreaded environment
1.6.11 Thread safety in the ARM C library
1.6.12 Thread safety in the ARM C++ library
1.6.13 The floating-point status word in a multithreaded environment
1.7 Support for building an application with the C library
1.7.1 Using the C library with an application
1.7.2 Using the C and C++ libraries with an application in a semihosting environment
1.7.3 Using $Sub$$ to mix semihosted and nonsemihosted I/O functionality
1.7.4 Using the libraries in a nonsemihosting environment
1.7.5 Direct semihosting C library function dependencies
1.7.6 Indirect semihosting C library function dependencies
1.7.7 C library API definitions for targeting a different environment
1.8 Support for building an application without the C library
1.8.1 Building an application without the C library
1.8.2 Creating an application as bare machine C without the C library
1.8.3 Integer and floating-point compiler functions and building an application without the C library
1.8.4 Bare machine integer C
1.8.5 Bare machine C with floating-point processing
1.8.6 Customized C library startup code and access to C library functions
1.8.7 Using low-level functions when exploiting the C library
1.8.8 Using high-level functions when exploiting the C library
1.8.9 Using malloc() when exploiting the C library
1.9 Tailoring the C library to a new execution environment
1.9.1 Initialization of the execution environment and execution of the application
1.9.2 C++ initialization, construction and destruction
1.9.3 Exceptions system initialization
1.9.4 Library functions called from main()
1.9.5 Program exit and the assert macro
1.10 Assembler macros that tailor locale functions in the C library
1.10.1 Link time selection of the locale subsystem in the C library
1.10.2 Runtime selection of the locale subsystem in the C library
1.10.3 Definition of locale data blocks in the C library
1.10.4 LC_CTYPE data block
1.10.5 LC_COLLATE data block
1.10.6 LC_MONETARY data block
1.10.7 LC_NUMERIC data block
1.10.8 LC_TIME data block
1.11 Modification of C library functions for error signaling, error handling, and program exit
1.12 Stack and heap memory allocation and the ARM C and C++ libraries
1.12.1 Library heap usage requirements of the ARM C and C++ libraries
1.12.2 Choosing a heap implementation for memory allocation functions
1.12.3 Stack pointer initialization and heap bounds
1.12.4 Legacy support for __user_initial_stackheap()
1.12.5 Avoiding the heap and heap-using library functions supplied by ARM
1.13 Tailoring input/output functions in the C and C++ libraries
1.14 Target dependencies on low-level functions in the C and C++ libraries
1.15 The C library printf family of functions
1.16 The C library scanf family of functions
1.17 Redefining low-level library functions to enable direct use of high-level library functions in the C library
1.18 The C library functions fread(), fgets() and gets()
1.19 Re-implementing __backspace() in the C library
1.20 Re-implementing __backspacewc() in the C library
1.21 Redefining target-dependent system I/O functions in the C library
1.22 Tailoring non-input/output C library functions
1.23 Real-time integer division in the ARM libraries
1.24 ISO C library implementation definition
1.24.1 How the ARM C library fulfills ISO C specification requirements
1.24.2 mathlib error handling
1.24.3 ISO-compliant implementation of signals supported by the signal() function in the C library and additional type arguments
1.24.4 ISO-compliant C library input/output characteristics
1.24.5 Standard C++ library implementation definition
1.25 C library functions and extensions
1.26 C and C++ library naming conventions
1.27 Using macro__ARM_WCHAR_NO_IO to disable FILE declaration and wide I/O function prototypes
1.28 Using library functions with execute-only memory
2 The ARM C Micro-library
2.1 About microlib
2.2 Differences between microlib and the default C library
2.3 Library heap usage requirements of microlib
2.4 ISO C features missing from microlib
2.5 Building an application with microlib
2.6 Configuring the stack and heap for use with microlib
2.7 Entering and exiting programs linked with microlib
2.8 Tailoring the microlib input/output functions
3 Floating-point Support
3.1 About floating-point support
3.2 Controlling the ARM floating-point environment
3.2.1 Floating-point functions for compatibility with Microsoft products
3.2.2 C99-compatible functions for controlling the ARM floating-point environment
3.2.3 C99 rounding mode and floating-point exception macros
3.2.4 Exception flag handling
3.2.5 Functions for handling rounding modes
3.2.6 Functions for saving and restoring the whole floating-point environment
3.2.7 Functions for temporarily disabling exceptions
3.2.8 ARM floating-point compiler extensions to the C99 interface
3.2.9 Example of a custom exception handler
3.2.10 Exception trap handling by signals
3.3 mathlib double and single-precision floating-point functions
3.4 IEEE 754 arithmetic
3.4.1 Basic data types for IEEE 754 arithmetic
3.4.2 Single precision data type for IEEE 754 arithmetic
3.4.3 Double precision data type for IEEE 754 arithmetic
3.4.4 Sample single precision floating-point values for IEEE 754 arithmetic
3.4.5 Sample double precision floating-point values for IEEE 754 arithmetic
3.4.6 IEEE 754 arithmetic and rounding
3.4.7 Exceptions arising from IEEE 754 floating-point arithmetic
3.4.8 Exception types recognized by the ARM floating-point environment
4 The C and C++ Library Functions reference
4.1 __aeabi_errno_addr()
4.2 alloca()
4.3 clock()
4.4 _clock_init()
4.5 __default_signal_handler()
4.6 errno
4.7 _findlocale()
4.8 _fisatty()
4.9 _get_lconv()
4.10 getenv()
4.11 _getenv_init()
4.12 __heapstats()
4.13 __heapvalid()
4.14 lconv structure
4.15 localeconv()
4.16 _membitcpybl(), _membitcpybb(), _membitcpyhl(), _membitcpyhb(), _membitcpywl(), _membitcpywb(), _membitmovebl(), _membitmovebb(), _membitmovehl(), _membitmovehb(), _membitmovewl(), _membitmovewb()
4.17 posix_memalign()
4.18 __raise()
4.19 _rand_r()
4.20 remove()
4.21 rename()
4.22 __rt_entry
4.23 __rt_exit()
4.24 __rt_fp_status_addr()
4.25 __rt_heap_extend()
4.26 __rt_lib_init()
4.27 __rt_lib_shutdown()
4.28 __rt_raise()
4.29 __rt_stackheap_init()
4.30 setlocale()
4.31 _srand_r()
4.32 strcasecmp()
4.33 strncasecmp()
4.34 strlcat()
4.35 strlcpy()
4.36 _sys_close()
4.37 _sys_command_string()
4.38 _sys_ensure()
4.39 _sys_exit()
4.40 _sys_flen()
4.41 _sys_istty()
4.42 _sys_open()
4.43 _sys_read()
4.44 _sys_seek()
4.45 _sys_tmpnam()
4.46 _sys_write()
4.47 system()
4.48 time()
4.49 _ttywrch()
4.50 __user_heap_extend()
4.51 __user_heap_extent()
4.52 __user_setup_stackheap()
4.53 __vectab_stack_and_reset
4.54 wcscasecmp()
4.55 wcsncasecmp()
4.56 wcstombs()
4.57 Thread-safe C library functions
4.58 C library functions that are not thread-safe
4.59 Legacy function __user_initial_stackheap()
5 Floating-point Support Functions Reference
5.1 _clearfp()
5.2 _controlfp()
5.3 __fp_status()
5.4 gamma(), gamma_r()
5.5 __ieee_status()
5.6 j0(), j1(), jn(), Bessel functions of the first kind
5.7 significand(), fractional part of a number
5.8 _statusfp()
5.9 y0(), y1(), yn(), Bessel functions of the second kind

List of Figures

1-1 Integration boundaries in ARM Compiler 6.
3-1 IEEE 754 single-precision floating-point format
3-2 IEEE 754 double-precision floating-point format
5-1 Floating-point status word layout
5-2 IEEE status word layout

List of Tables

1-1 C library callouts
1-2 Direct semihosting dependencies
1-3 Indirect semihosting dependencies
1-4 Published API definitions
1-5 Standalone C library functions
1-6 Default ISO8859-1 locales
1-7 Default Shift-JIS and UTF-8 locales
1-8 Trap and error handling
1-9 Input/output dependencies
1-10 Signals supported by the signal() function
1-11 perror() messages
1-12 C library extensions
3-1 Sample single-precision floating-point values
3-2 Sample double-precision floating-point values
4-1 Functions that are thread-safe
4-2 Functions that are not thread-safe
5-1 _controlfp argument macros
5-2 Status word bit modification
5-3 Rounding mode control

Release Information

Document History
Issue Date Confidentiality Change
A 14 March 2014 Non-Confidential ARM Compiler v6.00 Release
B 15 December 2014 Non-Confidential ARM Compiler v6.01 Release
C 30 June 2015 Non-Confidential ARM Compiler v6.02 Release
D 18 November 2015 Non-Confidential ARM Compiler v6.3 Release
E 24 February 2016 Non-Confidential ARM Compiler v6.4 Release
F 29 June 2016 Non-Confidential ARM Compiler v6.5 Release

Non-Confidential Proprietary Notice

This document is protected by copyright and other related rights and the practice or implementation of the information contained in this document may be protected by one or more patents or pending patent applications. No part of this document may be reproduced in any form by any means without the express prior written permission of ARM. No license, express or implied, by estoppel or otherwise to any intellectual property rights is granted by this document unless specifically stated.
Your access to the information in this document is conditional upon your acceptance that you will not use or permit others to use the information for the purposes of determining whether implementations infringe any third party patents.
THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE DOCUMENT. For the avoidance of doubt, ARM makes no representation with respect to, and has undertaken no analysis to identify or understand the scope and content of, third party patents, copyrights, trade secrets, or other rights.
This document may include technical inaccuracies or typographical errors.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or disclosure of this document complies fully with any relevant export laws and regulations to assure that this document or any portion thereof is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in reference to ARM’s customers is not intended to create or refer to any partnership relationship with any other company. ARM may make changes to this document at any time and without notice.
If any of the provisions contained in these terms conflict with any of the provisions of any signed written agreement covering this document with ARM, then the signed written agreement prevails over and supersedes the conflicting provisions of these terms. This document may be translated into other languages for convenience, and you agree that if there is any conflict between the English version of this document and any translation, the terms of the English version of the Agreement shall prevail.
Copyright © 2014-2016, ARM Limited or its affiliates. All rights reserved.
ARM Limited. Company 02557590 registered in England.
110 Fulbourn Road, Cambridge, England CB1 9NJ.
LES-PRE-20349

Additional Notices

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.
Unrestricted Access is an ARM internal classification.

Product Status

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

Web Address

Non-ConfidentialPDF file icon PDF versionARM DUI0808F
Copyright © 2014-2016 ARM. All rights reserved.