From bb5323e44886cd8a1f4f2fa25fad797bdc3f35ed Mon Sep 17 00:00:00 2001 From: Juan Francisco Cantero Hurtado Date: Mon, 16 Sep 2013 17:38:00 +0200 Subject: [PATCH] Fix a crash of racket on OpenBSD systems, when pixman is compiled with SSE support and racket tries to load cairo using libffi. Bug found initially by Juan Francisco Cantero Hurtado. Reported by many. Mark Kettenis (from the OpenBSD Project) found the real reason of the crash and created this patch for libffi. Patch taken from OpenBSD Ports. --- racket/src/foreign/README | 2 ++ racket/src/foreign/libffi/src/x86/freebsd.S | 3 +++ 2 files changed, 5 insertions(+) diff --git a/racket/src/foreign/README b/racket/src/foreign/README index ea4635381e..7436d0e443 100644 --- a/racket/src/foreign/README +++ b/racket/src/foreign/README @@ -23,6 +23,8 @@ Local changes: * In "x86/ffi.c" for Win32, don't try to align stack for stdcall, fastcall, or thiscall. + * In "x86/freebsd.S", align the stack pointer to 16 bytes. + ========== libffi_msvc directory ===================================== This directory is synced from the CTypes repository diff --git a/racket/src/foreign/libffi/src/x86/freebsd.S b/racket/src/foreign/libffi/src/x86/freebsd.S index afde513164..cba17a538d 100644 --- a/racket/src/foreign/libffi/src/x86/freebsd.S +++ b/racket/src/foreign/libffi/src/x86/freebsd.S @@ -49,6 +49,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 */