summaryrefslogtreecommitdiff
path: root/src/gmalloc.c
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@users.sourceforge.net>2017-10-31 13:31:46 -0400
committerNoam Postavsky <npostavs@gmail.com>2017-11-04 18:49:28 -0400
commit918a2dda07ebf16601a93d0464f62c4e846d8b39 (patch)
treef98b930dcbcfb83608c38d949254dabaeeddaec9 /src/gmalloc.c
parent725ab635d9c4c0ecbd4b28df16d2b97337bbe989 (diff)
downloademacs-918a2dda07ebf16601a93d0464f62c4e846d8b39.tar.gz
Use hybrid malloc for FreeBSD (Bug#28308)
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.
Diffstat (limited to 'src/gmalloc.c')
-rw-r--r--src/gmalloc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 2bda95ebd3d..a17d39c1eeb 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -1502,17 +1502,18 @@ extern void *__sbrk (ptrdiff_t increment);
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;