[Pixman] [PATCH 2/2] configure.ac: For SSE2 and SSSE3 require GCC 4.4 and then use -mstackrealign

Søren Sandmann sandmann at cs.au.dk
Thu Oct 10 22:52:09 PDT 2013


Søren Sandmann <sandmann at cs.au.dk> writes:

> So here is a new series that simply adds -mstackrealign if the target_cpu
> is x86-32 and the compiler appears to support the option. The new patches
> should be applied after Siarhei's -Wdeclaration-after-statement patch
> since they conflict with it in a trivial way.

And this will fail on old GCCs that don't have -mstackrealign.

Since I don't want to spend any more time on this, I'll just do the
simple thing and add __force_align_arg_pointer__ to the two
pixman_composite_glyph() entry points.


Søren


>From 0fdb36d1a874d6c6e22a14facc2e6ea1b43db55f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= <ssp at redhat.com>
Date: Fri, 11 Oct 2013 00:49:44 -0400
Subject: [PATCH] pixman-glyph.c: Add __force_align_arg_pointer to composite
 functions

The functions pixman_composite_glyphs_no_mask() and
pixman_composite_glyphs() can call into code compiled with -msse2,
which requires the stack to be aligned to 16 bytes. Since the ABIs on
Windows and Linux for x86-32 don't provide this guarantee, we need to
use this attribute to make GCC generate a prologue that realigns the
stack.

This fixes the crash introduced in the previous commit and also

   https://bugs.freedesktop.org/show_bug.cgi?id=70348

and

   https://bugs.freedesktop.org/show_bug.cgi?id=68300
---
 pixman/pixman-glyph.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pixman/pixman-glyph.c b/pixman/pixman-glyph.c
index 5a271b6..96a349a 100644
--- a/pixman/pixman-glyph.c
+++ b/pixman/pixman-glyph.c
@@ -391,6 +391,9 @@ box32_intersect (pixman_box32_t *dest,
     return dest->x2 > dest->x1 && dest->y2 > dest->y1;
 }
 
+#if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
+__attribute__((__force_align_arg_pointer__))
+#endif
 PIXMAN_EXPORT void
 pixman_composite_glyphs_no_mask (pixman_op_t            op,
 				 pixman_image_t        *src,
@@ -630,6 +633,9 @@ out:
  *   - Trim the mask to the destination clip/image?
  *   - Trim composite region based on sources, when the op ignores 0s.
  */
+#if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
+__attribute__((__force_align_arg_pointer__))
+#endif
 PIXMAN_EXPORT void
 pixman_composite_glyphs (pixman_op_t            op,
 			 pixman_image_t        *src,
-- 
1.7.11.7



More information about the Pixman mailing list