diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-10-02 14:18:31 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-10-10 16:22:58 -0400 |
commit | 6fa993a586426ef1d19f71d83a1eaa9e6704825b (patch) | |
tree | 281fa5b1751841be0e58a79b8bc72adb669d84e7 | |
parent | 12b0a0bbe177b786cd26f10f5b1dc2d612765157 (diff) |
configure.ac: Use -mstackrealign on x86-32 for SSE2 and SSSE3stackrealign2
Code compiled by GCC with -msse2 and -mssse3 assumes a 16 byte aligned
stack, but on x86-32 such alignment is not guaranteed.
Instead of using the __force_align_arg_pointer__ attribute on all
entry points that could potentially call into code compiled with
-msse2 or -mssse3, just compile pixman-sse2.c and pixman-ssse3.c with
-mstackrealign when the target CPU is x86-32 and the compiler supports
this option.
This fixes the glyph-test crash introduced by the previous commit and
also
https://bugs.freedesktop.org/show_bug.cgi?id=68300
V2: Simply add -mstackrealign on x86-32 when the compiler appears to
support it instead of trying to detect the GCC version specifically.
-rw-r--r-- | configure.ac | 15 | ||||
-rw-r--r-- | pixman/pixman-sse2.c | 6 | ||||
-rw-r--r-- | pixman/pixman.c | 19 |
3 files changed, 11 insertions, 29 deletions
diff --git a/configure.ac b/configure.ac index 68d8d6e6..cba60dcf 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,7 @@ m4_define([pixman_micro], 1) m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro]) AC_INIT(pixman, pixman_version, [pixman@lists.freedesktop.org], pixman) +AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE([foreign dist-bzip2]) # Suppress verbose compile lines @@ -66,8 +67,6 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_HEADERS(config.h) -AC_CANONICAL_HOST - test_CFLAGS=${CFLAGS+set} # We may override autoconf default CFLAGS. AC_PROG_CC @@ -391,6 +390,14 @@ fi AM_CONDITIONAL(USE_X86_MMX, test $have_mmx_intrinsics = yes) dnl =========================================================================== +dnl Detect whether -mstackrealign is useful +case $target_cpu in + i[[34567]]86) + PIXMAN_CHECK_CFLAG(-mstackrealign,,[STACKREALIGN="-mstackrealign"]) + ;; +esac + +dnl =========================================================================== dnl Check for SSE2 if test "x$SSE2_CFLAGS" = "x" ; then @@ -400,7 +407,7 @@ if test "x$SSE2_CFLAGS" = "x" ; then SSE2_CFLAGS="-xarch=sse2" fi else - SSE2_CFLAGS="-msse2 -Winline" + SSE2_CFLAGS="-msse2 -Winline $STACKREALIGN" fi fi @@ -449,7 +456,7 @@ dnl =========================================================================== dnl Check for SSSE3 if test "x$SSSE3_CFLAGS" = "x" ; then - SSSE3_CFLAGS="-mssse3 -Winline" + SSSE3_CFLAGS="-mssse3 -Winline $STACKREALIGN" fi have_ssse3_intrinsics=no diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c index 2ab26903..5d326f47 100644 --- a/pixman/pixman-sse2.c +++ b/pixman/pixman-sse2.c @@ -3312,9 +3312,6 @@ sse2_composite_over_n_8_8888 (pixman_implementation_t *imp, } -#if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__) -__attribute__((__force_align_arg_pointer__)) -#endif static pixman_bool_t sse2_fill (pixman_implementation_t *imp, uint32_t * bits, @@ -6411,9 +6408,6 @@ static const pixman_iter_info_t sse2_iters[] = { PIXMAN_null }, }; -#if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__) -__attribute__((__force_align_arg_pointer__)) -#endif pixman_implementation_t * _pixman_implementation_create_sse2 (pixman_implementation_t *fallback) { diff --git a/pixman/pixman.c b/pixman/pixman.c index 9555ceaa..5490e59a 100644 --- a/pixman/pixman.c +++ b/pixman/pixman.c @@ -547,25 +547,6 @@ analyze_extent (pixman_image_t *image, return TRUE; } -/* - * Work around GCC bug causing crashes in Mozilla with SSE2 - * - * When using -msse, gcc generates movdqa instructions assuming that - * the stack is 16 byte aligned. Unfortunately some applications, such - * as Mozilla and Mono, end up aligning the stack to 4 bytes, which - * causes the movdqa instructions to fail. - * - * The __force_align_arg_pointer__ makes gcc generate a prologue that - * realigns the stack pointer to 16 bytes. - * - * On x86-64 this is not necessary because the standard ABI already - * calls for a 16 byte aligned stack. - * - * See https://bugs.freedesktop.org/show_bug.cgi?id=15693 - */ -#if defined (USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__) -__attribute__((__force_align_arg_pointer__)) -#endif PIXMAN_EXPORT void pixman_image_composite32 (pixman_op_t op, pixman_image_t * src, |