[libcxx-commits] [PATCH] D73838: [libcxxabi] Fix layout of __cxa_exception for win64, fixing static assert failures

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 3 00:08:44 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG09dc884eb2e4: [libcxxabi] Fix layout of __cxa_exception for win64 (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73838/new/

https://reviews.llvm.org/D73838

Files:
  libcxxabi/src/cxa_exception.h


Index: libcxxabi/src/cxa_exception.h
===================================================================
--- libcxxabi/src/cxa_exception.h
+++ libcxxabi/src/cxa_exception.h
@@ -28,7 +28,7 @@
 _LIBCXXABI_HIDDEN bool     __isOurExceptionClass(const _Unwind_Exception*);
 
 struct _LIBCXXABI_HIDDEN __cxa_exception {
-#if defined(__LP64__) || defined(_LIBCXXABI_ARM_EHABI)
+#if defined(__LP64__) || defined(_WIN64) || defined(_LIBCXXABI_ARM_EHABI)
     // 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.
@@ -62,7 +62,7 @@
     void *adjustedPtr;
 #endif
 
-#if !defined(__LP64__) && !defined(_LIBCXXABI_ARM_EHABI)
+#if !defined(__LP64__) && !defined(_WIN64) && !defined(_LIBCXXABI_ARM_EHABI)
     // This is a new field to support C++ 0x exception_ptr.
     // For binary compatibility it is placed where the compiler
     // previously adding padded to 64-bit align unwindHeader.
@@ -75,7 +75,7 @@
 // The layout of this structure MUST match the layout of __cxa_exception, with
 // primaryException instead of referenceCount.
 struct _LIBCXXABI_HIDDEN __cxa_dependent_exception {
-#if defined(__LP64__) || defined(_LIBCXXABI_ARM_EHABI)
+#if defined(__LP64__) || defined(_WIN64) || defined(_LIBCXXABI_ARM_EHABI)
     void* reserve; // padding.
     void* primaryException;
 #endif
@@ -100,7 +100,7 @@
     void *adjustedPtr;
 #endif
 
-#if !defined(__LP64__) && !defined(_LIBCXXABI_ARM_EHABI)
+#if !defined(__LP64__) && !defined(_WIN64) && !defined(_LIBCXXABI_ARM_EHABI)
     void* primaryException;
 #endif
     _Unwind_Exception unwindHeader;
@@ -125,7 +125,7 @@
                       sizeof(_Unwind_Exception) + sizeof(void*) ==
                   sizeof(__cxa_dependent_exception),
               "propagationCount has wrong negative offset");
-#elif defined(__LP64__)
+#elif defined(__LP64__) || defined(_WIN64)
 static_assert(offsetof(__cxa_exception, adjustedPtr) +
                       sizeof(_Unwind_Exception) + sizeof(void*) ==
                   sizeof(__cxa_exception),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73838.241976.patch
Type: text/x-patch
Size: 2141 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200203/4db851d6/attachment-0001.bin>


More information about the libcxx-commits mailing list