Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Apr 2022 18:20:37 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 06394327dd1f - stable/13 - Merge libcxxrt commit 45ca8b1942090226ba9368caeeeabc0d4ee41ad6
Message-ID:  <202204191820.23JIKbXE089778@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=06394327dd1fd77c66af06f6f89713c5142fe1b2

commit 06394327dd1fd77c66af06f6f89713c5142fe1b2
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-04-19 16:11:11 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-04-19 18:19:52 +0000

    Merge libcxxrt commit 45ca8b1942090226ba9368caeeeabc0d4ee41ad6
    
      Insert padding in __cxa_exception struct for compatibility
    
      Similar to https://github.com/llvm/llvm-project/commit/f2a436058fcb, the
      addition of __attribute__((__aligned__)) to _Unwind_Exception (in commit
      b9616964) causes implicit padding to be inserted before the unwindHeader
      field in __cxa_exception.
    
      Applications attempt to get at the earlier fields in __cxa_exception, so
      preserve the same negative offsets in __cxa_exception, by moving the
      padding to the beginning of the struct.
    
      The assumption here is that if the ABI is not aware of the padding
      before unwindHeader and put the referenceCount/primaryException in
      there, no padding should exist before unwindHeader.
    
    This should make libreoffice's custom exception handling mechanisms work
    correctly, even if it was built against an older cxxabi.h/unwind.h pair.
    
    PR:             263370
    Approved by:    re (gjb, early MFC)
    MFC after:      immediately
    
    (cherry picked from commit 434215c26da3c6acf2423ab93ff2b41b2d823cc8)
---
 contrib/libcxxrt/cxxabi.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/contrib/libcxxrt/cxxabi.h b/contrib/libcxxrt/cxxabi.h
index 411c4c749ccf..e843599c66da 100644
--- a/contrib/libcxxrt/cxxabi.h
+++ b/contrib/libcxxrt/cxxabi.h
@@ -77,6 +77,13 @@ typedef void (*terminate_handler)();
 struct __cxa_exception
 {
 #if __LP64__
+	/**
+	 * Now _Unwind_Exception is marked with __attribute__((aligned)), which
+	 * implies __cxa_exception is also aligned.  Insert padding in the
+	 * beginning of the struct, rather than before unwindHeader.
+	 */
+	void *reserve;
+
 	/**
 	 * Reference count.  Used to support the C++11 exception_ptr class.  This
 	 * is prepended to the structure in 64-bit mode and squeezed in to the



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202204191820.23JIKbXE089778>