xref: /aosp_15_r20/external/libcxx/docs/DesignDocs/ABIVersioning.rst (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1*58b9f456SAndroid Build Coastguard Worker
2*58b9f456SAndroid Build Coastguard Worker====================
3*58b9f456SAndroid Build Coastguard WorkerLibc++ ABI stability
4*58b9f456SAndroid Build Coastguard Worker====================
5*58b9f456SAndroid Build Coastguard Worker
6*58b9f456SAndroid Build Coastguard WorkerLibc++ aims to preserve stable ABI to avoid subtle bugs when code built to the old ABI
7*58b9f456SAndroid Build Coastguard Workeris linked with the code build to the new ABI. At the same time, libc++ allows ABI-breaking
8*58b9f456SAndroid Build Coastguard Workerimprovements and bugfixes for the scenarios when ABI change is not a issue.
9*58b9f456SAndroid Build Coastguard Worker
10*58b9f456SAndroid Build Coastguard WorkerTo support both cases, libc++ allows specifying the ABI version at the
11*58b9f456SAndroid Build Coastguard Workerbuild time.  The version is defined with a cmake option
12*58b9f456SAndroid Build Coastguard WorkerLIBCXX_ABI_VERSION. Another option LIBCXX_ABI_UNSTABLE can be used to
13*58b9f456SAndroid Build Coastguard Workerinclude all present ABI breaking features. These options translate
14*58b9f456SAndroid Build Coastguard Workerinto C++ macro definitions _LIBCPP_ABI_VERSION, _LIBCPP_ABI_UNSTABLE.
15*58b9f456SAndroid Build Coastguard Worker
16*58b9f456SAndroid Build Coastguard WorkerAny ABI-changing feature is placed under it's own macro, _LIBCPP_ABI_XXX, which is enabled
17*58b9f456SAndroid Build Coastguard Workerbased on the value of _LIBCPP_ABI_VERSION. _LIBCPP_ABI_UNSTABLE, if set, enables all features at once.
18