2 Using the Procedure Call Standard
This chapter describes how to use the ARM-Thumb Procedure Call Standard (ATPCS). Adhere to the ATPCS to
ensure that separately compiled and assembled modules can work together. The chapter contains the following
sections:
• About the ARM-Thumb Procedure Call Standard
• Register roles and names
• The stack
• Parameter passing
• Read-only position independence
• Read-write position independence
• Interworking between ARM and Thumb states
• Floating-point options.
2.1 About the ARM-Thumb Procedure Call Standard
Adherence to the ARM-Thumb Procedure Call Standard (ATPCS) ensures that separately compiled or assembled
subroutines can work together. This chapter describes how to use the ATPCS.
ATPCS has several variants. This chapter gives information enabling you to choose which variant to use.
Many details of the standard are the same, whichever variant you use. See:
• Register roles and names
• The stack
• Parameter passing.
2.1.1 ATPCS variants
The variants comprise a base standard modified by options that you can select independently. Code conforming to
the base standard runs faster than, and occupies less memory than, code conforming to other variants. However,
code conforming to the base standard does not provide for:
• interworking between ARM state and Thumb state
• position independence of either data or code
• re-entry to routines with independent data for each invocation
• stack checking.
The compiler or assembler sets attributes in the ELF object file which record the variant you have chosen. In general,
you must choose one variant and then use it for all subroutines that must work together. Exceptions to this rule are
described in the text.
The options are dealt with under the following headings:
• Stack limit checking
• Read-only position independence
• Read-write position independence
• Interworking between ARM and Thumb states
• Floating-point options.
2.1.2 ARM C libraries
There are several variants of the ARM C libraries (see Compiler and Libraries Guide). The linker selects a variant to
link with your object files. It selects the best variant compatible with the ATPCS options recorded in your object files.
See the linker chapter in Linker and Utilities Guide
.
2.1.3 Conformance to the ATPCS
Routines compiled using the ADS compilers conform to the selected variant of the ATPCS.
You are responsible for ensuring that routines written in assembly language conform to the selected variant of the
ATPCS.
To conform to the ATPCS, an assembly language routine must:
• follow all details of the standard at publicly visible interfaces
• follow the ATPCS rules of stack usage at all times
Using the Procedure Call Standard
Copyright ?1999 2001 ARM Limited 2-1
Commentaires sur ces manuels