Fix alignment of 64-bit atomics on iOS

The ldrexd and strexd instructions require 64-bit alignment, but Clang
for iOS aligns those types on 32-bit boundaries inside structures. We
can't use Q_ALIGNOF because it returns the alignment for the type inside
a structure.

Task-number: QTBUG-46949
Change-Id: Ib056b47dde3341ef9a52ffff13ef17bede0846f2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Thiago Macieira 2015-07-08 15:01:54 -07:00
parent 6388b30e79
commit 7833f4852a

View File

@ -90,7 +90,10 @@ private:
template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)>
{
typedef T Type;
// this is GCC or GCC-like, so we can use extensions:
// force the alignment to be the size of the type, as on some ABIs the alignment
// of 64-bit types is 32-bit. We need proper alignment for LDREX / STREX.
typedef __attribute__((__aligned__(sizeof(T)))) T Type;
};
#ifndef Q_CC_RVCT