xref: /freebsd-src/contrib/llvm-project/clang/include/clang/Basic/TargetCXXABI.def (revision fe6060f10f634930ff71b7c50291ddc610da2475)
1*fe6060f1SDimitry Andric//===--- TargetCXXABI.def - Target C++ ABI database --------------- C++ -*-===//
2*fe6060f1SDimitry Andric//
3*fe6060f1SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*fe6060f1SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
5*fe6060f1SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*fe6060f1SDimitry Andric//
7*fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
8*fe6060f1SDimitry Andric//
9*fe6060f1SDimitry Andric// This file defines the various C++ ABI kinds used on different platforms.
10*fe6060f1SDimitry Andric// Users of this file must define the CXXABI macro to make use of this
11*fe6060f1SDimitry Andric// information.
12*fe6060f1SDimitry Andric//
13*fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
14*fe6060f1SDimitry Andric
15*fe6060f1SDimitry Andric#ifndef CXXABI
16*fe6060f1SDimitry Andric#error Define the CXXABI macro to handle C++ ABI kinds.
17*fe6060f1SDimitry Andric#endif
18*fe6060f1SDimitry Andric
19*fe6060f1SDimitry Andric#ifndef ITANIUM_CXXABI
20*fe6060f1SDimitry Andric#define ITANIUM_CXXABI(Name, Str) CXXABI(Name, Str)
21*fe6060f1SDimitry Andric#endif
22*fe6060f1SDimitry Andric
23*fe6060f1SDimitry Andric#ifndef MICROSOFT_CXXABI
24*fe6060f1SDimitry Andric#define MICROSOFT_CXXABI(Name, Str) CXXABI(Name, Str)
25*fe6060f1SDimitry Andric#endif
26*fe6060f1SDimitry Andric
27*fe6060f1SDimitry Andric/// The generic Itanium ABI is the standard ABI of most open-source
28*fe6060f1SDimitry Andric/// and Unix-like platforms.  It is the primary ABI targeted by
29*fe6060f1SDimitry Andric/// many compilers, including Clang and GCC.
30*fe6060f1SDimitry Andric///
31*fe6060f1SDimitry Andric/// It is documented here:
32*fe6060f1SDimitry Andric///   http://www.codesourcery.com/public/cxx-abi/
33*fe6060f1SDimitry AndricITANIUM_CXXABI(GenericItanium, "itanium")
34*fe6060f1SDimitry Andric
35*fe6060f1SDimitry Andric/// The generic ARM ABI is a modified version of the Itanium ABI
36*fe6060f1SDimitry Andric/// proposed by ARM for use on ARM-based platforms.
37*fe6060f1SDimitry Andric///
38*fe6060f1SDimitry Andric/// These changes include:
39*fe6060f1SDimitry Andric///   - the representation of member function pointers is adjusted
40*fe6060f1SDimitry Andric///     to not conflict with the 'thumb' bit of ARM function pointers;
41*fe6060f1SDimitry Andric///   - constructors and destructors return 'this';
42*fe6060f1SDimitry Andric///   - guard variables are smaller;
43*fe6060f1SDimitry Andric///   - inline functions are never key functions;
44*fe6060f1SDimitry Andric///   - array cookies have a slightly different layout;
45*fe6060f1SDimitry Andric///   - additional convenience functions are specified;
46*fe6060f1SDimitry Andric///   - and more!
47*fe6060f1SDimitry Andric///
48*fe6060f1SDimitry Andric/// It is documented here:
49*fe6060f1SDimitry Andric///    http://infocenter.arm.com
50*fe6060f1SDimitry Andric///                    /help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf
51*fe6060f1SDimitry AndricITANIUM_CXXABI(GenericARM, "arm")
52*fe6060f1SDimitry Andric
53*fe6060f1SDimitry Andric/// The iOS ABI is a partial implementation of the ARM ABI.
54*fe6060f1SDimitry Andric/// Several of the features of the ARM ABI were not fully implemented
55*fe6060f1SDimitry Andric/// in the compilers that iOS was launched with.
56*fe6060f1SDimitry Andric///
57*fe6060f1SDimitry Andric/// Essentially, the iOS ABI includes the ARM changes to:
58*fe6060f1SDimitry Andric///   - member function pointers,
59*fe6060f1SDimitry Andric///   - guard variables,
60*fe6060f1SDimitry Andric///   - array cookies, and
61*fe6060f1SDimitry Andric///   - constructor/destructor signatures.
62*fe6060f1SDimitry AndricITANIUM_CXXABI(iOS, "ios")
63*fe6060f1SDimitry Andric
64*fe6060f1SDimitry Andric/// The iOS 64-bit and macOS 64-bit ARM ABI follows ARM's published 64-bit
65*fe6060f1SDimitry Andric/// ABI more closely, but we don't guarantee to follow it perfectly.
66*fe6060f1SDimitry Andric///
67*fe6060f1SDimitry Andric/// It is documented here:
68*fe6060f1SDimitry Andric///    http://infocenter.arm.com
69*fe6060f1SDimitry Andric///                  /help/topic/com.arm.doc.ihi0059a/IHI0059A_cppabi64.pdf
70*fe6060f1SDimitry AndricITANIUM_CXXABI(AppleARM64, "applearm64")
71*fe6060f1SDimitry Andric
72*fe6060f1SDimitry Andric/// WatchOS is a modernisation of the iOS ABI, which roughly means it's
73*fe6060f1SDimitry Andric/// the iOS64 ABI ported to 32-bits. The primary difference from iOS64 is
74*fe6060f1SDimitry Andric/// that RTTI objects must still be unique at the moment.
75*fe6060f1SDimitry AndricITANIUM_CXXABI(WatchOS, "watchos")
76*fe6060f1SDimitry Andric
77*fe6060f1SDimitry Andric/// The generic AArch64 ABI is also a modified version of the Itanium ABI,
78*fe6060f1SDimitry Andric/// but it has fewer divergences than the 32-bit ARM ABI.
79*fe6060f1SDimitry Andric///
80*fe6060f1SDimitry Andric/// The relevant changes from the generic ABI in this case are:
81*fe6060f1SDimitry Andric///   - representation of member function pointers adjusted as in ARM.
82*fe6060f1SDimitry Andric///   - guard variables  are smaller.
83*fe6060f1SDimitry AndricITANIUM_CXXABI(GenericAArch64, "aarch64")
84*fe6060f1SDimitry Andric
85*fe6060f1SDimitry Andric/// The generic Mips ABI is a modified version of the Itanium ABI.
86*fe6060f1SDimitry Andric///
87*fe6060f1SDimitry Andric/// At the moment, only change from the generic ABI in this case is:
88*fe6060f1SDimitry Andric///   - representation of member function pointers adjusted as in ARM.
89*fe6060f1SDimitry AndricITANIUM_CXXABI(GenericMIPS, "mips")
90*fe6060f1SDimitry Andric
91*fe6060f1SDimitry Andric/// The WebAssembly ABI is a modified version of the Itanium ABI.
92*fe6060f1SDimitry Andric///
93*fe6060f1SDimitry Andric/// The changes from the Itanium ABI are:
94*fe6060f1SDimitry Andric///   - representation of member function pointers is adjusted, as in ARM;
95*fe6060f1SDimitry Andric///   - member functions are not specially aligned;
96*fe6060f1SDimitry Andric///   - constructors and destructors return 'this', as in ARM;
97*fe6060f1SDimitry Andric///   - guard variables are 32-bit on wasm32, as in ARM;
98*fe6060f1SDimitry Andric///   - unused bits of guard variables are reserved, as in ARM;
99*fe6060f1SDimitry Andric///   - inline functions are never key functions, as in ARM;
100*fe6060f1SDimitry Andric///   - C++11 POD rules are used for tail padding, as in iOS64.
101*fe6060f1SDimitry Andric///
102*fe6060f1SDimitry Andric/// TODO: At present the WebAssembly ABI is not considered stable, so none
103*fe6060f1SDimitry Andric/// of these details is necessarily final yet.
104*fe6060f1SDimitry AndricITANIUM_CXXABI(WebAssembly, "webassembly")
105*fe6060f1SDimitry Andric
106*fe6060f1SDimitry Andric/// The Fuchsia ABI is a modified version of the Itanium ABI.
107*fe6060f1SDimitry Andric///
108*fe6060f1SDimitry Andric/// The relevant changes from the Itanium ABI are:
109*fe6060f1SDimitry Andric///   - constructors and destructors return 'this', as in ARM.
110*fe6060f1SDimitry AndricITANIUM_CXXABI(Fuchsia, "fuchsia")
111*fe6060f1SDimitry Andric
112*fe6060f1SDimitry Andric/// The XL ABI is the ABI used by IBM xlclang compiler and is a modified
113*fe6060f1SDimitry Andric/// version of the Itanium ABI.
114*fe6060f1SDimitry Andric///
115*fe6060f1SDimitry Andric/// The relevant changes from the Itanium ABI are:
116*fe6060f1SDimitry Andric///   - static initialization is adjusted to use sinit and sterm functions;
117*fe6060f1SDimitry AndricITANIUM_CXXABI(XL, "xl")
118*fe6060f1SDimitry Andric
119*fe6060f1SDimitry Andric/// The Microsoft ABI is the ABI used by Microsoft Visual Studio (and
120*fe6060f1SDimitry Andric/// compatible compilers).
121*fe6060f1SDimitry Andric///
122*fe6060f1SDimitry Andric/// FIXME: should this be split into Win32 and Win64 variants?
123*fe6060f1SDimitry Andric///
124*fe6060f1SDimitry Andric/// Only scattered and incomplete official documentation exists.
125*fe6060f1SDimitry AndricMICROSOFT_CXXABI(Microsoft, "microsoft")
126*fe6060f1SDimitry Andric
127*fe6060f1SDimitry Andric#undef CXXABI
128*fe6060f1SDimitry Andric#undef ITANIUM_CXXABI
129*fe6060f1SDimitry Andric#undef MICROSOFT_CXXABI
130