aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Jenkner2016-01-30 14:20:56 -0800
committerPaul Eggert2016-01-30 15:26:07 -0800
commitd6585a910ed3e9e0e43c093b5fbfeb6d56b703b4 (patch)
tree55f8f2160238a8d2047dbcdf885b4b4c346cb5bb
parentdec139084586762793448277ebe80cfa7a1790b3 (diff)
downloademacs-d6585a910ed3e9e0e43c093b5fbfeb6d56b703b4.tar.gz
emacs-d6585a910ed3e9e0e43c093b5fbfeb6d56b703b4.zip
Add musl patch to support HYBRID_MALLOC on elf systems
* src/gmalloc.c: Adjust for HYBRID_MALLOC in the non CYGWIN case. (__default_morecore): Here, in particular. * configure.ac: Define HYBRID_MALLOC when unexelf.o is used. New variable SHEAP_OBJ. * src/Makefile.in: Use it. (Bug#22086)
-rw-r--r--configure.ac12
-rw-r--r--src/Makefile.in6
-rw-r--r--src/gmalloc.c4
3 files changed, 17 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 4a0dc568742..cd3a9bc3daf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2121,7 +2121,13 @@ case "$opsys" in
2121 cygwin) hybrid_malloc=yes;; 2121 cygwin) hybrid_malloc=yes;;
2122esac 2122esac
2123 2123
2124if test "${system_malloc}" != yes && test "${doug_lea_malloc}" != yes \
2125 && test "${UNEXEC_OBJ}" = unexelf.o && test "${hybrid_malloc}" != no; then
2126 hybrid_malloc=yes
2127fi
2128
2124GMALLOC_OBJ= 2129GMALLOC_OBJ=
2130SHEAP_OBJ=
2125if test "${system_malloc}" = "yes"; then 2131if test "${system_malloc}" = "yes"; then
2126 AC_DEFINE([SYSTEM_MALLOC], 1, 2132 AC_DEFINE([SYSTEM_MALLOC], 1,
2127 [Define to 1 to use the system memory allocator, even if it is not 2133 [Define to 1 to use the system memory allocator, even if it is not
@@ -2136,6 +2142,7 @@ elif test "$hybrid_malloc" = yes; then
2136 GNU_MALLOC= 2142 GNU_MALLOC=
2137 GNU_MALLOC_reason="only before dumping" 2143 GNU_MALLOC_reason="only before dumping"
2138 GMALLOC_OBJ=gmalloc.o 2144 GMALLOC_OBJ=gmalloc.o
2145 SHEAP_OBJ=sheap.o
2139 VMLIMIT_OBJ= 2146 VMLIMIT_OBJ=
2140else 2147else
2141 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o 2148 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
@@ -2156,9 +2163,10 @@ else
2156 fi 2163 fi
2157fi 2164fi
2158AC_SUBST(GMALLOC_OBJ) 2165AC_SUBST(GMALLOC_OBJ)
2166AC_SUBST(SHEAP_OBJ)
2159AC_SUBST(VMLIMIT_OBJ) 2167AC_SUBST(VMLIMIT_OBJ)
2160 2168
2161if test "$doug_lea_malloc" = "yes" ; then 2169if test "$doug_lea_malloc" = "yes" && test "$hybrid_malloc" != yes; then
2162 if test "$GNU_MALLOC" = yes ; then 2170 if test "$GNU_MALLOC" = yes ; then
2163 GNU_MALLOC_reason=" 2171 GNU_MALLOC_reason="
2164 (Using Doug Lea's new malloc from the GNU C Library.)" 2172 (Using Doug Lea's new malloc from the GNU C Library.)"
@@ -5035,7 +5043,7 @@ fi
5035AC_SUBST(RALLOC_OBJ) 5043AC_SUBST(RALLOC_OBJ)
5036 5044
5037if test "$opsys" = "cygwin"; then 5045if test "$opsys" = "cygwin"; then
5038 CYGWIN_OBJ="sheap.o cygw32.o" 5046 CYGWIN_OBJ="cygw32.o"
5039 ## Cygwin differs because of its unexec(). 5047 ## Cygwin differs because of its unexec().
5040 PRE_ALLOC_OBJ= 5048 PRE_ALLOC_OBJ=
5041 POST_ALLOC_OBJ=lastfile.o 5049 POST_ALLOC_OBJ=lastfile.o
diff --git a/src/Makefile.in b/src/Makefile.in
index 6a315427b6f..e59d3b1568f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -254,7 +254,10 @@ XFIXES_CFLAGS = @XFIXES_CFLAGS@
254## widget.o if USE_X_TOOLKIT, otherwise empty. 254## widget.o if USE_X_TOOLKIT, otherwise empty.
255WIDGET_OBJ=@WIDGET_OBJ@ 255WIDGET_OBJ=@WIDGET_OBJ@
256 256
257## sheap.o if CYGWIN, otherwise empty. 257## sheap.o if HYBRID_MALLOC, otherwise empty.
258SHEAP_OBJ=@SHEAP_OBJ@
259
260## cygw32.o if CYGWIN, otherwise empty.
258CYGWIN_OBJ=@CYGWIN_OBJ@ 261CYGWIN_OBJ=@CYGWIN_OBJ@
259 262
260## fontset.o fringe.o image.o if we have any window system 263## fontset.o fringe.o image.o if we have any window system
@@ -397,6 +400,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
397 doprnt.o intervals.o textprop.o composite.o xml.o $(NOTIFY_OBJ) \ 400 doprnt.o intervals.o textprop.o composite.o xml.o $(NOTIFY_OBJ) \
398 $(XWIDGETS_OBJ) \ 401 $(XWIDGETS_OBJ) \
399 profiler.o decompress.o \ 402 profiler.o decompress.o \
403 $(SHEAP_OBJ) \
400 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ 404 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
401 $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) 405 $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ)
402obj = $(base_obj) $(NS_OBJC_OBJ) 406obj = $(base_obj) $(NS_OBJC_OBJ)
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 72d65af4974..30e01319e0e 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -70,7 +70,7 @@ extern void emacs_abort (void);
70#define aligned_alloc galigned_alloc 70#define aligned_alloc galigned_alloc
71#define free gfree 71#define free gfree
72 72
73#ifdef CYGWIN 73#ifdef HYBRID_MALLOC
74extern void *bss_sbrk (ptrdiff_t size); 74extern void *bss_sbrk (ptrdiff_t size);
75extern int bss_sbrk_did_unexec; 75extern int bss_sbrk_did_unexec;
76extern char bss_sbrk_buffer[]; 76extern char bss_sbrk_buffer[];
@@ -1542,7 +1542,7 @@ void *
1542__default_morecore (ptrdiff_t increment) 1542__default_morecore (ptrdiff_t increment)
1543{ 1543{
1544 void *result; 1544 void *result;
1545#if defined (CYGWIN) 1545#ifdef HYBRID_MALLOC
1546 if (!DUMPED) 1546 if (!DUMPED)
1547 { 1547 {
1548 return bss_sbrk (increment); 1548 return bss_sbrk (increment);