ABI
https://itanium-cxx-abi.github.io/cxx-abi/
Itanium C++ ABI
Revised March 14, 2017
Introduction
The Itanium C++ ABI is an ABI for C++. As an ABI, it gives precise rules for implementing the language, ensuring that separately-compiled parts of a program can successfully interoperate. Although it was initially developed for the Itanium architecture, it is not platform-specific and can be layered portably on top of an arbitrary C ABI. Accordingly, it is used as the standard C++ ABI for many major operating systems on all major architectures, and is implemented in many major C++ compilers, including GCC and Clang.
Contact
This website may be mirrored in many places, some of which may become stale. The current canonical location is:
The primary discussion forum for the ABI is the GitHub repository. Please open a new issue for any new topic you want to discuss. Previously, the ABI was discussed on a mailing list, cxx-abi-dev, whose archives are still accessible.
Drafts
- Draft C++ ABI for Itanium
- Draft psABI exception handling specification
- ABI Examples code samples and tests
- Sample GCC code:
Proposals and auxiliary information:
- Proposals to the base ABI group for COMDAT sections and removing limitations on section indices.
- SGI Interface Section proposal.
- Vtable layout examples.
- WG21 argument destruction writeup (PDF)
- Legacy open issues list
- Legacy closed issues list
Objectives
- Interoperable C++ compilation on Itanium: we want users to be able to build relocatable objects with different compilers and link them together, and if possible even to ship common DSOs. This objective implies agreement on:
- Data representation
- Object file representation
- Library API
- ISO Standard C++: highest priority is functionality and performance of standard-compliant code. It should not be sacrificed for the benefit of language extensions or legacy implementations (though considering them as tie-breakers is fine).
- Some areas will be easier to agree on than others. Our priorities should be based on achieving as much interoperability as possible if we can't attain perfection. That is, it is better to end up with a few restrictions being required for interoperable code, than to have no interoperability at all. This suggests priorities as follows:
- Items requiring base ABI changes that might affect other languages, and will therefore become impossible soon. Examples include exception handling / stack unwind, or ELF changes (not extensions).
- Core features where differences will prevent virtually any C++ object code from porting. Examples include data layout and calling conventions.
- Limited usage features, where users can achieve portability by avoiding the feature. An example might be multi-threading.
- Peripheral features, where the requirements on users to achieve portability are clear and easy to implement. An example is non-explicit inlining, where compilers would presumably allow it to just be suppressed.
- Tool interfaces, which affect how users build code, rather than what they build. An example is the compilation command line.
- Mechanisms/methods which allow coexistence of incompatible implementations may be suitable in some cases. For instance, packaging vendor-specific compiler support runtimes in DSOs occupying distinct namespaces might allow multiple such DSOs to be loaded for mixed objects and avoid requiring that all vendors have the same support runtimes.
Action Item Status
# Action Who Status Opened Closed 1 Distribute Sun C++ ABI Mike Ball closed 990603 990930 2 Distribute Sun C++ ABI Rationale Mike Ball closed 990603 990930 3 Distribute Taligent C++ ABI Cary Coutant moot 990603 991101 4 Expedite Itanium RT Arch doc release Cary Coutant closed 990603 990720 5 Set up n-way NDA for eligible members Priti Shrivastav open 990603 6 Organize/summarize object layout issues and alternatives Matt Austern closed 990603 990624 7 Write-up of Vfunc call protocol Christophe de Dinechin closed 990610 990805 8 Write-up of object layout strawman Matt Austern closed 990610 990624 9 Check with c++-core about empty base placement Jason Merrill closed 990610 990618 10 Describe dynamic cast / inaccessible base issue Daveed Vandevoorde closed 990617 990701 11 Summarize ctor/dtor issues Michael Lam closed 990617 990729 12 Describe Intel exception model Priti Shrivastav closed 990624 990818 13 Propose RTTI representation Daveed Vandevoorde closed 990701 990819 14 Open EDG exception stack? Daveed Vandevoorde moot 990715 990930 15 Priority scheme descriptor for C-2 Jim Dehnert closed 990715 990804 16 Covariant return scheme Jason Merrill closed 990715 990729 17 Validate Christophe's B-6 Vtable layout Jim Dehnert closed 990729 990811 18 Check Sun dynamic cast algorithm Michael Lam closed 990805 990812 19 Write up C-3 destructor proposal Jim Dehnert closed 990805 990811 20 Look at implications of discussion on B-1, B-6 Christophe de Dinechin closed 990812 990830 21 Look at alternative implementations of C-2 Jim Dehnert closed 990812 991110 22 Describe HP hash processing for RTTI Christophe de Dinechin moot 990826 990930 23 Complete RTTI proposal Daveed Vandevoorde closed 990826 991006 24 Summarize Vtable issues Jason Merrill closed 990909 990930 25 Update traceback personality API Christophe de Dinechin closed 990923 000105 26 Push COMDAT to base ABI group Jim Dehnert closed 991014 000317 27 Writeup Vtable Changes Jason Merrill closed 991014 991021 28 Write Virtual destructor proposal Christophe de Dinechin closed 991014 000217 29 dynamic_cast pseudocode Jason Merrill closed 991028 000712 30 Mangling proposal Daveed Vandevoorde closed 991028 000118 31 Construction vtable writeup Coleen Phillimore closed 000127 000216 32 Raise sorting issue C-2 with base ABI group Jim Dehnert closed 991202 000717 33 long double in psABI Christophe de Dinechin closed 000210 0003xx 34 incomplete_type_info proposal Christophe de Dinechin closed 000210 000316 35 new array cookie writeup Matt Austern closed 000210 000217 36 Mangling document update Daveed Vandevoorde closed 000210 000217 37 Validate utility of has-public-base Nathan Sidwell closed 000218 000705
Issue Status
In the following table, the class column attempts to classify the issue on the basis of what it likely affects. The identifiers used are:call Function call interface, i.e. call linkage data Data layout lib Runtime library support lif Library interface, i.e. API g Potential gABI impact ps Potential psABI impact source Source code conventions (i.e. API, not ABI) tools May affect how program construction tools interact
# Issue Class Status Source Opened Closed A Object Layout A-1 Vptr location data closed SGI 990520 990624 A-2 Virtual base classes data closed SGI 990520 990624 A-3 Multiple inheritance data closed SGI 990520 990701 A-4 Empty base classes data closed SGI 990520 990624 A-5 Empty parameters data closed SGI 990520 001117 A-6 RTTI ( type_info
) .o representationdata call ps closed SGI 990520 991028 A-7 Vptr sharing with primary base class data closed HP 990603 990729 A-8 (Virtual) base class alignment data closed HP 990603 990624 A-9 Sorting fields as allowed by [class.mem]/12 data closed HP 990603 990624 A-10 Class parameters in registers call closed HP 990603 990701 A-11 Pointers to member functions data closed Cygnus 990603 990812 A-12 Merging secondary vtables data closed Sun 990610 990805 A-13 Parameter struct field promotion call closed SGI 990603 990701 A-14 Pointers to data members data closed SGI 990729 990805 A-15 Empty bit-fields data closed CodeSourcery 991214 000106 A-16 Nearly empty virtual bases data closed SGI 991228 000106 A-17 Primary indirect virtual base allocation data closed SGI 991228 000113 A-18 Virtual base alignment data closed SGI 991228 000113 A-19 Primary indirect virtual base choice data closed All 000106 000120 A-20 Operator new array cookies data closed All 000113 000120 A-21 Placement new array cookies data closed All 000113 000217 A-22 RTTI for reference types data closed CodeSourcery 000119 000203 A-23 RTTI class descriptors data closed CodeSourcery 000124 000302 A-24 RTTI for incomplete types data closed CodeSourcery 000126 000330 A-25 Excess-width bitfields data closed IBM 000204 000217 A-26 NULL pointers to member functions data closed CodeSourcery 000221 000302 A-27 NULL pointers to data members data closed CodeSourcery 000222 000302 A-28 RTTI equality testing data closed CodeSourcery 000406 000504 A-29 RTTI pointer-to-member data closed CodeSourcery 000407 000504 A-30 RTTI portability data closed HUB 001012 001109 A-31 Overlaying tail padding data closed CodeSourcery 001019 001109 B Virtual Function Handling B-1 Adjustment of "this" pointer (e.g. thunks) data call closed SGI 990520 991202 B-2 Covariant return types call closed SGI 990520 990722 B-3 Allowed caching of vtable contents call closed HP 990603 990805 B-4 Function descriptors in vtable data closed HP 990603 990805 B-5 Where are vtables emitted? data closed HP 990603 991118 B-6 Virtual function table layout data closed SGI 990520 991028 B-7 Objects and Vtables in shared memory data closed HP 990624 990805 B-8 dynamic_cast data closed SGI 990628 991014 B-9 Primary base vtable embedding data closed Cygnus 000217 000302 B-10 Pure virtual runtime call closed CodeSourcery 000629 000706 C Object Construction/Destruction C-1 Interaction with .init/.fini lif ps closed SGI 990520 991202 C-2 Order of ctors/dtors w.r.t. link lif ps closed HP 990603 000817 C-3 Order of ctors/dtors w.r.t. DSOs ps closed HP 990603 000504 C-4 Construction vtables call closed Cygnus 990603 000504 C-5 Calling virtual destructors call closed Sun 990603 991104 C-6 Extra parameters to ctors/dtors call closed Cygnus 990603 991104 C-7 Passing value parameters by reference call closed All 990625 990805 C-8 Returning classes with non-trival copy constructors call closed All 990625 990722 C-9 Passing parameters with ctors/dtors call closed All 991028 991104 C-10 Synthesized copy assignments call closed All 991028 991028 C-11 Array constructors/destructors call closed Cygnus 000130 000309 C-12 Constructor return values call closed Cygnus 000130 000309 C-13 Allocating constructors call closed HP 000309 000803 C-14 Local-scope dynamic constructors data closed all 000309 000511 C-15 Alternate array allocators call closed CodeSourcery 000628 000720 C-16 Copy constructor runtime call closed CodeSourcery 000628 000720 C-17 Uncatch exception runtime call table all 000706 000720 C-18 Result buffers call closed SGI 000724 000817 C-19 NULL ctor/dtor API parameters call closed CodeSourcery 000806 000831 D Exception Handling D-0 Exception handling framework lib ps closed SGI 990520 991216 D-1 Language-specific data area format lib ps open SGI 990520 D-2 Unwind personality routines lib ps closed SGI 990520 000106 D-3 Unwind process clarification lib ps closed SGI 990520 000106 D-4 Unwind routines nested? lib ps closed SGI 990520 991209 D-5 Interaction with other languages (e.g. Java) lib ps closed HP 990603 991007 D-6 Allow resumption in other languages? lib ps closed HP 990603 991007 D-7 Interaction with signals or asynch events lib ps closed HP 990603 991209 D-8 Interaction with threads packages lib ps closed SGI 990603 000106 D-9 longjmp interaction lib ps closed HP 990908 000113 D-10 psABI proposal lib ps closed all 991216 000120 D-11 pthreads interface lib ps closed all 991216 000203 D-12 Table location lib ps closed all 991216 000504 D-13 _Unwind_ForcedUnwind lib ps closed all 991216 000120 D-14 __cxa_begin/end_catch lib closed all 991216 001109 D-15 Terminate handler and threads lib closed all 991216 000106 D-16 Exception specifications lib closed all 991216 000113 D-17 bad_cast, bad_typeid runtime call closed CodeSourcery 000629 000706 D-18 __cxa_throw_type_info lib closed all 001012 001109 E Template Instantiation Model E-1 When does instantiation occur? tools closed SGI 990520 000511 E-2 Export template model tools tabled SGI 990520 E-3 Template repository tools closed HP 990603 000511 F Name Mangling F-1 Mangling convention call closed SGI 990520 000330 F-2 Mangled name size call g closed SGI 990520 000511 F-3 Consistency checks call g tabled SGI 990520 F-4 Empty throw specs call g tabled HP 990930 F-5 ILP32 vs. LP64 call closed HP 000210 000824 F-6 Demangling lib closed Cygnus 000210 000504 F-7 Mangling statics call closed HP 000223 000504 F-8 Identifiers with unicode letters call closed HU-Berlin 000323 000413 F-9 Strings with unicode letters call closed HU-Berlin 000323 000413 F-10 Mangling function return types call closed all 000330 000413 F-11 Hash for local strings call closed all 000330 000504 G Miscellaneous G-1 Basic command line options tools closed HP 990603 000824 G-2 Detection of 1-def rule violations call closed Sun 990603 000504 G-3 Inlined routine linkage call closed Sun 990603 991202 G-4 Dynamic init of local static objects and multithreading call closed SCO 990607 001109 G-5 Varargs routine interface call closed HU-B 990810 991014 G-6 bool parameters call closed all 991104 991202 H Runtime Library Interface H-1 Runtime library DSO name tools closed SGI 990616 000817 H-2 Runtime library API lif tabled SGI 990616 - Interoperable C++ compilation on Itanium: we want users to be able to build relocatable objects with different compilers and link them together, and if possible even to ship common DSOs. This objective implies agreement on: