I'm not particularly knowledgeable about autoconf/make, but it looks
correct AFAICT. Thanks for doing this.
I think it would be useful to also add a comment somewhere on why
-mstackrealign is necessary for 32-bits, for future reference.
Reviewed-by: Jose Fonseca <jfons...@vmware.com>
Jose
On 07/12/14 12:13, Timothy Arceri wrote:
Nowadays GCC assumes stack pointer is 16-byte aligned even on 32-bits, but that
is an assumption OpenGL drivers (or any dynamic library for that matter) can't
afford to make as there are many closed- and open- source application binaries
out there that only assume 4-byte stack alignment.
V2: use $target_cpu rather than $host_cpu
and setup build flags in config rather than makefile
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D86788&d=AAIBAQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=weeQ6GJvnQZRjCkjJDlt2roe8RkioxRFO4Rstd2I7Qc&s=w8hG15bIjKbRUDArovpsg5FkTcM8R5Jb7bayyaXGWis&e=
Signed-off-by: Timothy Arceri <t_arc...@yahoo.com.au>
---
Tested by cross compiling and running 32-bit version of
UrbanTerror.
Please note if this patch is ok it should also be applied to 10.4 with
the last hunk removed.
configure.ac | 11 ++++++++++-
src/mesa/Makefile.am | 2 +-
src/mesa/main/sse_minmax.c | 3 ---
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index b0df1bb..7dc435a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,8 +253,9 @@ AC_SUBST([VISIBILITY_CXXFLAGS])
dnl
dnl Optional flags, check for compiler support
dnl
+SSE41_CFLAGS="-msse4.1"
save_CFLAGS="$CFLAGS"
-CFLAGS="-msse4.1 $CFLAGS"
+CFLAGS="$SSE41_CFLAGS $CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <smmintrin.h>
int main () {
@@ -474,6 +475,12 @@ fi
dnl
dnl Arch/platform-specific settings
dnl
+case "$target_cpu" in
+ i?86)
+ SSE41_CFLAGS="$SSE41_CFLAGS -mstackrealign"
+;;
+esac
+
AC_ARG_ENABLE([asm],
[AS_HELP_STRING([--disable-asm],
[disable assembly usage @<:@default=enabled on supported
plaforms@:>@])],
@@ -2091,6 +2098,8 @@ AM_CONDITIONAL(HAVE_X86_ASM, test "x$asm_arch" = xx86 -o
"x$asm_arch" = xx86_64)
AM_CONDITIONAL(HAVE_X86_64_ASM, test "x$asm_arch" = xx86_64)
AM_CONDITIONAL(HAVE_SPARC_ASM, test "x$asm_arch" = xsparc)
+AC_SUBST([SSE41_CFLAGS], $SSE41_CFLAGS)
+
AC_SUBST([NINE_MAJOR], 1)
AC_SUBST([NINE_MINOR], 0)
AC_SUBST([NINE_TINY], 0)
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 932db4f..3b68573 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -153,7 +153,7 @@ libmesagallium_la_LIBADD = \
libmesa_sse41_la_SOURCES = \
main/streaming-load-memcpy.c \
main/sse_minmax.c
-libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1
+libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) $(SSE41_CFLAGS)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gl.pc
diff --git a/src/mesa/main/sse_minmax.c b/src/mesa/main/sse_minmax.c
index 93cf2a6..222ac14 100644
--- a/src/mesa/main/sse_minmax.c
+++ b/src/mesa/main/sse_minmax.c
@@ -31,9 +31,6 @@
#include <stdint.h>
void
-#if !defined(__x86_64__)
- __attribute__((force_align_arg_pointer))
-#endif
_mesa_uint_array_min_max(const unsigned *ui_indices, unsigned *min_index,
unsigned *max_index, const unsigned count)
{
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev