[PATCH] D86102: [libunwind] Ensure enough alignment for unw_cursor_t for SEH build configurations
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 22 12:56:56 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG542db87f1ac6: [libunwind] Ensure enough alignment for unw_cursor_t for SEH build… (authored by mstorsjo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86102/new/
https://reviews.llvm.org/D86102
Files:
libunwind/include/libunwind.h
libunwind/src/UnwindCursor.hpp
Index: libunwind/src/UnwindCursor.hpp
===================================================================
--- libunwind/src/UnwindCursor.hpp
+++ libunwind/src/UnwindCursor.hpp
@@ -530,6 +530,8 @@
: _addressSpace(as), _unwindInfoMissing(false) {
static_assert((check_fit<UnwindCursor<A, R>, unw_cursor_t>::does_fit),
"UnwindCursor<> does not fit in unw_cursor_t");
+ static_assert((alignof(UnwindCursor<A, R>) <= alignof(unw_cursor_t)),
+ "UnwindCursor<> requires more alignment than unw_cursor_t");
memset(&_info, 0, sizeof(_info));
memset(&_histTable, 0, sizeof(_histTable));
_dispContext.ContextRecord = &_msContext;
@@ -1182,6 +1184,8 @@
_isSignalFrame(false) {
static_assert((check_fit<UnwindCursor<A, R>, unw_cursor_t>::does_fit),
"UnwindCursor<> does not fit in unw_cursor_t");
+ static_assert((alignof(UnwindCursor<A, R>) <= alignof(unw_cursor_t)),
+ "UnwindCursor<> requires more alignment than unw_cursor_t");
memset(&_info, 0, sizeof(_info));
}
Index: libunwind/include/libunwind.h
===================================================================
--- libunwind/include/libunwind.h
+++ libunwind/include/libunwind.h
@@ -43,6 +43,12 @@
#define LIBUNWIND_AVAIL
#endif
+#if defined(_WIN32) && defined(__SEH__)
+ #define LIBUNWIND_CURSOR_ALIGNMENT_ATTR __attribute__((__aligned__(16)))
+#else
+ #define LIBUNWIND_CURSOR_ALIGNMENT_ATTR
+#endif
+
/* error codes */
enum {
UNW_ESUCCESS = 0, /* no error */
@@ -68,7 +74,7 @@
struct unw_cursor_t {
uint64_t data[_LIBUNWIND_CURSOR_SIZE];
-};
+} LIBUNWIND_CURSOR_ALIGNMENT_ATTR;
typedef struct unw_cursor_t unw_cursor_t;
typedef struct unw_addr_space *unw_addr_space_t;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86102.287213.patch
Type: text/x-patch
Size: 1752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200822/3ec72e3c/attachment.bin>
More information about the llvm-commits
mailing list