[libcxx-commits] [libcxx] [libc++] Introduce implicit and explicit ABI annotations (PR #193045)

Alexey Samsonov via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 28 00:34:56 PDT 2026


vonosmas wrote:

@philnik777  This patch effectively disables the `_LIBCPP_NO_ABI_TAG` [configuration knob](https://github.com/llvm/llvm-project/blob/191aa295d9c9fe83411ae5cdfeb8a6bb8decb3d2/libcxx/include/__configuration/attributes.h#L209):
* since `_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS` pushes the application of `__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))` to `_Pragma`, the absence of this `__abi_tag__` in the `_LIBCPP_HIDE_FROM_ABI` annotation is irrelevant - the ABI tag is always appended.

We observe negative impact of this (unintended?) change downstream:
* `.debug_str` bloat - about 5% increase for real production binaries, since every container instantiation has tags like `[abi:fqn230000]` added to their names.
* increased SourceLocation pressure in Clang - the amount of loaded SourceLocations in Clang increases by around **25-30%**, pushing lots of binaries over the 2Gb limit: (`SourceLocation clang::ASTReader::ReadSourceLocation(ModuleFile &, RawLocEncoding) const: !SourceMgr.isLoadedSourceLocation(Loc) && "Run out source location space")`). I suspect that the reason for this is the use of Clang header modules, which means that Clang needs to load pre-compiled modules, and if every single instantiation has an expansion of `_LIBCPP_ODR_SIGNATURE` (which has a [deep expansion](https://github.com/llvm/llvm-project/blob/191aa295d9c9fe83411ae5cdfeb8a6bb8decb3d2/libcxx/include/__configuration/attributes.h#L153-L156) itself)  that would eat into virtual source location space.
* compile-time performance regression (up to **58%** on selected benchmarks) - I didn't dig in further, but would suspect that previous item might be responsible for that.

I can see that there's a TODO for replacing `_LIBCPP_NO_ABI_TAG` with a better alternative, but if it's not ready yet, should we restore the capability of this knob? For example, @philnik777  - would you be open to having two different definitions of `_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS` macro similar to what we do for `_LIBCPP_HIDE_FROM_ABI` today?

Likewise, there's a `_LIBCPP_HIDE_FROM_ABI_VIRTUAL` macro was **not** adding ABI tags regardless of the configuration knob. Wouldn't it start receiving those tags with this change?

https://github.com/llvm/llvm-project/pull/193045


More information about the libcxx-commits mailing list