diff options
| author | Wolfgang Jenkner | 2016-01-30 14:20:56 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-01-30 15:26:07 -0800 |
| commit | d6585a910ed3e9e0e43c093b5fbfeb6d56b703b4 (patch) | |
| tree | 55f8f2160238a8d2047dbcdf885b4b4c346cb5bb | |
| parent | dec139084586762793448277ebe80cfa7a1790b3 (diff) | |
| download | emacs-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.ac | 12 | ||||
| -rw-r--r-- | src/Makefile.in | 6 | ||||
| -rw-r--r-- | src/gmalloc.c | 4 |
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;; |
| 2122 | esac | 2122 | esac |
| 2123 | 2123 | ||
| 2124 | if test "${system_malloc}" != yes && test "${doug_lea_malloc}" != yes \ | ||
| 2125 | && test "${UNEXEC_OBJ}" = unexelf.o && test "${hybrid_malloc}" != no; then | ||
| 2126 | hybrid_malloc=yes | ||
| 2127 | fi | ||
| 2128 | |||
| 2124 | GMALLOC_OBJ= | 2129 | GMALLOC_OBJ= |
| 2130 | SHEAP_OBJ= | ||
| 2125 | if test "${system_malloc}" = "yes"; then | 2131 | if 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= |
| 2140 | else | 2147 | else |
| 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 |
| 2157 | fi | 2164 | fi |
| 2158 | AC_SUBST(GMALLOC_OBJ) | 2165 | AC_SUBST(GMALLOC_OBJ) |
| 2166 | AC_SUBST(SHEAP_OBJ) | ||
| 2159 | AC_SUBST(VMLIMIT_OBJ) | 2167 | AC_SUBST(VMLIMIT_OBJ) |
| 2160 | 2168 | ||
| 2161 | if test "$doug_lea_malloc" = "yes" ; then | 2169 | if 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 | |||
| 5035 | AC_SUBST(RALLOC_OBJ) | 5043 | AC_SUBST(RALLOC_OBJ) |
| 5036 | 5044 | ||
| 5037 | if test "$opsys" = "cygwin"; then | 5045 | if 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. |
| 255 | WIDGET_OBJ=@WIDGET_OBJ@ | 255 | WIDGET_OBJ=@WIDGET_OBJ@ |
| 256 | 256 | ||
| 257 | ## sheap.o if CYGWIN, otherwise empty. | 257 | ## sheap.o if HYBRID_MALLOC, otherwise empty. |
| 258 | SHEAP_OBJ=@SHEAP_OBJ@ | ||
| 259 | |||
| 260 | ## cygw32.o if CYGWIN, otherwise empty. | ||
| 258 | CYGWIN_OBJ=@CYGWIN_OBJ@ | 261 | CYGWIN_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) |
| 402 | obj = $(base_obj) $(NS_OBJC_OBJ) | 406 | obj = $(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 |
| 74 | extern void *bss_sbrk (ptrdiff_t size); | 74 | extern void *bss_sbrk (ptrdiff_t size); |
| 75 | extern int bss_sbrk_did_unexec; | 75 | extern int bss_sbrk_did_unexec; |
| 76 | extern char bss_sbrk_buffer[]; | 76 | extern 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); |