[libcxx-commits] [libcxx] [libc++] [libc++abi] Initialize exception directly in make_exception_ptr if __cxa_init_primary_exception is available in ABI-library (PR #65534)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 27 01:30:06 PDT 2023


================
@@ -1048,6 +1048,10 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
 #    define _LIBCPP_HAS_NO_RTTI
 #  endif
 
+#  if !defined(_LIBCPP_HAS_NO_EXCEPTIONS) && !defined(_LIBCPP_HAS_NO_RTTI) && !defined(__APPLE__) && !defined(_WIN32)
----------------
itrofimow wrote:

The "availability macro": is that https://clang.llvm.org/docs/AttributeReference.html#availability?
Anyway, i'm failing to understand how that could eliminate the need to have a runtime check for the `__cxa_init_primary_exception` presence -- say, if i build against 18.0 libcxxabi and then LD_PRELOAD 17.0 version, which should be a supported case, right?

-------

To answer your question directly:
Windows: disabled due to mingw requiring this https://github.com/llvm/llvm-project/blob/ea1909f82ceca30b009701f1d349247f8fbf1c3e/libcxxabi/include/__cxxabi_config.h#L101 to be specified for exception destructor, and this attribute now has to appear in libc++ at the call site (where weak declaration of the `__cxa_init_primary_exception` is present). I didn't want to copy-paste this macro in libc++, but definitely doable, should i implement it?

Apple: back-deployment-macosx tests fail (https://buildkite.com/llvm-project/libcxx-ci/builds/30969#018b50e0-c82b-42e0-bceb-b74d5808ffad, for example) with `dyld[47810]: missing symbol called` error. I have very limited knowledge about how linking is performed on Apple, but my quick googling tells that it's much different from what ld does, and weak attributes don't work without some compiler flags specified. I have no clue how this should be fixed and it also takes forever for CI to reach this check, so any help would be appreciated.

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


More information about the libcxx-commits mailing list