Author: compnerd Date: Wed Aug 23 09:50:27 2017 New Revision: 311574 URL: http://llvm.org/viewvc/llvm-project?rev=311574&view=rev Log: ARM: explicitly specify the 8-byte alignment
It seems that GCC interprets `__attribute__((__aligned__))` as 8-byte alignment on ARM, but clang does not. Explicitly specify the double-word alignment value to ensure that the structure is properly aligned. Modified: libunwind/trunk/include/unwind.h libunwind/trunk/test/alignment.pass.cpp Modified: libunwind/trunk/include/unwind.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/unwind.h?rev=311574&r1=311573&r2=311574&view=diff ============================================================================== --- libunwind/trunk/include/unwind.h (original) +++ libunwind/trunk/include/unwind.h Wed Aug 23 09:50:27 2017 @@ -100,7 +100,7 @@ struct _Unwind_Control_Block { } pr_cache; long long int :0; /* Enforce the 8-byte alignment */ -} __attribute__((__aligned__)); +} __attribute__((__aligned__(8))); typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (_Unwind_State state, Modified: libunwind/trunk/test/alignment.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/alignment.pass.cpp?rev=311574&r1=311573&r2=311574&view=diff ============================================================================== --- libunwind/trunk/test/alignment.pass.cpp (original) +++ libunwind/trunk/test/alignment.pass.cpp Wed Aug 23 09:50:27 2017 @@ -13,8 +13,16 @@ #include <unwind.h> -struct MaxAligned {} __attribute__((aligned)); -static_assert(alignof(_Unwind_Exception) == alignof(MaxAligned), ""); +// EHABI : 8-byte aligned +// itanium: largest supported alignment for the system +#if defined(_LIBUNWIND_ARM_EHABI) +static_assert(alignof(_Unwind_Control_Block) == 8, + "_Unwind_Control_Block must be double-word aligned"); +#else +struct MaxAligned {} __attribute__((__aligned__)); +static_assert(alignof(_Unwind_Exception) == alignof(MaxAligned), + "_Unwind_Exception must be maximally aligned"); +#endif int main() { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits