summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu-system.am1
-rw-r--r--gnu/packages/libffi.scm4
-rw-r--r--gnu/packages/patches/libffi-mips-n32-fix.patch21
3 files changed, 25 insertions, 1 deletions
diff --git a/gnu-system.am b/gnu-system.am
index 6c98ca31ad..80d9438ad3 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -237,6 +237,7 @@ dist_patch_DATA = \
gnu/packages/patches/guile-relocatable.patch \
gnu/packages/patches/hop-bigloo-4.0b.patch \
gnu/packages/patches/libevent-dns-tests.patch \
+ gnu/packages/patches/libffi-mips-n32-fix.patch \
gnu/packages/patches/libtool-skip-tests.patch \
gnu/packages/patches/libtool-skip-tests-for-mips.patch \
gnu/packages/patches/m4-gets-undeclared.patch \
diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index e4a2761273..d1a834d9c5 100644
--- a/gnu/packages/libffi.scm
+++ b/gnu/packages/libffi.scm
@@ -17,6 +17,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages libffi)
+ #:use-module (gnu packages)
#:use-module (guix licenses)
#:use-module (guix packages)
#:use-module (guix download)
@@ -46,7 +47,8 @@
name "-" version ".tar.gz"))
(sha256
(base32
- "077ibkf84bvcd6rw1m6jb107br63i2pp301rkmsbgg6300adxp8x"))))
+ "077ibkf84bvcd6rw1m6jb107br63i2pp301rkmsbgg6300adxp8x"))
+ (patches (list (search-patch "libffi-mips-n32-fix.patch")))))
(build-system gnu-build-system)
(arguments `(#:modules ((guix build utils) (guix build gnu-build-system)
(ice-9 ftw) (srfi srfi-26))
diff --git a/gnu/packages/patches/libffi-mips-n32-fix.patch b/gnu/packages/patches/libffi-mips-n32-fix.patch
new file mode 100644
index 0000000000..87ec48f883
--- /dev/null
+++ b/gnu/packages/patches/libffi-mips-n32-fix.patch
@@ -0,0 +1,21 @@
+Fix handling of uint32_t arguments on the MIPS N32 ABI.
+
+Patch by Mark H Weaver <mhw@netris.org>.
+
+--- libffi/src/mips/ffi.c.orig 2013-03-16 07:19:39.000000000 -0400
++++ libffi/src/mips/ffi.c 2013-10-22 01:11:03.111985247 -0400
+@@ -170,7 +170,14 @@
+ break;
+
+ case FFI_TYPE_UINT32:
++#ifdef FFI_MIPS_N32
++ /* The N32 ABI requires that 32-bit integers
++ be sign-extended to 64-bits, regardless of
++ whether they are signed or unsigned. */
++ *(ffi_arg *)argp = *(SINT32 *)(* p_argv);
++#else
+ *(ffi_arg *)argp = *(UINT32 *)(* p_argv);
++#endif
+ break;
+
+ /* This can only happen with 64bit slots. */