When using SSE2 intrinsics, gcc assumes that the stack is 16 byte
aligned. Unfortunately some code, such as Mozilla and Mono contain
code that aligns the stack to 4 bytes.
The __force_align_arg_pointer__ makes gcc generate a prologue that
realigns the stack pointer to 16 bytes. Fix bug 15693.
CFLAGS="$CFLAGS -msse2 $SSE_CFLAGS"
AC_COMPILE_IFELSE([
-#if defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
-#error "Need GCC >= 3.4 for SSE2 intrinsics"
+#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))
+#error "Need GCC >= 4.2 for SSE2 intrinsics"
#endif
#include <mmintrin.h>
#include <xmmintrin.h>
}
+#if defined(USE_SSE2) && defined (__GNUC__)
+/*
+ * Work around GCC bug causing crashes in Mozilla with SSE2
+ *
+ * When using SSE2 intrinsics, gcc assumes that the stack is 16 byte
+ * aligned. Unfortunately some code, such as Mozilla and Mono contain
+ * code that aligns the stack to 4 bytes.
+ *
+ * The __force_align_arg_pointer__ makes gcc generate a prologue that
+ * realigns the stack pointer to 16 bytes.
+ *
+ * See https://bugs.freedesktop.org/show_bug.cgi?id=15693
+ */
+
+__attribute__((__force_align_arg_pointer__))
+#endif
void
pixman_image_composite (pixman_op_t op,
pixman_image_t * pSrc,