Subject: bug#28308: Build failure on FreeBSD/aarch64

From: Noam Postavsky <[email-masked]>
Date: Tue, 31 Oct 2017 13:31:46 -0400

tags 28308 + patch
quit

On Tue, Oct 24, 2017 at 2:43 PM, Noam Postavsky
<[email-masked]> wrote:

> It seems that the memory pointer to by float_block->floats becomes
> invalid following the dumping process.

The following patch which makes FreeBSD use the hybrid malloc scheme fixes it:

diff --git a/configure.ac b/configure.ac
index d294412dc4..2e690987a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2206,7 +2206,7 @@ AC_DEFUN
 case "$opsys" in
   ## darwin ld insists on the use of malloc routines in the System framework.
   darwin | mingw32 | nacl | sol2-10) ;;
-  cygwin) hybrid_malloc=yes
+  freebsd | cygwin) hybrid_malloc=yes
           system_malloc= ;;
   *) test "$ac_cv_func_sbrk" = yes &&
system_malloc=$emacs_cv_sanitize_address;;
 esac
diff --git a/src/gmalloc.c b/src/gmalloc.c
index baaff58050..8fd05fe845 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -1509,9 +1509,13 @@ gdefault_morecore (ptrdiff_t increment)
       return bss_sbrk (increment);
     }
 #endif
+#ifdef HAVE_SBRK
   result = (void *) __sbrk (increment);
   if (result == (void *) -1)
     return NULL;
+#else
+  result = NULL;
+#endif
   return result;
 }