From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55329 invoked by alias); 18 Aug 2019 19:20:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 55217 invoked by uid 89); 18 Aug 2019 19:20:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_COUK,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 spammy= X-HELO: smtp2.wavenetuk.net Received: from smtp.wavenetuk.net (HELO smtp2.wavenetuk.net) (195.26.37.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 18 Aug 2019 19:20:03 +0000 Received: from euterpe-sie.home (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp2.wavenetuk.net (Postfix) with ESMTPA id 8332F6001E0; Sun, 18 Aug 2019 20:19:57 +0100 (BST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH, sanitizer] Wrap rethrow_primary_exception (PR 87880). From: Iain Sandoe In-Reply-To: <20190616185842.GM19695@tucnak> Date: Mon, 19 Aug 2019 01:16:00 -0000 Cc: GCC Patches Content-Transfer-Encoding: quoted-printable Message-ID: <4191DBC8-1BDE-4745-9E5F-85273804B267@sandoe.co.uk> References: <62358CB5-F721-4DA5-BE9F-7E9A34B2A78C@sandoe.co.uk> <20190614144754.GF19695@tucnak> <78C2E45E-6989-4DE2-A836-2A51C298822A@sandoe.co.uk> <20190616185842.GM19695@tucnak> To: Jakub Jelinek X-SW-Source: 2019-08/txt/msg01244.txt.bz2 Message-ID: <20190819011600.74FRwgqMFlI9Bnp9sMoEtHTP8P0vg0FRBcdWC6loTlM@z> > On 16 Jun 2019, at 19:58, Jakub Jelinek wrote: >=20 > On Sun, Jun 16, 2019 at 07:54:42PM +0100, Iain Sandoe wrote: >> Actually, because the way in which interposing works for Darwin is diffe= rent, the only >> symbol change in the library on Darwin is removing an "undefined dynamic= lookup". >> So, for back-ports, I can could up with some Darwin-specific Makefike ch= ange that >> only adds the ASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION=3D0 for Darwin. >>=20 >> So - OK for trunk with a bumped soname? >=20 > Yes. >=20 >> (and a TODO to figure a Darwin-only backport) >=20 > Yeah. This turned out to be easier than I=E2=80=99d expected, since there was alr= eady a Darwin-specific guard in the Makefile. Tested on x86_64-darwin{11,13,14,16,17,18}, x86_64,powerpc64-linux-gnu (that the symbol is not removed for the Linux cases). Applied to the 9 branch for 9.3 Iain 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. diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am index 867240d244..6efbc1df7f 100644 --- a/libsanitizer/asan/Makefile.am +++ b/libsanitizer/asan/Makefile.am @@ -5,7 +5,7 @@ gcc_version :=3D $(shell @get_gcc_base_ver@ $(top_srcdir)/.= ./gcc/BASE-VER) =20 DEFS =3D -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_M= ACROS -D__STDC_LIMIT_MACROS -DASAN_HAS_EXCEPTIONS=3D1 -DASAN_NEEDS_SEGV=3D1= -DCAN_SANITIZE_UB=3D0 if USING_MAC_INTERPOSE -DEFS +=3D -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT +DEFS +=3D -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT -DASAN_HAS_CX= A_RETHROW_PRIMARY_EXCEPTION=3D0 endif AM_CXXFLAGS =3D -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -= Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-po= inter -funwind-tables -fvisibility=3Dhidden -Wno-variadic-macros -fno-ipa-i= cf AM_CXXFLAGS +=3D $(LIBSTDCXX_RAW_CXX_CXXFLAGS) diff --git a/libsanitizer/asan/asan_interceptors.h b/libsanitizer/asan/asan= _interceptors.h index b599ebb0ba..beb1dc9532 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