From nobody Thu Mar 17 18:38:55 2022 X-Original-To: dev-commits-src-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 65C131A15D55; Thu, 17 Mar 2022 18:38:55 +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 4KKGBR2HvRz4p5n; Thu, 17 Mar 2022 18:38:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647542335; 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=0yeYXVkS8qLICvO2MaRMtwwhzXFwIvn/Yk+9BEnfl/g=; b=wbSbpqEqQBDTrTyatISVTEFTjdfYjYEh6afOne7HKGC4jvC1VjTGSetP08jEqEkoAzcRy7 2+p9PcYJ4udS/ASlJ6LePcikarsZmgoBT1XZo9oKRrwz8pmfUVw92kI1bgzfrDHdOzEFAN NzWRC28hS3TCpyiUvk2K85ny/8ahwXlHdDdEvOi0IilA8H5139Clhhn3xWGPKJZl1KnCYI tO2zvJXjEWZ9A4+dLiSgkUlPkowD9QOo3QJjMTVNgDZCzduQQM2LC88YAH6B3qQI53mvE5 moOK+qgqZkDM3xFI5HyPLMGtCfoUtlwj/M4pIJHm+23DzJGsuIIi7+4TVemebw== 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 2F4FF7C9E; Thu, 17 Mar 2022 18:38:55 +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 22HIct4I081443; Thu, 17 Mar 2022 18:38:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22HIctRm081442; Thu, 17 Mar 2022 18:38:55 GMT (envelope-from git) Date: Thu, 17 Mar 2022 18:38:55 GMT Message-Id: <202203171838.22HIctRm081442@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: ea9fa27b9470 - releng/13.1 - Remove compat hacks from libcxxrt's _Unwind_Exception List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.1 X-Git-Reftype: branch X-Git-Commit: ea9fa27b9470c15b4c6c8425839da90b3fda7c28 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647542335; 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=0yeYXVkS8qLICvO2MaRMtwwhzXFwIvn/Yk+9BEnfl/g=; b=m44a5RKDtR2d3y5kx7KPqEvKerRFi+z4xEZt4iL6/EFi5hdixM9YXS6uw3hiTOq9bCjTqv c/q8krfiIhb9VyrUS9Q5AvExROxYu40UinYNODKj5klrZWpl30pNYL0KrVcDNC1D3K6nYN ycEn3mcgLUbtwtcDZYhTtS7LNWWL3ljVVKAkkyIpaeF7T5d6CeqQJBhTI65yCm2P4p4BF+ Km2rprIYWZMD4TMMmfiY/Uz3CYvb1ovLVoBnYcKCVfXOlTg/74uelcAuu5ANR8uNpmMz25 wIHyGT5ioXdZ7BbMfXyFzX2Ix7z0kv/D8mkiDYmQAa9DHvwMbo6eTyvgZhkqKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647542335; a=rsa-sha256; cv=none; b=YSJq5WNjZrGh6PJRUK6GNHC9mqTHsw/81eb8g7qU1wYMQWNtRtPZbvib27CglAtnTUnE4w TaU9JoqTkEzp2O+JgBVKyfkNtUazIfHw26CemKd0AmOud7XzQK+a8Imsd5Ri2yy2EXy3FK bklDGqwIb/iF8fnZPMsMZyzVmL3kjAcW/dUvD0cnq4M67wbdZ8SiAfZx/HDolRdR8QrhS3 45YD8ywapIXB8nTq1I4+VX8NgyDkKG1LtCzGiyxfhDJvw2oGHRr139ZGs/F0sC0PUk4PhD wg4CS2pcAMhZm+a9hOKDIjS/1GDRVCAFpmJsNa+JeJecJPIuYN/U+WCOGXYopg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=ea9fa27b9470c15b4c6c8425839da90b3fda7c28 commit ea9fa27b9470c15b4c6c8425839da90b3fda7c28 Author: Dimitry Andric AuthorDate: 2022-03-08 21:53:16 +0000 Commit: Dimitry Andric CommitDate: 2022-03-17 15:13:06 +0000 Remove compat hacks from libcxxrt's _Unwind_Exception This reverts 9097e3cbcac4, which was in itself a revert of upstream libcxxrt commits 88bdf6b290da ("Specify double-word alignment for ARM unwind") and b96169641f79 ("Updated Itanium unwind"), and a reapplication of our commit 3c4fd2463bb2 ("libcxxrt: add padding in __cxa_allocate_* to fix alignment"). The editors/libreoffice port will be patched to be able to cope with the standards-compliant alignment of _Unwind_Exception and consequently, that of __cxa_exception. The layouts and sizes of these structures should then be completely the same for libcxxrt, libunwind and libc++abi. PR: 262008 Reviewed by: emaste, jhb, theraven Approved by: re (gjb) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D34488 (cherry picked from commit 72df847a94bccee245a3316e4f848482b9ac2ac2) (cherry picked from commit 93779214f1c64c0713f7c900021e35d4e4e49697) --- contrib/libcxxrt/exception.cc | 30 ++++++------------------------ contrib/libcxxrt/unwind-arm.h | 2 +- contrib/libcxxrt/unwind-itanium.h | 9 ++++++--- 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc index 0de878e9e6db..0fb26ddb4ed2 100644 --- a/contrib/libcxxrt/exception.cc +++ b/contrib/libcxxrt/exception.cc @@ -572,19 +572,6 @@ 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 @@ -593,19 +580,16 @@ static const int exception_alignment_padding = 0; */ extern "C" void *__cxa_allocate_exception(size_t thrown_size) { - size_t size = exception_alignment_padding + sizeof(__cxa_exception) + - thrown_size; + size_t size = thrown_size + sizeof(__cxa_exception); char *buffer = alloc_or_die(size); - return buffer + exception_alignment_padding + sizeof(__cxa_exception); + return buffer+sizeof(__cxa_exception); } extern "C" void *__cxa_allocate_dependent_exception(void) { - size_t size = exception_alignment_padding + - sizeof(__cxa_dependent_exception); + size_t size = sizeof(__cxa_dependent_exception); char *buffer = alloc_or_die(size); - return buffer + exception_alignment_padding + - sizeof(__cxa_dependent_exception); + return buffer+sizeof(__cxa_dependent_exception); } /** @@ -633,8 +617,7 @@ extern "C" void __cxa_free_exception(void *thrown_exception) } } - free_exception(reinterpret_cast(ex) - - exception_alignment_padding); + free_exception(reinterpret_cast(ex)); } static void releaseException(__cxa_exception *exception) @@ -661,8 +644,7 @@ void __cxa_free_dependent_exception(void *thrown_exception) { releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); } - free_exception(reinterpret_cast(ex) - - exception_alignment_padding); + free_exception(reinterpret_cast(ex)); } /** diff --git a/contrib/libcxxrt/unwind-arm.h b/contrib/libcxxrt/unwind-arm.h index 6eb9d9e45981..ec81237e573b 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 1ee0cf0e81c4..199d91de283d 100644 --- a/contrib/libcxxrt/unwind-itanium.h +++ b/contrib/libcxxrt/unwind-itanium.h @@ -79,9 +79,12 @@ struct _Unwind_Exception { uint64_t exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; - unsigned long private_1; - unsigned long private_2; - } ; + uintptr_t private_1; + uintptr_t private_2; +#if __SIZEOF_POINTER__ == 4 + uint32_t reserved[3]; +#endif + } __attribute__((__aligned__)); extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,