diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-07-08 15:01:54 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-07-15 04:53:38 +0000 |
commit | 7833f4852ab4c44a1fae75cfb1221e19a7b3256c (patch) | |
tree | 510d20f1f854ed992eff7b4cec27015b12ea2c6e /src/corelib/arch | |
parent | 6388b30e79e315262aef95c9825eaaffdfdd9d54 (diff) |
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>
Diffstat (limited to 'src/corelib/arch')
-rw-r--r-- | src/corelib/arch/qatomic_armv6.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h index b14ab3d636..b2ea85ada2 100644 --- a/src/corelib/arch/qatomic_armv6.h +++ b/src/corelib/arch/qatomic_armv6.h @@ -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 |