ARM ® DeveloperSuite Compilers and Libraries Guide

Version 1.2


Table of Contents

Preface
About this book
Intended audience
Using this book
Typographical conventions
Further reading
Feedback
Feedback on the ARM Developer Suite
Feedback on this book
1. Introduction
1.1. About the compilers and libraries
1.2. The ARM compilers and libraries
1.2.1. The C and C++ compilers
1.2.2. The C and C++ libraries
1.3. Linking compiled objects
1.4. Related utilities
1.4.1. fromELF
1.4.2. armar
1.4.3. armprof
2. C and C++ Compilers
2.1. About the C and C++ compilers
2.1.1. Compiler variants
2.1.2. Source language modes
2.1.3. Inline assembly language
2.1.4. Library support
2.2. File usage
2.2.1. Naming conventions
2.2.2. Included files
2.3. Command syntax
2.3.1. Invoking the compiler
2.3.2. Procedure Call Standardoptions
2.3.3. Setting the source language
2.3.4. Specifying searchpaths
2.3.5. Setting preprocessor options
2.3.6. Specifying output format
2.3.7. Specifying the target processor orarchitecture
2.3.8. Generating debuginformation
2.3.9. Controlling code generation
2.3.10. Controlling warning messages
2.3.11. Specifying additional checks
2.3.12. Controlling error messages
3. ARM Compiler Reference
3.1. Compiler-specific features
3.1.1. Pragmas
3.1.2. Function keywords
3.1.3. Variable declaration keywords
3.2. Language extensions
3.2.1. C language extensions
3.2.2. C and C++ language extensions
3.3. C and C++ implementation details
3.3.1. Character sets and identifiers
3.3.2. Basic data types
3.3.3. Operations on basic data types
3.3.4. Structures, unions, enumerations,and bitfields
3.4. Predefined macros
4. The C and C++ Libraries
4.1. About the runtime libraries
4.1.1. Build options and library variants
4.1.2. Library directory structure
4.1.3. Reentrancy and static data
4.2. Building an application with the Clibrary
4.2.1. Building an application for a semihostedenvironment
4.2.2. Building an application for a nonsemihostedenvironment
4.3. Building an application without theC library
4.3.1. Integer and FP helper functions
4.3.2. Bare machine integer C
4.3.3. Bare machine C with floating-point
4.3.4. Exploiting the C library
4.3.5. The standalone C library functions
4.4. Tailoring the C library to a new executionenvironment
4.4.1. How C and C++ programs use the libraryfunctions
4.4.2. Exiting from the program
4.4.3. __rt_entry
4.4.4. __rt_exit()
4.4.5. __rt_lib_init()
4.4.6. __rt_lib_shutdown()
4.5. Tailoring static data access
4.6. Tailoring locale and CTYPE
4.6.1. Selecting locale at link time
4.6.2. Selecting locale at run time
4.6.3. Macros and utility functions
4.6.4. _get_lc_ctype()
4.6.5. _get_lc_collate()
4.6.6. _get_lc_monetary()
4.6.7. _get_lc_numeric()
4.6.8. _get_lc_time()
4.6.9. _get_lconv()
4.6.10. localeconv()
4.6.11. setlocale()
4.6.12. _findlocale()
4.6.13. __LC_CTYPE_DEF
4.6.14. __LC_COLLATE_DEF
4.6.15. __LC_TIME_DEF
4.6.16. __LC_NUMERIC_DEF
4.6.17. __LC_MONETARY_DEF
4.6.18. __LC_INDEX_END
4.6.19. The lconv structure
4.7. Tailoring error signaling, error handling,and program exit
4.7.1. _sys_exit()
4.7.2. errno
4.7.3. __rt_errno_addr()
4.7.4. __raise()
4.7.5. __rt_raise()
4.7.6. __default_signal_handler()
4.7.7. _ttywrch()
4.7.8. __rt_fp_status_addr()
4.8. Tailoring storage management
4.8.1. Support for malloc
4.8.2. Creating your own storage-managementsystem
4.8.3. __Heap_Descriptor
4.8.4. __Heap_Initialize()
4.8.5. __Heap_DescSize()
4.8.6. __Heap_ProvideMemory()
4.8.7. __Heap_Alloc()
4.8.8. __Heap_Free()
4.8.9. __Heap_Realloc()
4.8.10. __Heap_Stats()
4.8.11. __Heap_Valid()
4.8.12. __Heap_Full()
4.8.13. __Heap_Broken()
4.9. Tailoring the runtime memory model
4.9.1. The memory models
4.9.2. Controlling the runtime memory model
4.9.3. Writing your own memory model
4.9.4. __user_initial_stackheap()
4.9.5. __user_heap_extend()
4.9.6. __user_heap_extent()
4.9.7. __user_stack_slop()
4.9.8. __rt_stackheap_init()
4.9.9. __rt_stack_overflow()
4.9.10. __rt_heap_extend()
4.9.11. __rt_stack_postlongjmp()
4.10. Tailoring the input/output functions
4.10.1. Dependencies on low-level functions
4.10.2. Target-dependent input/output supportfunctions
4.10.3. _sys_open()
4.10.4. _sys_close()
4.10.5. _sys_read()
4.10.6. _sys_write()
4.10.7. _sys_ensure()
4.10.8. _sys_flen()
4.10.9. _sys_seek()
4.10.10. _sys_istty()
4.10.11. _sys_tmpnam()
4.10.12. _sys_command_string()
4.11. Tailoring other C library functions
4.11.1. clock()
4.11.2. _clock_init()
4.11.3. time()
4.11.4. remove()
4.11.5. rename()
4.11.6. system()
4.11.7. getenv()
4.11.8. _getenv_init()
4.12. Selecting real-time division
4.13. ISO implementation definition
4.13.1. ANSI C library implementation definition
4.13.2. Standard C++ library implementationdefinition
4.14. C library extensions
4.14.1. atoll()
4.14.2. strtoll()
4.14.3. strtoull()
4.14.4. snprintf()
4.14.5. vsnprintf()
4.14.6. lldiv()
4.14.7. llabs()
4.14.8. alloca()
4.14.9. _fisatty()
4.14.10. __heapstats()
4.14.11. __heapvalid()
4.15. Library naming conventions
5. Floating-point Support
5.1. About floating-point support
5.2. The software floating-point library,fplib
5.2.1. Arithmetic on numbersin a particular format
5.2.2. Conversions between floats, doubles,and ints
5.2.3. Conversions between long longs andother number formats
5.2.4. Floating-point comparisons
5.3. Controlling the floating-point environment
5.3.1. The __ieee_status function
5.3.2. The __fp_status function
5.3.3. Microsoft compatibility functions
5.3.4. C9X-compatible functions
5.3.5. ARM extensions to the C9X interface
5.4. The math library, mathlib
5.4.1. Inverse hyperbolicfunctions (acosh, asinh, atanh)
5.4.2. Cube root (cbrt)
5.4.3. Copy sign (copysign)
5.4.4. Error functions (erf, erfc)
5.4.5. One less than exp(x )(expm1)
5.4.6. Determine if a number is finite (finite)
5.4.7. Gamma function (gamma, gamma_r)
5.4.8. Hypotenuse function (hypot)
5.4.9. Return the exponentof a number (ilogb)
5.4.10. Determine if a number is a NaN (isnan)
5.4.11. Bessel functions of the first kind(j0, j1, jn)
5.4.12. The logarithm of the gamma function(lgamma, lgamma_r)
5.4.13. Logarithm of one morethan x (log1p)
5.4.14. Return the exponent of a number (logb)
5.4.15. Return the next representable number(nextafter)
5.4.16. IEEE 754 remainder function (remainder)
5.4.17. IEEE round-to-integer operation (rint)
5.4.18. Scale a number by apower of two (scalb, scalbn)
5.4.19. Return the fraction part of a number(significand)
5.4.20. Bessel functions of the second kind(y0, y1, yn)
5.5. IEEE 754 arithmetic
5.5.1. Basic data types
5.5.2. Arithmetic and rounding
5.5.3. Exceptions
A. Via File Syntax
A.1. Overview of via files
A.1.1. Via file evaluation
A.2. Syntax
B. Standard C Implementation Definition
B.1. Implementation definition
B.1.1. Translation
B.1.2. Environment
B.1.3. Identifiers
B.1.4. Characters
B.1.5. Integers
B.1.6. Floating-point
B.1.7. Arrays and pointers
B.1.8. Registers
B.1.9. Structures, unions, enumerations,and bitfields
B.1.10. Qualifiers
B.1.11. Declarators
B.1.12. Statements
B.1.13. Preprocessing directives
B.1.14. Library functions
C. Standard C++ Implementation Definition
C.1. EC++ support
C.2. Integral conversion
C.3. Calling a pure virtual function
C.4. Minor features of language support
C.5. Major features of language support
C.6. Standard C++ library implementationdefinition
D. C and C++ Compiler Implementation Limits
D.1. C++ ISO/IEC standard limits
D.2. Internal limits
D.3. Limits for integral numbers
D.4. Limits for floating-point numbers
Glossary

