Work around GCC bug causing crashes in Mozilla with SSE2
authorSøren Sandmann <sandmann@redhat.com>
Thu, 15 May 2008 05:00:28 +0000 (01:00 -0400)
committerSøren Sandmann <sandmann@redhat.com>
Thu, 15 May 2008 05:00:28 +0000 (01:00 -0400)
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.

configure.ac
pixman/pixman-pict.c

index d80022b..988bee1 100644 (file)
@@ -213,8 +213,8 @@ xserver_save_CFLAGS=$CFLAGS
 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>
index 00ac511..833d65a 100644 (file)
@@ -1715,7 +1715,23 @@ pixman_optimize_operator(pixman_op_t op, pixman_image_t *pSrc, pixman_image_t *p
 
 }
 
+#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,