Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jul 2014 17:55:30 -0500
From:      Stacey Son <sson@FreeBSD.org>
To:        mips@freebsd.org
Cc:        zeising@FreeBSD.org
Subject:   mips devel/libffi port patches
Message-ID:  <4B49A41F-DE03-4FD7-9FFB-6EC878EB8D70@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

--Apple-Mail=_47288A42-05AC-4D41-8704-770989000ED7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

FYI,

The following attached diff fixes the devel/libffi for FreeBSD/mips64 so =
it builds.  It modifies 'configure' to recognize 'mips*-*-freebsd*' and =
removes the call to cacheflush(), which doesn't seem to exist currently =
on FreeBSD/mips64 in any form.

Regards,

-stacey.



--Apple-Mail=_47288A42-05AC-4D41-8704-770989000ED7
Content-Disposition: attachment;
	filename=devel_libffi_port.diff
Content-Type: application/octet-stream;
	name="devel_libffi_port.diff"
Content-Transfer-Encoding: 7bit

commit 26d21ea2b14d059aafc288929f3d1bea6a07b13f
Author: Stacey Son <sson@FreeBSD.org>
Date:   Wed Jul 16 22:43:38 2014 +0000

    Additional patches so devel/libffi builds on mips64.
    
    Adds mips*-*-freebsd* to configure and #ifdef's out call to cacheflush(),
    which doesn't seem to exist currently on FreeBSD/mips64 in any form.

diff --git a/files/patch-configure b/files/patch-configure
new file mode 100644
index 0000000..1e29bb2
--- /dev/null
+++ b/files/patch-configure
@@ -0,0 +1,13 @@
+diff --git ./configure.orig ./configure
+index 4b04db7..0d94fbd 100755
+--- ./configure.orig
++++ ./configure
+@@ -13428,7 +13428,7 @@ case "$host" in
+   mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
+ 	TARGET=MIPS; TARGETDIR=mips
+ 	;;
+-  mips*-*-linux* | mips*-*-openbsd*)
++  mips*-*-linux* | mips*-*-openbsd* | mips*-*-freebsd*)
+ 	# Support 128-bit long double for NewABI.
+ 	HAVE_LONG_DOUBLE='defined(__mips64)'
+ 	TARGET=MIPS; TARGETDIR=mips
diff --git a/files/patch-src__mips__ffi.c b/files/patch-src__mips__ffi.c
new file mode 100644
index 0000000..d93f373
--- /dev/null
+++ b/files/patch-src__mips__ffi.c
@@ -0,0 +1,29 @@
+diff --git ./src/mips/ffi.c.orig ./src/mips/ffi.c
+index 03121e3..8b7881f 100644
+--- ./src/mips/ffi.c.orig
++++ ./src/mips/ffi.c
+@@ -38,7 +38,9 @@
+ #endif
+ 
+ #ifndef USE__BUILTIN___CLEAR_CACHE
+-#  if defined(__OpenBSD__)
++#  if defined(__FreeBSD__)
++#    include <machine/sysarch.h>
++#  elif defined(__OpenBSD__)
+ #    include <mips64/sysarch.h>
+ #  else
+ #    include <sys/cachectl.h>
+@@ -729,11 +731,13 @@ ffi_prep_closure_loc (ffi_closure *closure,
+   closure->fun = fun;
+   closure->user_data = user_data;
+ 
++#if !defined(__FreeBSD__)
+ #ifdef USE__BUILTIN___CLEAR_CACHE
+   __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE);
+ #else
+   cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE);
+ #endif
++#endif /* ! __FreeBSD__ */
+   return FFI_OK;
+ }
+ 
diff --git a/files/patch-src__mips__ffitarget.h b/files/patch-src__mips__ffitarget.h
new file mode 100644
index 0000000..4c52e32
--- /dev/null
+++ b/files/patch-src__mips__ffitarget.h
@@ -0,0 +1,13 @@
+diff --git ./src/mips/ffitarget.h.orig ./src/mips/ffitarget.h
+index 717d659..5a0c2b1 100644
+--- ./src/mips/ffitarget.h.orig
++++ ./src/mips/ffitarget.h
+@@ -41,7 +41,7 @@
+ #define _MIPS_SIM_ABI32		1
+ #define _MIPS_SIM_NABI32	2
+ #define _MIPS_SIM_ABI64		3
+-#elif !defined(__OpenBSD__)
++#elif !defined(__OpenBSD__) && !defined(__FreeBSD__)
+ # include <sgidefs.h>
+ #endif
+ 

--Apple-Mail=_47288A42-05AC-4D41-8704-770989000ED7--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B49A41F-DE03-4FD7-9FFB-6EC878EB8D70>