From owner-svn-src-all@freebsd.org Mon Jul 29 06:13:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6546BE7D6; Mon, 29 Jul 2019 06:13:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9158F68171; Mon, 29 Jul 2019 06:13:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 584C423EF5; Mon, 29 Jul 2019 06:13:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6T6DO7p088292; Mon, 29 Jul 2019 06:13:24 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T6DN3k088289; Mon, 29 Jul 2019 06:13:23 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907290613.x6T6DN3k088289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 29 Jul 2019 06:13:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r350400 - in stable: 11/contrib/libcxxrt 11/lib/libcxxrt 12/contrib/libcxxrt 12/lib/libcxxrt X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/libcxxrt 11/lib/libcxxrt 12/contrib/libcxxrt 12/lib/libcxxrt X-SVN-Commit-Revision: 350400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9158F68171 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 06:13:24 -0000 Author: dim Date: Mon Jul 29 06:13:22 2019 New Revision: 350400 URL: https://svnweb.freebsd.org/changeset/base/350400 Log: MFC r350360: Merge libcxxrt master f96846efbfd508f66d91fcbbef5dd808947c7f6d. Interesting fixes: f96846e Fix std::size_t -> size_t to unbreak build against libc++ 6.0.0 6f4cfa2 Fix the uncaught exception count with rethrowing (PR 239265) db54f53 Added C++14-specific operator delete (#47) PR: 239265 Modified: stable/11/contrib/libcxxrt/exception.cc (contents, props changed) stable/11/contrib/libcxxrt/memory.cc (contents, props changed) stable/11/lib/libcxxrt/Makefile stable/11/lib/libcxxrt/Version.map Directory Properties: stable/11/ (props changed) stable/11/contrib/libcxxrt/abi_namespace.h (props changed) stable/11/contrib/libcxxrt/auxhelper.cc (props changed) stable/11/contrib/libcxxrt/cxxabi.h (props changed) stable/11/contrib/libcxxrt/dwarf_eh.h (props changed) stable/11/contrib/libcxxrt/dynamic_cast.cc (props changed) stable/11/contrib/libcxxrt/guard.cc (props changed) stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c (props changed) stable/11/contrib/libcxxrt/stdexcept.cc (props changed) stable/11/contrib/libcxxrt/stdexcept.h (props changed) stable/11/contrib/libcxxrt/terminate.cc (props changed) stable/11/contrib/libcxxrt/typeinfo.cc (props changed) stable/11/contrib/libcxxrt/typeinfo.h (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/libcxxrt/exception.cc (contents, props changed) stable/12/contrib/libcxxrt/memory.cc (contents, props changed) stable/12/lib/libcxxrt/Makefile stable/12/lib/libcxxrt/Version.map Directory Properties: stable/12/ (props changed) stable/12/contrib/libcxxrt/abi_namespace.h (props changed) stable/12/contrib/libcxxrt/auxhelper.cc (props changed) stable/12/contrib/libcxxrt/cxxabi.h (props changed) stable/12/contrib/libcxxrt/dwarf_eh.h (props changed) stable/12/contrib/libcxxrt/dynamic_cast.cc (props changed) stable/12/contrib/libcxxrt/guard.cc (props changed) stable/12/contrib/libcxxrt/libelftc_dem_gnu3.c (props changed) stable/12/contrib/libcxxrt/stdexcept.cc (props changed) stable/12/contrib/libcxxrt/stdexcept.h (props changed) stable/12/contrib/libcxxrt/terminate.cc (props changed) stable/12/contrib/libcxxrt/typeinfo.cc (props changed) stable/12/contrib/libcxxrt/typeinfo.h (props changed) Modified: stable/11/contrib/libcxxrt/exception.cc ============================================================================== --- stable/11/contrib/libcxxrt/exception.cc Mon Jul 29 03:28:46 2019 (r350399) +++ stable/11/contrib/libcxxrt/exception.cc Mon Jul 29 06:13:22 2019 (r350400) @@ -879,6 +879,13 @@ extern "C" void __cxa_rethrow() assert(ex->handlerCount > 0 && "Rethrowing uncaught exception!"); + // `globals->uncaughtExceptions` was decremented by `__cxa_begin_catch`. + // It's normally incremented by `throw_exception`, but this path invokes + // `_Unwind_Resume_or_Rethrow` directly to rethrow the exception. + // This path is only reachable if we're rethrowing a C++ exception - + // foreign exceptions don't adjust any of this state. + globals->uncaughtExceptions++; + // ex->handlerCount will be decremented in __cxa_end_catch in enclosing // catch block @@ -1224,11 +1231,13 @@ extern "C" void *__cxa_begin_catch(void *e) // we see is a foreign exception then we won't have called it yet. __cxa_thread_info *ti = thread_info(); __cxa_eh_globals *globals = &ti->globals; - globals->uncaughtExceptions--; _Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(e); if (isCXXException(exceptionObject->exception_class)) { + // Only exceptions thrown with a C++ exception throwing function will + // increment this, so don't decrement it here. + globals->uncaughtExceptions--; __cxa_exception *ex = exceptionFromPointer(exceptionObject); if (ex->handlerCount == 0) @@ -1365,6 +1374,14 @@ extern "C" std::type_info *__cxa_current_exception_typ } /** + * Cleanup, ensures that `__cxa_end_catch` is called to balance an explicit + * `__cxa_begin_catch` call. + */ +static void end_catch(char *) +{ + __cxa_end_catch(); +} +/** * ABI function, called when an exception specification is violated. * * This function does not return. @@ -1372,6 +1389,12 @@ extern "C" std::type_info *__cxa_current_exception_typ extern "C" void __cxa_call_unexpected(void*exception) { _Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(exception); + // Wrap the call to the unexpected handler in calls to `__cxa_begin_catch` + // and `__cxa_end_catch` so that we correctly update exception counts if + // the unexpected handler throws an exception. + __cxa_begin_catch(exceptionObject); + __attribute__((cleanup(end_catch))) + char unused; if (exceptionObject->exception_class == exception_class) { __cxa_exception *ex = exceptionFromPointer(exceptionObject); Modified: stable/11/contrib/libcxxrt/memory.cc ============================================================================== --- stable/11/contrib/libcxxrt/memory.cc Mon Jul 29 03:28:46 2019 (r350399) +++ stable/11/contrib/libcxxrt/memory.cc Mon Jul 29 06:13:22 2019 (r350400) @@ -151,4 +151,21 @@ void operator delete[](void * ptr) NOEXCEPT ::operator delete(ptr); } +// C++14 additional delete operators +#if __cplusplus >= 201402L + +__attribute__((weak)) +void operator delete(void * ptr, size_t) NOEXCEPT +{ + ::operator delete(ptr); +} + + +__attribute__((weak)) +void operator delete[](void * ptr, size_t) NOEXCEPT +{ + ::operator delete(ptr); +} + +#endif Modified: stable/11/lib/libcxxrt/Makefile ============================================================================== --- stable/11/lib/libcxxrt/Makefile Mon Jul 29 03:28:46 2019 (r350399) +++ stable/11/lib/libcxxrt/Makefile Mon Jul 29 06:13:22 2019 (r350400) @@ -23,7 +23,7 @@ SRCS+= libelftc_dem_gnu3.c\ WARNS= 0 CFLAGS+= -isystem ${SRCDIR} -nostdinc++ .if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++11 +CXXFLAGS+= -std=c++14 .endif VERSION_MAP= ${.CURDIR}/Version.map Modified: stable/11/lib/libcxxrt/Version.map ============================================================================== --- stable/11/lib/libcxxrt/Version.map Mon Jul 29 03:28:46 2019 (r350399) +++ stable/11/lib/libcxxrt/Version.map Mon Jul 29 06:13:22 2019 (r350400) @@ -277,6 +277,10 @@ CXXABI_1.3.9 { "typeinfo name for unsigned __int128 const*"; "typeinfo name for unsigned __int128"; "typeinfo name for unsigned __int128*"; + "operator delete[](void*, unsigned int)"; + "operator delete(void*, unsigned int)"; + "operator delete[](void*, unsigned long)"; + "operator delete(void*, unsigned long)"; }; } CXXABI_1.3.6;