Export ___gxx_personality_v0 as a weak symbol on iOS This is apparently required by the latest Clang toolchain in order to do a bitcode build of the engine with LTO enabled. See https://github.com/flutter/flutter/issues/110140 Change-Id: I6eec2e741e5a9a67aece176aab365303b5425827 Reviewed-on: https://flutter-review.googlesource.com/c/third_party/libcxxabi/+/33360 Reviewed-by: Zach Anderson <zra@google.com>
diff --git a/src/cxa_personality.cpp b/src/cxa_personality.cpp index b28c58d..98f51c2 100644 --- a/src/cxa_personality.cpp +++ b/src/cxa_personality.cpp
@@ -905,11 +905,26 @@ Else a cleanup is not found: return _URC_CONTINUE_UNWIND */ +// Flutter: Export __gxx_personality_v0 as a weak symbol on iOS in order to +// work around an issue with bitcode/LTO builds on the latest Clang toolchain. +// See https://github.com/flutter/flutter/issues/110140 +// +// This should no longer be necessary after bitcode support is removed from +// the Flutter engine. +#ifdef __APPLE__ +#include <TargetConditionals.h> +#endif +#if defined(TARGET_OS_IOS) && TARGET_OS_IOS +#define _LIBCXXABI_FUNC_VIS_PERSONALITY __attribute__((visibility("default"))) __attribute__((weak)) +#else +#define _LIBCXXABI_FUNC_VIS_PERSONALITY _LIBCXXABI_FUNC_VIS +#endif + #if !defined(_LIBCXXABI_ARM_EHABI) #if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) static _Unwind_Reason_Code __gxx_personality_imp #else -_LIBCXXABI_FUNC_VIS _Unwind_Reason_Code +_LIBCXXABI_FUNC_VIS_PERSONALITY _Unwind_Reason_Code #ifdef __USING_SJLJ_EXCEPTIONS__ __gxx_personality_sj0 #elif defined(__MVS__)