FreeBSD aarch64 does not provide sbrk, so gmalloc cannot be used; when
using system malloc dumping does not work correctly (allocated data is
invalid after dumping).
* configure.ac: Set hybrid_malloc for freebsd.
* src/gmalloc.c (gdefault_morecore) [!HAVE_SBRK]: Don't call sbrk.
case "$opsys" in
## darwin ld insists on the use of malloc routines in the System framework.
darwin | mingw32 | nacl | sol2-10) ;;
- cygwin | qnxto)
+ cygwin | qnxto | freebsd)
hybrid_malloc=yes
system_malloc= ;;
*) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
static void *
gdefault_morecore (ptrdiff_t increment)
{
- void *result;
#ifdef HYBRID_MALLOC
if (!DUMPED)
{
return bss_sbrk (increment);
}
#endif
- result = (void *) __sbrk (increment);
- if (result == (void *) -1)
- return NULL;
- return result;
+#ifdef HAVE_SBRK
+ void *result = (void *) __sbrk (increment);
+ if (result != (void *) -1)
+ return result;
+#endif
+ return NULL;
}
void *(*__morecore) (ptrdiff_t) = gdefault_morecore;