List of Tables

2.1. Compiler variants
2.2. Include file search paths
3.1. Pragmas recognized by the ARM compilers
3.2. Character escape codes
3.3. Size and alignment of data types
3.4. Predefined macros
4.1. Library functions that use static data
4.2. Direct dependencies
4.3. Indirect dependencies
4.4. Published API definitions
4.5. Callouts
4.6. Default locales
4.7. Locale categories
4.8. locale macros
4.9. Trap and error handling
4.10. Signals used by the C and C++ libraries
4.11. Heap functions
4.12. Memory model initialization
4.13. Memory model functions
4.14. Input/output dependencies
4.15. I/O support functions
4.16. ANSI C library functions
4.17. Mathematical functions
4.18. Signal function signals
4.19. perror() messages
4.20. C++ requirements on the C library
4.21. Standard C++ library differences
4.22. Extensions
5.1. Arithmetic routines
5.2. Number format conversion routines
5.3. Conversion routines involving long long format
5.4. Floating-point comparison routines
5.5. Rounding mode control
5.6. Status word bit modification
5.7. _controlfp argument macros
5.8. FE_EX_INTYPE_MASK operand type flags
5.9. FE_EX_OUTTYPE_MASK operand type flags
5.10. FE_EX_FN_MASK operation type flags
5.11. FE_EX_CMPRET_MASK comparison type flags
5.12. Sample single-precision floating-point values
5.13. Sample double-precision floating-point values
C.1. Minor feature support for language
C.2. Major feature support for language
D.1. Implementation limits
D.2. Internal limits
D.3. Integer ranges
D.4. Floating-point limits
D.5. Other floating-point characteristics

Proprietary Notice

Words and logos marked with ® or ™ are registered trademarks or trademarksowned by ARM Limited. Other brands and names mentioned herein maybe the trademarks of their respective owners.

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

The product described in this document is subject to continuousdevelopments and improvements. All particulars of the product andits use contained in this document are given by ARM in good faith.However, all warranties implied or expressed, including but notlimited to implied warranties of merchantability, or fitness forpurpose, are excluded.

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

Revision History
Revision A October1999 Release 1.0
Revision B March2000 Release 1.0.1
Revision C November2000 Release 1.1
Revision D November2001 Release 1.2
Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
Non-Confidential