summaryrefslogtreecommitdiff
path: root/packaging/0001-x86-Align-the-stack-to-16-bytes-before-making-the-ca.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/0001-x86-Align-the-stack-to-16-bytes-before-making-the-ca.patch')
-rw-r--r--packaging/0001-x86-Align-the-stack-to-16-bytes-before-making-the-ca.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/packaging/0001-x86-Align-the-stack-to-16-bytes-before-making-the-ca.patch b/packaging/0001-x86-Align-the-stack-to-16-bytes-before-making-the-ca.patch
new file mode 100644
index 0000000..232f7f8
--- /dev/null
+++ b/packaging/0001-x86-Align-the-stack-to-16-bytes-before-making-the-ca.patch
@@ -0,0 +1,34 @@
+From f092b034d2253f29cf50bb38ad33f9534a89cfb8 Mon Sep 17 00:00:00 2001
+From: Neil Roberts <neil@linux.intel.com>
+Date: Fri, 26 Feb 2010 14:42:49 +0000
+Subject: [PATCH] x86: Align the stack to 16-bytes before making the call
+
+If gcc is targetting i686 then it will use SSE registers for the
+floating point operations. It will then sometimes use 16-byte
+temporary variables on the stack to store the registers and it will
+use aligned instructions to access them. This will segfault if the
+variable is not aligned to 16-bytes. Apparently GCC assumes that the
+stack is 16-byte aligned when a function is entered and it uses this
+to position its temporary variables. Therefore libffi needs to align
+the stack or the called function will crash in some circumstances.
+---
+ src/x86/sysv.S | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/src/x86/sysv.S b/src/x86/sysv.S
+index f4b6c1e..81374cc 100644
+--- a/src/x86/sysv.S
++++ b/src/x86/sysv.S
+@@ -48,6 +48,9 @@ ffi_call_SYSV:
+ movl 16(%ebp),%ecx
+ subl %ecx,%esp
+
++ /* Align the stack pointer to 16-bytes */
++ andl $0xfffffff0, %esp
++
+ movl %esp,%eax
+
+ /* Place all of the ffi_prep_args in position */
+--
+1.6.5.rc1.46.g4d818
+