[libcxx-commits] [libcxxabi] [libcxxabi] prevent __cxa_free_exception from being inlined when called in __cxa_decrement_exception_refcount (PR #222754)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 16 02:38:07 PDT 2026
philnik777 wrote:
> > Do you have any reference claiming support for such a thing? "getting it to work" is very different from "supported".
>
> [This project's](https://github.com/llvm-mirror/libcxxabi/blob/master/src/cxa_exception.cpp) implementation of static_exception explicitly overrides `__cxa_free_exception` in order to implement its own memory allocation. The `__cxa_free_exception` call being inlined would bypass the override and execute the libc++ abi implementation.
That's not what I asked. I'm asking for a reference for your claim that libstdc++ supports this.
> In addition, although it is a behavioral spec and doesn't specify a requirement for `noinline` specifically, the Itanium C++ ABI states that [The complete exception object will be destroyed by calling its destructor and __cxa_free_exception, ](https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html?utm_source=chatgpt.com#cxx-allocate/2.5.5%20Finishing%20and%20Destroying%20the%20Exception) in section 2.5.5 Finishing and Destroying the Exception. If the free function is inlined when calling the c++ abi's implementation of `__cxa_decrement_exception_refcount`, this project's implementation `__cxa_free_exception` would be bypassed. The project's implementation relies their function being called in order to release their exception.
That doesn't mean we _actually_ have to call anything. It's just a simpler way of describing what happens. Replaceable functions are a concept in the C++ standard, but the Itanium ABI isn't making use of that.
https://github.com/llvm/llvm-project/pull/222754
More information about the libcxx-commits
mailing list