From nobody Thu Apr 28 20:28:58 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5E23C199A077; Thu, 28 Apr 2022 20:28:59 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Kq6f329Qbz3q63; Thu, 28 Apr 2022 20:28:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651177739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/c7dDHHNOAS5zoMyG0nksbmEUDRuLdpuKZKj/9/wEiw=; b=kga5Gtsf9oASyIx08OWdiQL351mt5u6ifdOK5YXblvQUsr2xupnYNIDzooChyMA7/VlAsk K0NMZnAVel6Enb3kwmac70L/Zta7WBXiZ5BwgSCq9IZkwi62BzJdWz1HtcqL2XXUqYOMr/ ALfxI7Zceemk52XNt37IFBHzFUd2hDblorP0oCfz78IhoChpE+G3UdHWfBC0zIuqUuwRBk VJC3Rr/EzaQs7TpqGni2piNWvzJrOS/N4PSNw5ilgqABYbZKi+1+wspRCFl9pH9n9Q1UVf lwZrpdT8Ka0PzZMdFZpMdUC3W3CCOZm1NcRfZfwxepqj67xyODYYADvULD4zxA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2635C1F780; Thu, 28 Apr 2022 20:28:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23SKSxDX073943; Thu, 28 Apr 2022 20:28:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23SKSwJO073942; Thu, 28 Apr 2022 20:28:58 GMT (envelope-from git) Date: Thu, 28 Apr 2022 20:28:58 GMT Message-Id: <202204282028.23SKSwJO073942@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org From: Tijl Coosemans Subject: git: d86952d1c3aa - 2022Q2 - editors/openoffice-4: make robust against __cxa_exception ABI changes List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tijl X-Git-Repository: ports X-Git-Refname: refs/heads/2022Q2 X-Git-Reftype: branch X-Git-Commit: d86952d1c3aa7f2da0dece5365cb51524a562aaf Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651177739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/c7dDHHNOAS5zoMyG0nksbmEUDRuLdpuKZKj/9/wEiw=; b=unmG3FlRPxFsoXgPWr2Z0oRzJhpqEuMGhL+y3UPntETtLMb0fXTtHsNS4mpZcSjRxhkeGJ IQpBQKcBLM+kKL/w6d0WNLSO1Yr2Ww5O+OB7XOg570XusMTnPVZ3aiIzOAvqXz3xLDvmcA HTxXqZIjRBir3hPaLv5n4yxEeufitRLiQifUBcC30pcoR09M2XOlt9VR11jCME2Xrus/S5 NrByTifh2BQoAQtVLdqx7YWKuicUrQ4fDSjCm8McM71D3oyibWJmsDQx8PK+aook/0zpFR ABf5OOaGTWRCZBObQzA7VYqWULp1Wh4eJRfdG4kMgPlMCO75UdO+NLaDEF/2XA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651177739; a=rsa-sha256; cv=none; b=bV/PGLn4MVfhDnkg00UpISOhLJK9XqTh4EsUrKGx+l3aLMMo0MboaptTudjWgSXdZk228r np94Pj4s/+H8gBHEhhn/nS1f3tH+QN3UM0j9qjdsYfQzhiP/PNxv2p2zClM+cDmE6tlrU4 7Qbl+Pu/ewiAIH82NjDzkDupJFSIOZhSD6OLJb+Ni7BbZGM3sOLm2kDQcZo8YdllbXIGY+ bgi2D2Mce+WSqT0KSY8LlPoDqpxGaAULElGmDQ+N0d+18kT1HcrbQpSZCAmodI8hyp4AYp +kudw5WI/iSzzxIjkNOnLNsLbIw3q0mfKlZ1bDvkuyDSaAgrIUAm+ySXPSl4ew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch 2022Q2 has been updated by tijl: URL: https://cgit.FreeBSD.org/ports/commit/?id=d86952d1c3aa7f2da0dece5365cb51524a562aaf commit d86952d1c3aa7f2da0dece5365cb51524a562aaf Author: Tijl Coosemans AuthorDate: 2022-04-27 20:17:17 +0000 Commit: Tijl Coosemans CommitDate: 2022-04-28 20:20:03 +0000 editors/openoffice-4: make robust against __cxa_exception ABI changes Patch openoffice to replace __cxa_get_globals()->caughtExceptions, which is a pointer to the start of a struct __cxa_exception, with __cxa_current_primary_exception(), which is a pointer to the end. This allows struct __cxa_exception to be extended at the start as was recently done in FreeBSD main and stable/13 on 64-bit architectures. Recently on FreeBSD main and stable/13 __attribute__((__aligned__)) was added to struct _Unwind_Exception which changes its size on 32-bit architectures, and that of __cxa_exception as well. Patch openoffice to detect this so packages built on 13.0 still work on 13.1. Add a build dependency on a recent version of devel/libunwind so we always build with an unwind.h that has the right definition of _Unwind_Exception. (cherry picked from commit 88045c0549d90ad92d5fc630580705107a3f89f2) --- editors/openoffice-4/Makefile | 10 ++++- ...source_cpp__uno_gcc3__freebsd__intel_except.cxx | 15 +++++++ ...ource_cpp__uno_gcc3__freebsd__intel_uno2cpp.cxx | 49 ++++++++++++++++++++++ ...rce_cpp__uno_gcc3__freebsd__powerpc64_share.hxx | 43 +++++++++++++++++++ ...e_cpp__uno_gcc3__freebsd__powerpc64_uno2cpp.cxx | 38 +++++++++++++++++ ...urce_cpp__uno_gcc3__freebsd__x86-64_uno2cpp.cxx | 36 ++++++++++++++++ 6 files changed, 190 insertions(+), 1 deletion(-) diff --git a/editors/openoffice-4/Makefile b/editors/openoffice-4/Makefile index 255004f3e303..c347d44de738 100644 --- a/editors/openoffice-4/Makefile +++ b/editors/openoffice-4/Makefile @@ -2,7 +2,7 @@ PORTNAME= apache-openoffice PORTVERSION= ${AOOVERSION} -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= editors java MASTER_SITES= https://dlcdn.apache.org/openoffice/${PORTVERSION}/source/ \ https://archive.apache.org/dist/openoffice/${PORTVERSION}/source/ \ @@ -59,6 +59,7 @@ BUILD_DEPENDS= \ epm:devel/epm \ ${LOCALBASE}/bin/gperf:devel/gperf \ imake:devel/imake \ + libunwind>=20211201_1:devel/libunwind \ gpatch:devel/patch \ ${LOCALBASE}/include/sane/sane.h:graphics/sane-backends \ ${JAVALIBDIR}/commons-lang.jar:java/apache-commons-lang \ @@ -199,6 +200,13 @@ WITH= SDK .include +.if ${OPSYS} == FreeBSD && ( \ + (${OSVERSION} >= 1300525 && ${OSVERSION} < 1301000) || \ + (${OSVERSION} >= 1301500 && ${OSVERSION} < 1301502) || \ + (${OSVERSION} >= 1400051 && ${OSVERSION} < 1400057)) +BROKEN= please update FreeBSD base system first to fix an ABI incompatibility +.endif + .if defined(WITH_DEBUG) CONFIGURE_ARGS+= --enable-symbols .endif diff --git a/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__intel_except.cxx b/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__intel_except.cxx new file mode 100644 index 000000000000..b41a379b409d --- /dev/null +++ b/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__intel_except.cxx @@ -0,0 +1,15 @@ +--- bridges/source/cpp_uno/gcc3_freebsd_intel/except.cxx.orig 2019-09-17 22:55:10 UTC ++++ bridges/source/cpp_uno/gcc3_freebsd_intel/except.cxx +@@ -220,6 +220,12 @@ static void deleteException( void * pExc ) + static void deleteException( void * pExc ) + { + __cxa_exception const * header = ((__cxa_exception const *)pExc - 1); ++ if (header->exceptionDestructor != &deleteException) { ++ // _Unwind_Exception was made __aligned__ which ++ // increased its size by 12 bytes ++ header = reinterpret_cast<__cxa_exception const *>( ++ reinterpret_cast( header ) - 12 ); ++ } + typelib_TypeDescription * pTD = 0; + OUString unoName( toUNOname( header->exceptionType->name() ) ); + ::typelib_typedescription_getByName( &pTD, unoName.pData ); diff --git a/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__intel_uno2cpp.cxx b/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__intel_uno2cpp.cxx new file mode 100644 index 000000000000..2a336ec5fbc5 --- /dev/null +++ b/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__intel_uno2cpp.cxx @@ -0,0 +1,49 @@ +--- bridges/source/cpp_uno/gcc3_freebsd_intel/uno2cpp.cxx.orig 2019-09-17 22:55:10 UTC ++++ bridges/source/cpp_uno/gcc3_freebsd_intel/uno2cpp.cxx +@@ -44,9 +44,12 @@ using namespace ::com::sun::star::uno; + using namespace ::rtl; + using namespace ::com::sun::star::uno; + #ifdef __GLIBCXX__ ++using CPPU_CURRENT_NAMESPACE::__cxa_exception; + using CPPU_CURRENT_NAMESPACE::__cxa_get_globals; + #else +-using __cxxabiv1::__cxa_get_globals; ++using __cxxabiv1::__cxa_exception; ++using __cxxabiv1::__cxa_current_primary_exception; ++using __cxxabiv1::__cxa_decrement_exception_refcount; + #endif + + namespace +@@ -313,8 +316,31 @@ static void cpp_call( + } + catch (...) + { ++ __cxa_exception *header; ++#ifdef __GLIBCXX__ ++ header = __cxa_get_globals()->caughtExceptions; ++#else ++ header = reinterpret_cast<__cxa_exception *>( __cxa_current_primary_exception() ); ++ if (header) { ++ __cxa_decrement_exception_refcount( header ); ++ header--; ++ uint64_t exc_class = header->unwindHeader.exception_class ++ & 0xffffffffffffff00; ++ if (exc_class != /* "GNUCC++" */ 0x474e5543432b2b00) { ++ // _Unwind_Exception was made __aligned__ which ++ // increased its size by 12 bytes. ++ header = reinterpret_cast<__cxa_exception *>( ++ reinterpret_cast( header ) - 12 ); ++ exc_class = header->unwindHeader.exception_class ++ & 0xffffffffffffff00; ++ if (exc_class != /* "GNUCC++" */ 0x474e5543432b2b00) { ++ header = nullptr; ++ } ++ } ++ } ++#endif + // fill uno exception +- CPPU_CURRENT_NAMESPACE::fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); ++ CPPU_CURRENT_NAMESPACE::fillUnoException( header, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + + // temporary params + for ( ; nTempIndizes--; ) diff --git a/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__powerpc64_share.hxx b/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__powerpc64_share.hxx new file mode 100644 index 000000000000..acba73004356 --- /dev/null +++ b/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__powerpc64_share.hxx @@ -0,0 +1,43 @@ +--- bridges/source/cpp_uno/gcc3_freebsd_powerpc64/share.hxx.orig 2019-09-17 22:55:10 UTC ++++ bridges/source/cpp_uno/gcc3_freebsd_powerpc64/share.hxx +@@ -35,6 +35,7 @@ namespace CPPU_CURRENT_NAMESPACE + + // ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h + ++#ifdef __GLIBCXX__ + struct _Unwind_Exception + { + unsigned exception_class __attribute__((__mode__(__DI__))); +@@ -63,18 +64,21 @@ struct __cxa_exception + + _Unwind_Exception unwindHeader; + }; ++#endif /* __GLIBCXX__ */ + + extern "C" void *__cxa_allocate_exception( + std::size_t thrown_size ) throw(); + extern "C" void __cxa_throw ( + void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn)); + ++#ifdef __GLIBCXX__ + struct __cxa_eh_globals + { + __cxa_exception *caughtExceptions; + unsigned int uncaughtExceptions; + }; + extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); ++#endif /* __GLIBCXX__ */ + + // ----- + +@@ -82,6 +86,10 @@ void raiseException( + void raiseException( + uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); + //================================================================================================== ++#ifndef __GLIBCXX__ ++using __cxxabiv1:: __cxa_exception; ++#endif /* __GLIBCXX__ */ ++ + void fillUnoException( + __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); + } diff --git a/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__powerpc64_uno2cpp.cxx b/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__powerpc64_uno2cpp.cxx new file mode 100644 index 000000000000..205333ecb78c --- /dev/null +++ b/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__powerpc64_uno2cpp.cxx @@ -0,0 +1,38 @@ +--- bridges/source/cpp_uno/gcc3_freebsd_powerpc64/uno2cpp.cxx.orig 2019-09-17 22:55:10 UTC ++++ bridges/source/cpp_uno/gcc3_freebsd_powerpc64/uno2cpp.cxx +@@ -42,6 +42,14 @@ using namespace ::com::sun::star::uno; + + using namespace ::rtl; + using namespace ::com::sun::star::uno; ++#ifdef __GLIBCXX__ ++using CPPU_CURRENT_NAMESPACE::__cxa_exception; ++using CPPU_CURRENT_NAMESPACE::__cxa_get_globals; ++#else ++using __cxxabiv1::__cxa_exception; ++using __cxxabiv1::__cxa_current_primary_exception; ++using __cxxabiv1::__cxa_decrement_exception_refcount; ++#endif + + void MapReturn(long r3, double dret, typelib_TypeClass eTypeClass, void *pRegisterReturn) + { +@@ -448,9 +456,18 @@ static void cpp_call( + } + catch (...) + { ++ __cxa_exception *header; ++#ifdef __GLIBCXX__ ++ header = __cxa_get_globals()->caughtExceptions; ++#else ++ header = reinterpret_cast<__cxa_exception *>( __cxa_current_primary_exception() ); ++ if (header) { ++ __cxa_decrement_exception_refcount( header ); ++ header--; ++ } ++#endif + // fill uno exception +- fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, +- *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); ++ CPPU_CURRENT_NAMESPACE::fillUnoException( header, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + + // temporary params + for ( ; nTempIndizes--; ) diff --git a/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__x86-64_uno2cpp.cxx b/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__x86-64_uno2cpp.cxx new file mode 100644 index 000000000000..1a501426d669 --- /dev/null +++ b/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__x86-64_uno2cpp.cxx @@ -0,0 +1,36 @@ +--- bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx.orig 2019-09-17 22:55:10 UTC ++++ bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx +@@ -50,9 +50,12 @@ using namespace ::com::sun::star::uno; + using namespace ::rtl; + using namespace ::com::sun::star::uno; + #ifdef __GLIBCXX__ ++using CPPU_CURRENT_NAMESPACE::__cxa_exception; + using CPPU_CURRENT_NAMESPACE::__cxa_get_globals; + #else +-using __cxxabiv1::__cxa_get_globals; ++using __cxxabiv1::__cxa_exception; ++using __cxxabiv1::__cxa_current_primary_exception; ++using __cxxabiv1::__cxa_decrement_exception_refcount; + #endif + + //================================================================================================== +@@ -452,8 +455,18 @@ static void cpp_call( + } + catch (...) + { ++ __cxa_exception *header; ++#ifdef __GLIBCXX__ ++ header = __cxa_get_globals()->caughtExceptions; ++#else ++ header = reinterpret_cast<__cxa_exception *>( __cxa_current_primary_exception() ); ++ if (header) { ++ __cxa_decrement_exception_refcount( header ); ++ header--; ++ } ++#endif + // fill uno exception +- CPPU_CURRENT_NAMESPACE::fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); ++ CPPU_CURRENT_NAMESPACE::fillUnoException( header, *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + + // temporary params + for ( ; nTempIndizes--; )