From owner-dev-commits-src-all@freebsd.org Sat Mar 13 17:38:17 2021 Return-Path: Delivered-To: dev-commits-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 712F557D5D5; Sat, 13 Mar 2021 17:38:17 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay213.isp.belgacom.be (mailrelay213.isp.belgacom.be [195.238.22.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign RSA OV SSL CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DyVJm6Gj7z57pR; Sat, 13 Mar 2021 17:38:16 +0000 (UTC) (envelope-from tijl@freebsd.org) IronPort-SDR: 8x4W9c24hjdW4vjtyJ7QY9JXx5Qny87QoN24bLLq1wEOyX/CVU0+W3iikNhnmQJ3tY3Z1zn0lA R8DiUkQpy/vdN8GKFgh5DOuc70GQEUvFtbAURYqm8tdX+0jQ54N3NZzb/H3B1T1ns2TqTpv1x8 +gfmjyk23BC5lvDkOFhA66cMGTzj8yQKSJ0tU9ZXkl0eBd3bpBM1xAnUDzOezcudLH8YIq5WyG FHPCv0cRR10m6W5ygMrOvUPHva49U16bXtHVD63CH2KqeVHF7OZXgZTEs6ZXDCon56+eElXHDr QxA= X-IPAS-Result: =?us-ascii?q?A2BEDACF90xg/wSs8lFaHAEBAQEBAQcBARIBAQQEAQFAB?= =?us-ascii?q?4FIAoMKFVYBUBqNRYYoghgDNwGKcIl8hUmBaAsBAQEBAQEBAQEzCgQBAYRNA?= =?us-ascii?q?oF1JjgTAgMBAQEDAgMBAQEBBgEBAQEBAQUEAYYYOQ1DARABBAGBXiKDawEFO?= =?us-ascii?q?j8QCw4KFRlXBhOCcYMLC6xJgTSJX4EJgTkBjUJCggyDdzU+gVF4FwQWgQCBB?= =?us-ascii?q?oU3BI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zj0munTt13 fzLMaXtApDXIXjClLfhc6x960lZyAcr0dBf5pBUCrUaLfL9QE/+qsLXAQQiMwOp2ernD8991 owGVWKVHqCZKL/SsUOP5u83PuaDepEVtC/hJPgi4v7uiH45mUMGfaWwxpsXcmy3Eu1jI0qDY HrshMwMEWkQvgUgUuPlk0aCXiNJa3a1RaI86SkxCJi6AofbWoCtnLuB0T+mEZJIeGBKE0yDE XDtd4WBWvcMdDmSLtZ6kjweSbetUpUu1RWqtALhxbpnNPTb9TMDupL4ydd5/erTlQs99TZsF cSSz3mNT31onmMPXzI2x7p/rlBkxlif1qh4hvlYFd1P5/NVTAg6L4Xcwvd0C9DoRA3OYMyGS E27Tdm8BjExVN0xyccUY0lhA9WikgzD3y2yDrAIlryLAYc58qzG33fvOcly0G3G27Q7g1khW MtPOj7uuqkq2wnWBpLTgg2wkaqwdK9UiCLM8U+t12eDlnp0FglqXvOWc2oYYx7qStCxzUTFV LKrALI8el9dyMyGAoVQZ9DDtnkAQ+3sboeNK1mtknu9UE7bjoiHa5DnLj114Q== IronPort-HdrOrdr: A9a23:UJv61Ky7/1mA43TZH/qkKrPwqL1zdoIgy1knxilNYDZSddGVkN 3roeQD2XbP+VAscVwDufTFAqmPRnvA6YV4iLN7AZ6OVBTr0VHHEKhM9o3nqgeMJwTa9vRBkY dMGpIOa+HYKFhhkILH5xOlGMwr29mN/MmT5Nv261dIYUVUZ7p77wF/Yzz6LmRTSBNdDZQ0UL qwj/A3wAaIQngcYsSlCnRtZYGqzeHjro7sYhINGncchzWmsDXA0tLHOind9C03FxlIxa4m+W jDjhaR3NTAj9iLjiXy80WW1YlfktmJ8KonOOWczssSIVzX+2KVWLg= X-IronPort-Anti-Spam-Filtered: true Received: from 4.172-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.172.4]) by relay.proximus.be with ESMTP; 13 Mar 2021 18:38:14 +0100 Received: from localhost (localhost [127.0.0.1]) by kalimero.tijl.coosemans.org (8.16.1/8.16.1) with ESMTP id 12DHcDZl005701; Sat, 13 Mar 2021 18:38:13 +0100 (CET) (envelope-from tijl@FreeBSD.org) Date: Sat, 13 Mar 2021 18:38:12 +0100 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Dimitry Andric Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 9097e3cbcac4 - main - Partially revert libcxxrt changes to avoid _Unwind_Exception change Message-ID: <20210313183812.77b74819@FreeBSD.org> In-Reply-To: <202103131354.12DDsnKR065154@gitrepo.freebsd.org> References: <202103131354.12DDsnKR065154@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DyVJm6Gj7z57pR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 17:38:17 -0000 On Sat, 13 Mar 2021 13:54:49 GMT Dimitry Andric wrote: > The branch main has been updated by dim: > > URL: https://cgit.FreeBSD.org/src/commit/?id=9097e3cbcac455eb0dedd097d8d5548c72568d0a > > commit 9097e3cbcac455eb0dedd097d8d5548c72568d0a > Author: Dimitry Andric > AuthorDate: 2021-03-13 13:54:24 +0000 > Commit: Dimitry Andric > CommitDate: 2021-03-13 13:54:24 +0000 > > Partially revert libcxxrt changes to avoid _Unwind_Exception change > > (Note I am also applying this to main and stable/13, to restore the old > libcxxrt ABI and to avoid having to maintain a compat library.) > > After the recent cherry-picking of libcxxrt commits 0ee0dbfb0d26 and > d2b3fadf2db5, users reported that editors/libreoffice packages from the > official package builders did not start anymore. It turns out that the > combination of these commits subtly changes the ABI, requiring all > applications that depend on internal details of struct _Unwind_Exception > (available via unwind-arm.h and unwind-itanium.h) to be recompiled. > > However, the FreeBSD package builders always use -RELEASE jails, so > these still use the old declaration of struct _Unwind_Exception, which > is not entirely compatible. In particular, LibreOffice uses this struct > in its internal "uno bridge" component, where it attempts to setup its > own exception handling mechanism. > > To fix this incompatibility, go back to the old declarations of struct > _Unwind_Exception, and restore the __LP64__ specific workaround we had > in place before (which was to cope with yet another, older ABI bug). > > Effectively, this reverts upstream libcxxrt commits 88bdf6b290da > ("Specify double-word alignment for ARM unwind") and b96169641f79 > ("Updated Itanium unwind"), and reapplies our commit 3c4fd2463bb2 > ("libcxxrt: add padding in __cxa_allocate_* to fix alignment"). > > PR: 253840 > --- > contrib/libcxxrt/exception.cc | 30 ++++++++++++++++++++++++------ > contrib/libcxxrt/unwind-arm.h | 2 +- > contrib/libcxxrt/unwind-itanium.h | 9 +++------ > 3 files changed, 28 insertions(+), 13 deletions(-) > > diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc > index 0fb26ddb4ed2..0de878e9e6db 100644 > --- a/contrib/libcxxrt/exception.cc > +++ b/contrib/libcxxrt/exception.cc > @@ -572,6 +572,19 @@ static void free_exception(char *e) > } > } > > +#ifdef __LP64__ > +/** > + * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte > + * alignment but it was broken by the addition of the referenceCount. > + * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep > + * compatibility with consumers of the broken __cxa_exception, explicitly add > + * padding on allocation (and account for it on free). > + */ > +static const int exception_alignment_padding = 8; > +#else > +static const int exception_alignment_padding = 0; > +#endif > + > /** > * Allocates an exception structure. Returns a pointer to the space that can > * be used to store an object of thrown_size bytes. This function will use an > @@ -580,16 +593,19 @@ static void free_exception(char *e) > */ > extern "C" void *__cxa_allocate_exception(size_t thrown_size) > { > - size_t size = thrown_size + sizeof(__cxa_exception); > + size_t size = exception_alignment_padding + sizeof(__cxa_exception) + > + thrown_size; > char *buffer = alloc_or_die(size); > - return buffer+sizeof(__cxa_exception); > + return buffer + exception_alignment_padding + sizeof(__cxa_exception); > } > > extern "C" void *__cxa_allocate_dependent_exception(void) > { > - size_t size = sizeof(__cxa_dependent_exception); > + size_t size = exception_alignment_padding + > + sizeof(__cxa_dependent_exception); > char *buffer = alloc_or_die(size); > - return buffer+sizeof(__cxa_dependent_exception); > + return buffer + exception_alignment_padding + > + sizeof(__cxa_dependent_exception); > } > > /** > @@ -617,7 +633,8 @@ extern "C" void __cxa_free_exception(void *thrown_exception) > } > } > > - free_exception(reinterpret_cast(ex)); > + free_exception(reinterpret_cast(ex) - > + exception_alignment_padding); > } > > static void releaseException(__cxa_exception *exception) > @@ -644,7 +661,8 @@ void __cxa_free_dependent_exception(void *thrown_exception) > { > releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); > } > - free_exception(reinterpret_cast(ex)); > + free_exception(reinterpret_cast(ex) - > + exception_alignment_padding); > } > > /** > diff --git a/contrib/libcxxrt/unwind-arm.h b/contrib/libcxxrt/unwind-arm.h > index ec81237e573b..6eb9d9e45981 100644 > --- a/contrib/libcxxrt/unwind-arm.h > +++ b/contrib/libcxxrt/unwind-arm.h > @@ -97,7 +97,7 @@ struct _Unwind_Exception > } pr_cache; > /** Force alignment of next item to 8-byte boundary */ > long long int :0; > -} __attribute__((__aligned__(8))); > +}; > > /* Unwinding functions */ > _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *ucbp); > diff --git a/contrib/libcxxrt/unwind-itanium.h b/contrib/libcxxrt/unwind-itanium.h > index 199d91de283d..1ee0cf0e81c4 100644 > --- a/contrib/libcxxrt/unwind-itanium.h > +++ b/contrib/libcxxrt/unwind-itanium.h > @@ -79,12 +79,9 @@ struct _Unwind_Exception > { > uint64_t exception_class; > _Unwind_Exception_Cleanup_Fn exception_cleanup; > - uintptr_t private_1; > - uintptr_t private_2; > -#if __SIZEOF_POINTER__ == 4 > - uint32_t reserved[3]; > -#endif > - } __attribute__((__aligned__)); > + unsigned long private_1; > + unsigned long private_2; > + } ; Shouldn't these definitions be the same as the ones in GCC?