xref: /llvm-project/libunwind/test/alignment.compile.pass.cpp (revision 504bc07d1afc7bad7b980a977141696ec8298e7e)
1*504bc07dSLouis Dionne // -*- C++ -*-
2*504bc07dSLouis Dionne //===----------------------------------------------------------------------===//
3*504bc07dSLouis Dionne //
4*504bc07dSLouis Dionne // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*504bc07dSLouis Dionne // See https://llvm.org/LICENSE.txt for license information.
6*504bc07dSLouis Dionne // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*504bc07dSLouis Dionne //
8*504bc07dSLouis Dionne //===----------------------------------------------------------------------===//
9*504bc07dSLouis Dionne 
10*504bc07dSLouis Dionne // The Itanium ABI requires that _Unwind_Exception objects are "double-word
11*504bc07dSLouis Dionne // aligned".
12*504bc07dSLouis Dionne 
13*504bc07dSLouis Dionne #include <unwind.h>
14*504bc07dSLouis Dionne 
15*504bc07dSLouis Dionne // EHABI  : 8-byte aligned
16*504bc07dSLouis Dionne // itanium: largest supported alignment for the system
17*504bc07dSLouis Dionne #if defined(_LIBUNWIND_ARM_EHABI)
18*504bc07dSLouis Dionne static_assert(alignof(_Unwind_Control_Block) == 8,
19*504bc07dSLouis Dionne               "_Unwind_Control_Block must be double-word aligned");
20*504bc07dSLouis Dionne #else
21*504bc07dSLouis Dionne struct MaxAligned {} __attribute__((__aligned__));
22*504bc07dSLouis Dionne static_assert(alignof(_Unwind_Exception) == alignof(MaxAligned),
23*504bc07dSLouis Dionne               "_Unwind_Exception must be maximally aligned");
24*504bc07dSLouis Dionne #endif
25