summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2017-08-23 16:50:27 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2017-08-23 16:50:27 +0000
commitf8774f1d735253f54531b585915a7529837d70ce (patch)
treea0ae3f9ad9191c9a0261a3e45c7493334e4b16e9
parent853a8d9ffcf76cbfeba132a932571e6cd07e1b79 (diff)
downloadbcm5719-llvm-f8774f1d735253f54531b585915a7529837d70ce.tar.gz
bcm5719-llvm-f8774f1d735253f54531b585915a7529837d70ce.zip
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. llvm-svn: 311574
-rw-r--r--libunwind/include/unwind.h2
-rw-r--r--libunwind/test/alignment.pass.cpp12
2 files changed, 11 insertions, 3 deletions
diff --git a/libunwind/include/unwind.h b/libunwind/include/unwind.h
index a1a84e9e700..58dc3d95e8c 100644
--- a/libunwind/include/unwind.h
+++ b/libunwind/include/unwind.h
@@ -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,
diff --git a/libunwind/test/alignment.pass.cpp b/libunwind/test/alignment.pass.cpp
index 5ab55842621..1a3ca5a9230 100644
--- a/libunwind/test/alignment.pass.cpp
+++ b/libunwind/test/alignment.pass.cpp
@@ -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()
{
OpenPOWER on IntegriCloud