Abstract
This document describes the exception handling component of the Application Binary Interface (ABI) for the ARM architecture. It covers the exception handling model, encoding in relocatable ELF files, languageindependent unwinding, and C++-specific aspects.
Keywords
Stack unwinding, exception handling
Please report defects in this specification to arm dot eabi at arm dot com.
Licence
THE TERMS OF YOUR ROYALTY FREE LIMITED LICENCE TO USE THIS ABI SPECIFICATION ARE GIVEN IN SECTION 1.4, Your licence to use this specification (ARM contract reference LEC-ELA-00081 V2.0). PLEASE READ THEM CAREFULLY. BY DOWNLOADING OR OTHERWISE USING THIS SPECIFICATION, YOU AGREE TO BE BOUND BY ALL OF ITS TERMS. IF YOU DO NOT AGREE TO THIS, DO NOT DOWNLOAD OR USE THIS SPECIFICATION. THIS ABI SPECIFICATION IS PROVIDED AS IS WITH NO WARRANTIES (SEE SECTION 1.4 FOR DETAILS).
Proprietary notice
ARM, Thumb, RealView, ARM7TDMI and ARM9TDMI are registered trademarks of ARM Limited. The ARM logo is a trademark of ARM Limited. ARM9, ARM926EJ-S, ARM946E-S, ARM1136J-S ARM1156T2F-S ARM1176JZ-S Cortex, and Neon are trademarks of ARM Limited. All other products or services mentioned herein may be trademarks of their respective owners.
Page 1 of 50
Contents
1 ABOUT THIS DOCUMENT 5 5 5 5 5 6 6 7 8 9 9 10 10 10 10 10 11 11 11 11 12 12 12 13 13 13 15 16 16
1.1 Change control 1.1.1 Current status and anticipated changes 1.1.2 Change history 1.2 1.3 1.4 1.5 2 3 References Terms and abbreviations Your licence to use this specification Acknowledgements INTRODUCTION AND SCOPE DESIGN PRINCIPLES
3.1 The execution-environment model 3.1.1 The linker must match the run-time support code 3.2 The ELF model 3.2.1 Relocatable ELF 3.2.2 Executable ELF 3.2.3 Principles of usage 4 4.1 4.2 4.3 THE TOP-LEVEL EXCEPTION HANDLING ARCHITECTURE Overview for executables, shared objects, and DLLs The binary searched index table The exception-handling table
4.4 The object producer interface 4.4.1 Sections 4.4.2 Relocations 4.5 4.6 4.7 5 6 6.1 Tool chain quality of implementation issues Functional encapsulation Restriction on implementation INDEX TABLE ENTRIES EXCEPTION-HANDLING TABLE ENTRIES Overview
Page 2 of 50
6.2 6.3 7
The generic model The ARM-defined compact model LANGUAGE-INDEPENDENT UNWINDING LIBRARY
16 16 18 18 18 18 19 20 22 23 24 25 25 26 27 29 29 31 31 31 32 32 32 34 35 36 36 36 36 36 37 38 38 38
7.1 Overview of operation 7.1.1 Terminology 7.1.2 Language-independent exception propagation 7.1.3 Exception propagation state 7.2 7.3 7.4 Language-independent unwinding types and functions Phase 1 unwinding Phase 2 unwinding
7.5 Virtual register set manipulation 7.5.1 Control types 7.5.2 Assignment to VRS registers 7.5.3 Reading from VRS registers 7.5.4 Moving from stack to VRS 7.6 7.7 8 8.1 8.2 8.3 Cross-language support, and object deletion Implications for implementations THE GENERIC C++ EXCEPTION HANDLING ABI Overview Data structures Routines from the C++ Standard Library
8.4 ABI routines 8.4.1 Compiler helper functions 8.4.2 Personality routine helper functions 8.4.3 Auxiliary functions 8.5 Implications for implementations 8.5.1 Expected implementations of __cxa_allocate_exception and __cxa_throw 8.5.2 Order of events during throwing 8.5.3 Violation of function exception specifications 8.5.4 Handlers and landing pads 8.6 9 9.1 9.2 Catching foreign exceptions ARM-DEFINED PERSONALITY ROUTINES AND TABLE FORMATS FOR C AND C++ Constraints on use Exception-handling table entries
Page 3 of 50
Frame unwinding instructions Interpreting the tables Implications for implementations IMPLEMENTATION DETAILS Thread safety Stack unwinding APPENDIX A C++ UNCAUGHT EXCEPTION SEMANTICS APPENDIX B: EXAMPLE C++ LANGUAGE IMPLEMENTATION Exception Control Object Per-thread global memory APPENDIX C: UNWINDING INSTRUCTION ENCODING COSTS
40 42 43 44 44 44 45 48 48 48 50
Page 4 of 50