Index: mono/Makefile.in
--- mono/Makefile.in.orig	2016-08-04 08:40:18.122149000 +0200
+++ mono/Makefile.in	2016-08-04 08:41:07.832157135 +0200
@@ -379,7 +379,7 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 @SUPPORT_SGEN_TRUE@sgen_dirs = sgen
-@CROSS_COMPILING_FALSE@@INSTALL_MONOTOUCH_FALSE@SUBDIRS = arch utils io-layer cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
+@CROSS_COMPILING_FALSE@@INSTALL_MONOTOUCH_FALSE@SUBDIRS = arch utils io-layer cil metadata $(sgen_dirs) mini dis profiler
 @CROSS_COMPILING_FALSE@@INSTALL_MONOTOUCH_TRUE@SUBDIRS = arch utils io-layer metadata $(sgen_dirs) mini profiler
 @CROSS_COMPILING_TRUE@SUBDIRS = arch utils io-layer cil metadata $(sgen_dirs) mini dis profiler
 DIST_SUBDIRS = arch utils io-layer cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
Index: mono/io-layer/processes.h
--- mono/io-layer/processes.h.orig	2016-08-03 12:33:31.000000000 +0200
+++ mono/io-layer/processes.h	2016-08-04 08:40:18.132147846 +0200
@@ -14,6 +14,7 @@
 #include <unistd.h>
 #endif
 #include <glib.h>
+#include <sys/types.h>
 
 #include <mono/io-layer/handles.h>
 #include <mono/io-layer/access.h>
Index: mono/mini/mini-x86.c
--- mono/mini/mini-x86.c.orig	2016-08-03 12:33:31.000000000 +0200
+++ mono/mini/mini-x86.c	2016-08-04 08:40:18.132147846 +0200
@@ -542,6 +542,34 @@
 	return get_call_info_internal (cinfo, sig);
 }
 
+#ifndef signbit
+union IEEEd2bits {
+    double d;
+    struct {
+#if _BYTE_ORDER == G_LITTLE_ENDIAN
+	unsigned int    manl    :32;
+	unsigned int    manh    :20;
+	unsigned int    exp     :11;
+	unsigned int    sign    :1;
+#else
+	unsigned int    sign    :1;
+	unsigned int    exp     :11;
+	unsigned int    manh    :20;
+	unsigned int    manl    :32;
+#endif
+    } bits;
+};
+
+int
+signbit(double d)
+{
+    union IEEEd2bits u;
+
+    u.d = d;
+    return (u.bits.sign);
+}
+
+#endif /* signbit */
 /*
  * mono_arch_get_argument_info:
  * @csig:  a method signature
Index: mono/utils/mono-codeman.c
--- mono/utils/mono-codeman.c.orig	2016-08-03 12:33:32.000000000 +0200
+++ mono/utils/mono-codeman.c	2016-08-04 08:40:18.132147846 +0200
@@ -53,7 +53,7 @@
 #define MAX_WASTAGE 32
 #define MIN_BSIZE 32
 
-#ifdef __x86_64__
+#if defined(__x86_64__) && !defined(__FreeBSD__)
 #define ARCH_MAP_FLAGS MONO_MMAP_32BIT
 #else
 #define ARCH_MAP_FLAGS 0
Index: support/stdio.c
--- support/stdio.c.orig	2016-08-03 12:33:32.000000000 +0200
+++ support/stdio.c	2016-08-04 08:40:18.132147846 +0200
@@ -146,13 +146,13 @@
 Mono_Posix_Stdlib_setvbuf (void* stream, void *buf, int mode, mph_size_t size)
 {
 	mph_return_if_size_t_overflow (size);
-	return setvbuf (stream, (char *) buf, mode, (size_t) size);
+	return setvbuf ((FILE *)stream, (char *) buf, mode, (size_t) size);
 }
 
 int 
 Mono_Posix_Stdlib_setbuf (void* stream, void* buf)
 {
-	setbuf (stream, buf);
+	setbuf ((FILE *)stream, buf);
 	return 0;
 }
 
@@ -161,13 +161,13 @@
 {
 	mph_return_if_long_overflow (offset);
 
-	return fseek (stream, offset, origin);
+	return fseek ((FILE *)stream, offset, origin);
 }
 
 gint64
 Mono_Posix_Stdlib_ftell (void* stream)
 {
-	return ftell (stream);
+	return ftell ((FILE *)stream);
 }
 
 void*
@@ -180,20 +180,20 @@
 gint32
 Mono_Posix_Stdlib_fgetpos (void* stream, void *pos)
 {
-	return fgetpos (stream, (fpos_t*) pos);
+	return fgetpos ((FILE *)stream, (fpos_t*) pos);
 }
 
 gint32
 Mono_Posix_Stdlib_fsetpos (void* stream, void *pos)
 {
-	return fsetpos (stream, (fpos_t*) pos);
+	return fsetpos ((FILE *)stream, (fpos_t*) pos);
 }
 
 int
 Mono_Posix_Stdlib_rewind (void* stream)
 {
 	do {
-		rewind (stream);
+		rewind ((FILE *)stream);
 	} while (errno == EINTR);
 	mph_return_if_val_in_list5(errno, EAGAIN, EBADF, EFBIG, EINVAL, EIO);
 	mph_return_if_val_in_list5(errno, ENOSPC, ENXIO, EOVERFLOW, EPIPE, ESPIPE);
