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.
This commit is contained in:
parent
725ab635d9
commit
918a2dda07
2 changed files with 7 additions and 6 deletions
|
@ -2218,7 +2218,7 @@ test "$CANNOT_DUMP" = yes ||
|
||||||
case "$opsys" in
|
case "$opsys" in
|
||||||
## darwin ld insists on the use of malloc routines in the System framework.
|
## darwin ld insists on the use of malloc routines in the System framework.
|
||||||
darwin | mingw32 | nacl | sol2-10) ;;
|
darwin | mingw32 | nacl | sol2-10) ;;
|
||||||
cygwin | qnxto)
|
cygwin | qnxto | freebsd)
|
||||||
hybrid_malloc=yes
|
hybrid_malloc=yes
|
||||||
system_malloc= ;;
|
system_malloc= ;;
|
||||||
*) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
|
*) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
|
||||||
|
|
|
@ -1502,17 +1502,18 @@ extern void *__sbrk (ptrdiff_t increment);
|
||||||
static void *
|
static void *
|
||||||
gdefault_morecore (ptrdiff_t increment)
|
gdefault_morecore (ptrdiff_t increment)
|
||||||
{
|
{
|
||||||
void *result;
|
|
||||||
#ifdef HYBRID_MALLOC
|
#ifdef HYBRID_MALLOC
|
||||||
if (!DUMPED)
|
if (!DUMPED)
|
||||||
{
|
{
|
||||||
return bss_sbrk (increment);
|
return bss_sbrk (increment);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
result = (void *) __sbrk (increment);
|
#ifdef HAVE_SBRK
|
||||||
if (result == (void *) -1)
|
void *result = (void *) __sbrk (increment);
|
||||||
return NULL;
|
if (result != (void *) -1)
|
||||||
return result;
|
return result;
|
||||||
|
#endif
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *(*__morecore) (ptrdiff_t) = gdefault_morecore;
|
void *(*__morecore) (ptrdiff_t) = gdefault_morecore;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue