Fix ASSERT_VALID_CODE_POINTER for our ARM builds
authorSimon Hausmann <simon.hausmann@digia.com>
Thu, 17 Oct 2013 08:45:13 +0000 (10:45 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 17 Oct 2013 09:36:32 +0000 (11:36 +0200)
We want to allow intermixing thumb and ARM for all builds, not only Android.
Modified the macro to do a thumb-compatible null pointer check.

This also works around a miscompilation on QNX where the compiler appeared to
make incorrect assumptions about the address of functions we are taking.

Change-Id: Ib8fc400178e0c2621bde2ca94b3f94041591e19a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/3rdparty/masm/assembler/MacroAssemblerCodeRef.h

index b699316..f03254a 100644 (file)
 
 // ASSERT_VALID_CODE_POINTER checks that ptr is a non-null pointer, and that it is a valid
 // instruction address on the platform (for example, check any alignment requirements).
-// (Disabled checks on Android/ARM because we want to intermix thumb and arm)
-#if CPU(ARM_THUMB2) && !defined(Q_OS_ANDROID)
+#if CPU(ARM_THUMB2)
 // ARM/thumb instructions must be 16-bit aligned, but all code pointers to be loaded
 // into the processor are decorated with the bottom bit set, indicating that this is
 // thumb code (as oposed to 32-bit traditional ARM).  The first test checks for both
 // decorated and undectorated null, and the second test ensures that the pointer is
 // decorated.
 #define ASSERT_VALID_CODE_POINTER(ptr) \
-    ASSERT(reinterpret_cast<intptr_t>(ptr) & ~1); \
-    ASSERT(reinterpret_cast<intptr_t>(ptr) & 1)
+    ASSERT(reinterpret_cast<intptr_t>(ptr) & ~1);
 #define ASSERT_VALID_CODE_OFFSET(offset) \
     ASSERT(!(offset & 1)) // Must be multiple of 2.
 #else