From f4acd2b46a17afe31d8d069b8f5afacfc9bde870 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sun, 18 Aug 2019 19:11:29 +0000 Subject: [PATCH] Darwin, libsanitizer - remove reference to __cxa_rethrow_primary_exception. For some Darwin versions the absence of the rethrow_primary_exception symbol causes almost all sanitizer tests to fail. The symbol is not present in libstdc++ and, therefore is is correct to remove the reference to it for all platforms. We do this by adding a new guard "ASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION". For the backported version, to avoid bumping the library version, this is only applied for Darwin (because of the way that symbol interposing works on Darwin, this does not alter the exported symbols list). libsanitizer/ 2019-08-18 Iain Sandoe Backport from mainline 2019-06-18 Iain Sandoe PR libsanitizer/87880 * asan/asan_interceptors.h: (ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION): New. * asan/Makefile.am (DEFS): Add (for Darwin only) ASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION, defined to 0. * asan/Makefile.in: Regenerated. From-SVN: r274625 --- libsanitizer/ChangeLog | 12 ++++++++++++ libsanitizer/asan/Makefile.am | 2 +- libsanitizer/asan/Makefile.in | 2 +- libsanitizer/asan/asan_interceptors.h | 7 ++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index c7d3cf4f562c..b797761bc43a 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,15 @@ +2019-08-18 Iain Sandoe + + Backport from mainline + 2019-06-18 Iain Sandoe + + PR libsanitizer/87880 + * asan/asan_interceptors.h: + (ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION): New. + * asan/Makefile.am (DEFS): Add (for Darwin only) + ASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION, defined to 0. + * asan/Makefile.in: Regenerated. + 2019-08-12 Release Manager * GCC 9.2.0 released. diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am index 867240d24453..6efbc1df7f8b 100644 --- a/libsanitizer/asan/Makefile.am +++ b/libsanitizer/asan/Makefile.am @@ -5,7 +5,7 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER) DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DASAN_HAS_EXCEPTIONS=1 -DASAN_NEEDS_SEGV=1 -DCAN_SANITIZE_UB=0 if USING_MAC_INTERPOSE -DEFS += -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT +DEFS += -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT -DASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION=0 endif AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -fno-ipa-icf AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS) diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in index 926ff7d7491c..8dfd93a6fd32 100644 --- a/libsanitizer/asan/Makefile.in +++ b/libsanitizer/asan/Makefile.in @@ -90,7 +90,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@USING_MAC_INTERPOSE_TRUE@am__append_1 = -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT +@USING_MAC_INTERPOSE_TRUE@am__append_1 = -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT -DASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION=0 @USING_MAC_INTERPOSE_FALSE@am__append_2 = $(top_builddir)/interception/libinterception.la @LIBBACKTRACE_SUPPORTED_TRUE@am__append_3 = $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la subdir = asan diff --git a/libsanitizer/asan/asan_interceptors.h b/libsanitizer/asan/asan_interceptors.h index b599ebb0ba91..beb1dc9532b9 100644 --- a/libsanitizer/asan/asan_interceptors.h +++ b/libsanitizer/asan/asan_interceptors.h @@ -79,7 +79,12 @@ 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 ! defined(ASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION) \ + || 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 -- 2.47.2