From d71bfc7777a48edfeb0aee0e3da97ac700a3dc90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann?= Date: Thu, 15 May 2008 01:00:28 -0400 Subject: [PATCH] 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. Fix bug 15693. --- configure.ac | 4 ++-- pixman/pixman-pict.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d80022b..988bee1 100644 --- a/configure.ac +++ b/configure.ac @@ -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 #include diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c index 00ac511..833d65a 100644 --- a/pixman/pixman-pict.c +++ b/pixman/pixman-pict.c @@ -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, -- 2.7.4