https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87880
--- Comment #9 from Iain Sandoe <iains at gcc dot gnu.org> --- So.. this is somewhat puzzling. Essentially, it seems that on macOS and Linux (at least) currently ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION is set unconditionally to "on" (for any target that has ASAN_HAS_EXCEPTIONS). libsupc++'s implementation doesn't include this, so .. .. the mystery is not so much why it's failing sometimes on macOS - so much as why it's not failing always, when the c++ library is libstdc++ (and also on Linux). Hypothesis, could be that since the search is being carried out in the flat namespace, any library that happens to pull in libc++ (as a dependent) will cause the libc++abi version of __cxa_rethrow_primary_exception to become visible in that flat namespace. using the following hack the results go from wholesale fail on C to a handfull of fails and on c++ similarly. I guess this could be a dyld bug too - if the lookup is supposed to be a weak reference (not checked). .. obviously, this is incomplete .. it just jams the hook off (not looked at the configuration stuff yet, or whether there's a weak symbol problem). [this appears distinct from failure mode on Darwin10 and also distinct from some fails caused by missing symbolization (atos) on m64 / darwin14] diff --git a/libsanitizer/asan/asan_interceptors.h b/libsanitizer/asan/asan_interceptors.h index b599ebb..10b6d2c 100644 --- a/libsanitizer/asan/asan_interceptors.h +++ b/libsanitizer/asan/asan_interceptors.h @@ -79,7 +79,11 @@ void InitializePlatformInterceptors(); #if ASAN_HAS_EXCEPTIONS && !SANITIZER_WINDOWS && !SANITIZER_SOLARIS && \ !SANITIZER_NETBSD # define ASAN_INTERCEPT___CXA_THROW 1 -# define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 1 +# if ASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION +# define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 1 +#else +# define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 0 +# endif # if defined(_GLIBCXX_SJLJ_EXCEPTIONS) || (SANITIZER_IOS && defined(__arm__)) # define ASAN_INTERCEPT__UNWIND_SJLJ_RAISEEXCEPTION 1 # else